Files
devops-infra-helm-charts-gcp/helm-templates/contour-v1.33.3-v2/templates/contour/deployment.yaml
T
2026-08-26 03:39:42 +05:30

257 lines
14 KiB
YAML

{{- /*
Copyright Broadcom, Inc. All Rights Reserved.
SPDX-License-Identifier: APACHE-2.0
*/}}
{{- if .Values.contour.enabled }}
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
kind: Deployment
metadata:
name: {{ printf "%s-contour" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }}
namespace: {{ include "common.names.namespace" . | quote }}
{{- $versionLabel := dict "app.kubernetes.io/version" ( include "common.images.version" ( dict "imageRoot" .Values.contour.image "chart" .Chart ) ) }}
{{- $labels := include "common.tplvalues.merge" ( dict "values" ( list .Values.commonLabels $versionLabel ) "context" . ) }}
labels: {{- include "common.labels.standard" ( dict "customLabels" $labels "context" $ ) | nindent 4 }}
app.kubernetes.io/component: contour
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
{{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.contour.podLabels .Values.commonLabels $versionLabel ) "context" . ) }}
replicas: {{ .Values.contour.replicaCount }}
{{- if .Values.contour.updateStrategy }}
strategy: {{- toYaml .Values.contour.updateStrategy | nindent 4 }}
{{- end }}
selector:
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }}
app.kubernetes.io/component: contour
template:
metadata:
{{- if or .Values.configInline .Values.contour.podAnnotations .Values.commonAnnotations }}
annotations:
{{- if .Values.contour.podAnnotations }}
{{- include "common.tplvalues.render" (dict "value" .Values.contour.podAnnotations "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.configInline }}
checksum/config: {{ include (print $.Template.BasePath "/contour/configmap.yaml") . | sha256sum }}
{{- end }}
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 8 }}
{{- end }}
{{- end }}
labels: {{- include "common.labels.standard" ( dict "customLabels" $podLabels "context" $ ) | nindent 8 }}
app.kubernetes.io/component: contour
spec:
{{- include "common.images.pullSecrets" ( dict "images" (list .Values.contour.image) "global" .Values.global) | nindent 6 }}
{{- if .Values.contour.priorityClassName }}
priorityClassName: {{ .Values.contour.priorityClassName | quote }}
{{- end }}
automountServiceAccountToken: {{ .Values.contour.automountServiceAccountToken }}
{{- if .Values.contour.hostAliases }}
hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.contour.hostAliases "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.contour.affinity }}
affinity: {{- include "common.tplvalues.render" (dict "value" .Values.contour.affinity "context" $) | nindent 8 }}
{{- else }}
affinity:
podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.contour.podAffinityPreset "component" "contour" "customLabels" $podLabels "context" $) | nindent 10 }}
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.contour.podAntiAffinityPreset "component" "contour" "customLabels" $podLabels "context" $) | nindent 10 }}
nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.contour.nodeAffinityPreset.type "key" .Values.contour.nodeAffinityPreset.key "values" .Values.contour.nodeAffinityPreset.values) | nindent 10 }}
{{- end }}
{{- if .Values.contour.nodeSelector }}
nodeSelector: {{- include "common.tplvalues.render" (dict "value" .Values.contour.nodeSelector "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.contour.tolerations }}
tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.contour.tolerations "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.contour.schedulerName }}
schedulerName: {{ .Values.contour.schedulerName | quote }}
{{- end }}
{{- if .Values.contour.topologySpreadConstraints }}
topologySpreadConstraints: {{- include "common.tplvalues.render" (dict "value" .Values.contour.topologySpreadConstraints "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.contour.terminationGracePeriodSeconds }}
terminationGracePeriodSeconds: {{ .Values.contour.terminationGracePeriodSeconds }}
{{- end }}
{{- if .Values.contour.initContainers }}
initContainers: {{- include "common.tplvalues.render" ( dict "value" .Values.contour.initContainers "context" $ ) | nindent 6 }}
{{- end }}
containers:
- name: contour
{{- if .Values.diagnosticMode.enabled }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 12 }}
{{- else if .Values.contour.command }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.contour.command "context" $) | nindent 12 }}
{{- else }}
command:
- contour
{{- end }}
{{- if .Values.diagnosticMode.enabled }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 12 }}
{{- else if .Values.contour.args }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.contour.args "context" $) | nindent 12 }}
{{- else }}
args:
- serve
- --incluster
- --xds-address=0.0.0.0
- --xds-port={{ .Values.contour.containerPorts.xds }}
- --http-port={{ .Values.contour.containerPorts.metrics }}
- --envoy-service-http-port={{ .Values.envoy.containerPorts.http }}
- --envoy-service-https-port={{ .Values.envoy.containerPorts.https }}
- --contour-cafile=/certs/ca.crt
- --contour-cert-file=/certs/tls.crt
- --contour-key-file=/certs/tls.key
{{- if .Values.contour.configPath }}
- --config-path=/config/contour.yaml
{{- else }}
- --contour-config-name={{ .Values.contour.contourConfigName }}
{{- end }}
{{- if .Values.contour.ingressStatusAddress }}
- --ingress-status-address={{ .Values.contour.ingressStatusAddress }}
{{- else }}
- --envoy-service-namespace={{ default .Release.Namespace .Values.contour.envoyServiceNamespace }}
{{- $envoyServiceName := coalesce .Values.envoy.service.name .Values.contour.envoyServiceName }}
{{- if .Values.envoy.service.multiAz.enabled }}
- --envoy-service-name={{ default (printf "%s-%s-envoy" (include "common.names.fullname" .) (index .Values.envoy.service.multiAz.zones 0).name | trunc 63 | trimSuffix "-") $envoyServiceName }}
{{- else }}
- --envoy-service-name={{ default (printf "%s-envoy" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-") $envoyServiceName }}
{{- end }}
{{- end }}
- --leader-election-resource-name={{ default (printf "%s-%s" (include "common.names.namespace" .) (printf "%s-contour" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-")) .Values.contour.leaderElectionResourceName }}
{{- if .Values.contour.debug }}
- --debug
{{- end }}
- --log-format={{ .Values.contour.logFormat }}
- --kubernetes-debug={{ .Values.contour.kubernetesDebug }}
{{- if (include "contour.isIngressClassNameDefined" .) }}
- --ingress-class-name={{ include "contour.ingressClassName" . }}
{{- end }}
{{- if .Values.contour.rootNamespaces }}
- --root-namespaces={{ .Values.contour.rootNamespaces }}
{{- end }}
{{- if .Values.contour.extraArgs }}
{{- include "common.tplvalues.render" (dict "value" .Values.contour.extraArgs "context" $) | nindent 12 }}
{{- end }}
{{- end }}
image: {{ include "common.images.image" ( dict "imageRoot" .Values.contour.image "global" .Values.global) }}
imagePullPolicy: {{ .Values.contour.image.pullPolicy }}
ports:
- containerPort: {{ .Values.contour.containerPorts.xds }}
name: xds
protocol: TCP
- containerPort: {{ .Values.contour.containerPorts.metrics }}
name: metrics
protocol: TCP
{{- if not .Values.diagnosticMode.enabled }}
{{- if .Values.contour.lifecycleHooks }}
lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.contour.lifecycleHooks "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.contour.customLivenessProbe }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.contour.customLivenessProbe "context" $) | nindent 12 }}
{{- else if .Values.contour.livenessProbe.enabled }}
livenessProbe:
tcpSocket:
port: {{ .Values.contour.containerPorts.metrics }}
initialDelaySeconds: {{ .Values.contour.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.contour.livenessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.contour.livenessProbe.timeoutSeconds }}
successThreshold: {{ .Values.contour.livenessProbe.successThreshold }}
failureThreshold: {{ .Values.contour.livenessProbe.failureThreshold }}
{{- end }}
{{- if .Values.contour.customReadinessProbe }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.contour.customReadinessProbe "context" $) | nindent 12 }}
{{- else if .Values.contour.readinessProbe.enabled }}
readinessProbe:
httpGet:
path: /healthz
port: {{ .Values.contour.containerPorts.metrics }}
initialDelaySeconds: {{ .Values.contour.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.contour.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.contour.readinessProbe.timeoutSeconds }}
successThreshold: {{ .Values.contour.readinessProbe.successThreshold }}
failureThreshold: {{ .Values.contour.readinessProbe.failureThreshold }}
{{- end }}
{{- if .Values.contour.customStartupProbe }}
startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.contour.customStartupProbe "context" $) | nindent 12 }}
{{- else if .Values.contour.startupProbe.enabled }}
startupProbe:
httpGet:
path: /healthz
port: {{ .Values.contour.containerPorts.metrics }}
initialDelaySeconds: {{ .Values.contour.startupProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.contour.startupProbe.periodSeconds }}
timeoutSeconds: {{ .Values.contour.startupProbe.timeoutSeconds }}
successThreshold: {{ .Values.contour.startupProbe.successThreshold }}
failureThreshold: {{ .Values.contour.startupProbe.failureThreshold }}
{{- end }}
{{- end }}
{{- if .Values.contour.resources }}
resources: {{ toYaml .Values.contour.resources | nindent 12 }}
{{- else if ne .Values.contour.resourcesPreset "none" }}
resources: {{- include "common.resources.preset" (dict "type" .Values.contour.resourcesPreset) | nindent 12 }}
{{- end }}
volumeMounts:
- name: contourcert
mountPath: /certs
readOnly: true
- name: contour-config
mountPath: /config
readOnly: true
{{- if .Values.contour.extraVolumeMounts }}
{{- include "common.tplvalues.render" ( dict "value" .Values.contour.extraVolumeMounts "context" $ ) | nindent 12 }}
{{- end }}
env:
- name: CONTOUR_NAMESPACE
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
- name: POD_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.name
- name: BITNAMI_DEBUG
value: {{ ternary "true" "false" (or .Values.contour.image.debug .Values.diagnosticMode.enabled) | quote }}
{{- if .Values.contour.extraEnvVars }}
{{- include "common.tplvalues.render" (dict "value" .Values.contour.extraEnvVars "context" $) | nindent 12 }}
{{- end }}
{{- if or .Values.contour.extraEnvVarsCM .Values.contour.extraEnvVarsSecret }}
envFrom:
{{- if .Values.contour.extraEnvVarsCM }}
- configMapRef:
name: {{ include "common.tplvalues.render" ( dict "value" .Values.contour.extraEnvVarsCM "context" $ ) }}
{{- end }}
{{- if .Values.contour.extraEnvVarsSecret }}
- secretRef:
name: {{ include "common.tplvalues.render" ( dict "value" .Values.contour.extraEnvVarsSecret "context" $ ) }}
{{- end }}
{{- end }}
{{- if .Values.contour.containerSecurityContext.enabled }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" .Values.contour.containerSecurityContext "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.contour.sidecars }}
{{- include "common.tplvalues.render" ( dict "value" .Values.contour.sidecars "context" $) | nindent 8 }}
{{- end }}
dnsPolicy: ClusterFirst
serviceAccountName: {{ include "contour.contourServiceAccountName" . }}
{{- if .Values.contour.podSecurityContext.enabled }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" .Values.contour.podSecurityContext "context" $) | nindent 8 }}
{{- end }}
volumes:
- name: contourcert
secret:
secretName: {{ include "contour.contour.certs-secret.name" . }}
- name: contour-config
configMap:
name: {{ include "contour.configMapName" . }}
defaultMode: 0644
items:
- key: contour.yaml
path: contour.yaml
{{- if .Values.contour.extraVolumes }}
{{- include "common.tplvalues.render" ( dict "value" .Values.contour.extraVolumes "context" $ ) | nindent 8 }}
{{- end }}
{{- end }}