added repo

This commit is contained in:
Your Name
2026-08-26 03:39:42 +05:30
parent 45c25a95af
commit b8575bb8b9
6889 changed files with 1217125 additions and 0 deletions
@@ -0,0 +1,64 @@
{{/*
Copyright Broadcom, Inc. All Rights Reserved.
SPDX-License-Identifier: APACHE-2.0
*/}}
{{/*
Returns an init-container that bootstraps Envoy configuration so it's ready to be consumed by Envoy "main" container
*/}}
{{- define "contour.envoy.defaultInitContainers.initConfig" -}}
- name: envoy-initconfig
image: {{ include "common.images.image" ( dict "imageRoot" .Values.contour.image "global" .Values.global) }}
imagePullPolicy: {{ .Values.contour.image.pullPolicy }}
{{- if .Values.envoy.defaultInitContainers.initConfig.containerSecurityContext.enabled }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" .Values.envoy.defaultInitContainers.initConfig.containerSecurityContext "context" .) | nindent 4 }}
{{- end }}
{{- if .Values.envoy.defaultInitContainers.initConfig.resources }}
resources: {{- toYaml .Values.envoy.defaultInitContainers.initConfig.resources | nindent 4 }}
{{- else if ne .Values.envoy.defaultInitContainers.initConfig.resourcesPreset "none" }}
resources: {{- include "common.resources.preset" (dict "type" .Values.envoy.defaultInitContainers.initConfig.resourcesPreset) | nindent 4 }}
{{- end }}
command:
- contour
args:
- bootstrap
- /config/envoy.json
- --xds-address={{ include "common.names.fullname" . }}
- --xds-port={{ .Values.contour.service.ports.xds }}
- --resources-dir=/config/resources
- --envoy-cafile=/certs/ca.crt
- --envoy-cert-file=/certs/tls.crt
- --envoy-key-file=/certs/tls.key
{{- if .Values.contour.overloadManager.enabled }}
- --overload-max-heap={{ int .Values.contour.overloadManager.maxHeapBytes }}
{{- end }}
env:
- name: CONTOUR_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
{{- if .Values.contour.extraEnvVars }}
{{- include "common.tplvalues.render" (dict "value" .Values.contour.extraEnvVars "context" $) | nindent 4 }}
{{- end }}
{{- if or .Values.contour.extraEnvVarsCM .Values.contour.extraEnvVarsSecret }}
envFrom:
{{- if .Values.contour.extraEnvVarsCM }}
- configMapRef:
name: {{ tpl .Values.contour.extraEnvVarsCM . }}
{{- end }}
{{- if .Values.contour.extraEnvVarsSecret }}
- secretRef:
name: {{ tpl .Values.contour.extraEnvVarsSecret . }}
{{- end }}
{{- end }}
volumeMounts:
- name: empty-dir
mountPath: /config
subPath: app-conf-dir
- name: envoycert
mountPath: /certs
readOnly: true
- name: empty-dir
mountPath: /admin
subPath: app-admin-dir
{{- end -}}
@@ -0,0 +1,314 @@
{{- /*
Copyright Broadcom, Inc. All Rights Reserved.
SPDX-License-Identifier: APACHE-2.0
*/}}
{{- if and .Values.envoy.enabled (eq .Values.envoy.kind "daemonset") }}
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: {{ printf "%s-envoy" (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.envoy.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: envoy
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
{{- if .Values.envoy.updateStrategy }}
updateStrategy: {{- toYaml .Values.envoy.updateStrategy | nindent 4 }}
{{- end }}
{{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.envoy.podLabels .Values.commonLabels $versionLabel ) "context" . ) }}
selector:
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }}
app.kubernetes.io/component: envoy
template:
metadata:
{{- if or .Values.envoy.podAnnotations .Values.commonAnnotations }}
{{- $podAnnotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.envoy.podAnnotations .Values.commonAnnotations ) "context" . ) }}
annotations: {{- include "common.tplvalues.render" (dict "value" $podAnnotations "context" $) | nindent 8 }}
{{- end }}
labels: {{- include "common.labels.standard" ( dict "customLabels" $podLabels "context" $ ) | nindent 8 }}
app.kubernetes.io/component: envoy
spec:
{{- include "common.images.pullSecrets" ( dict "images" (list .Values.contour.image .Values.envoy.image) "global" .Values.global) | nindent 6 }}
automountServiceAccountToken: {{ .Values.envoy.automountServiceAccountToken }}
{{- if .Values.envoy.hostAliases }}
hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.envoy.hostAliases "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.envoy.priorityClassName }}
priorityClassName: {{ .Values.envoy.priorityClassName | quote }}
{{- end }}
{{- if .Values.envoy.affinity }}
affinity: {{- include "common.tplvalues.render" (dict "value" .Values.envoy.affinity "context" $) | nindent 8 }}
{{- else }}
affinity:
podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.envoy.podAffinityPreset "component" "envoy" "customLabels" $podLabels "context" $) | nindent 10 }}
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.envoy.podAntiAffinityPreset "component" "envoy" "customLabels" $podLabels "context" $) | nindent 10 }}
nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.envoy.nodeAffinityPreset.type "key" .Values.envoy.nodeAffinityPreset.key "values" .Values.envoy.nodeAffinityPreset.values) | nindent 10 }}
{{- end }}
{{- if .Values.envoy.nodeSelector }}
nodeSelector: {{- include "common.tplvalues.render" (dict "value" .Values.envoy.nodeSelector "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.envoy.tolerations }}
tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.envoy.tolerations "context" $) | nindent 8 }}
{{- end }}
terminationGracePeriodSeconds: {{ .Values.envoy.terminationGracePeriodSeconds }}
hostNetwork: {{ .Values.envoy.hostNetwork }}
dnsPolicy: {{ .Values.envoy.dnsPolicy }}
{{- if .Values.envoy.podSecurityContext.enabled }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" .Values.envoy.podSecurityContext "context" $) | nindent 8 }}
{{- end }}
containers:
{{- if .Values.envoy.shutdownManager.enabled }}
- command:
- contour
args:
- envoy
- shutdown-manager
- --serve-port={{ .Values.envoy.shutdownManager.containerPorts.http }}
{{- if .Values.envoy.shutdownManager.extraArgs }}
{{- include "common.tplvalues.render" (dict "value" .Values.envoy.shutdownManager.extraArgs "context" $) | nindent 12 }}
{{- end }}
image: {{ include "common.images.image" ( dict "imageRoot" .Values.contour.image "global" .Values.global) }}
imagePullPolicy: {{ .Values.contour.image.pullPolicy }}
{{- if .Values.contour.extraEnvVars }}
env:
{{- 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.envoy.shutdownManager.containerSecurityContext.enabled }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" .Values.envoy.shutdownManager.containerSecurityContext "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.envoy.lifecycleHooks }}
lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.envoy.lifecycleHooks "context" $) | nindent 12 }}
{{- else }}
lifecycle:
preStop:
exec:
command:
- contour
- envoy
- shutdown
{{- end }}
name: shutdown-manager
{{- if .Values.envoy.shutdownManager.resources }}
resources: {{- toYaml .Values.envoy.shutdownManager.resources | nindent 12 }}
{{- else if ne .Values.envoy.shutdownManager.resourcesPreset "none" }}
resources: {{- include "common.resources.preset" (dict "type" .Values.envoy.shutdownManager.resourcesPreset) | nindent 12 }}
{{- end }}
{{- if .Values.envoy.shutdownManager.customStartupProbe }}
startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.envoy.shutdownManager.customStartupProbe "context" $) | nindent 12 }}
{{- else if .Values.envoy.shutdownManager.startupProbe.enabled }}
startupProbe:
exec:
command:
- pgrep
- contour
initialDelaySeconds: {{ .Values.envoy.shutdownManager.startupProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.envoy.shutdownManager.startupProbe.periodSeconds }}
timeoutSeconds: {{ .Values.envoy.shutdownManager.startupProbe.timeoutSeconds }}
successThreshold: {{ .Values.envoy.shutdownManager.startupProbe.successThreshold }}
failureThreshold: {{ .Values.envoy.shutdownManager.startupProbe.failureThreshold }}
{{- end }}
{{- if .Values.envoy.shutdownManager.customLivenessProbe }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.envoy.shutdownManager.customLivenessProbe "context" $) | nindent 12 }}
{{- else if .Values.envoy.shutdownManager.livenessProbe.enabled }}
livenessProbe:
tcpSocket:
port: http-shutdown
initialDelaySeconds: {{ .Values.envoy.shutdownManager.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.envoy.shutdownManager.livenessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.envoy.shutdownManager.livenessProbe.timeoutSeconds }}
successThreshold: {{ .Values.envoy.shutdownManager.livenessProbe.successThreshold }}
failureThreshold: {{ .Values.envoy.shutdownManager.livenessProbe.failureThreshold }}
{{- end }}
{{- if .Values.envoy.shutdownManager.customReadinessProbe }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.envoy.shutdownManager.customReadinessProbe "context" $) | nindent 12 }}
{{- else if .Values.envoy.shutdownManager.readinessProbe.enabled }}
readinessProbe:
httpGet:
port: http-shutdown
path: /healthz
initialDelaySeconds: {{ .Values.envoy.shutdownManager.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.envoy.shutdownManager.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.envoy.shutdownManager.readinessProbe.timeoutSeconds }}
successThreshold: {{ .Values.envoy.shutdownManager.readinessProbe.successThreshold }}
failureThreshold: {{ .Values.envoy.shutdownManager.readinessProbe.failureThreshold }}
{{- end }}
ports:
- containerPort: {{ .Values.envoy.shutdownManager.containerPorts.http }}
name: http-shutdown
volumeMounts:
- name: empty-dir
mountPath: /admin
subPath: app-admin-dir
{{- if .Values.envoy.extraVolumeMounts }}
{{- include "common.tplvalues.render" ( dict "value" .Values.envoy.extraVolumeMounts "context" $ ) | nindent 12 }}
{{- end }}
{{- end }}
- name: envoy
{{- if .Values.envoy.command }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.envoy.command "context" $) | nindent 12 }}
{{- else }}
command:
- envoy
{{- end }}
{{- if .Values.envoy.args }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.envoy.args "context" $) | nindent 12 }}
{{- else }}
args:
- -c
- /config/envoy.json
- --service-cluster $(CONTOUR_NAMESPACE)
- --service-node $(ENVOY_POD_NAME)
- --log-level {{ .Values.envoy.logLevel }}
{{- if .Values.envoy.extraArgs }}
{{- include "common.tplvalues.render" (dict "value" .Values.envoy.extraArgs "context" $) | nindent 12 }}
{{- end }}
{{- end }}
image: {{ include "common.images.image" ( dict "imageRoot" .Values.envoy.image "global" .Values.global ) }}
imagePullPolicy: {{ .Values.envoy.image.pullPolicy }}
{{- if .Values.envoy.containerSecurityContext.enabled }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" .Values.envoy.containerSecurityContext "context" $) | nindent 12 }}
{{- end }}
env:
- name: CONTOUR_NAMESPACE
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
- name: ENVOY_POD_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.name
{{- if .Values.envoy.extraEnvVars }}
{{- include "common.tplvalues.render" (dict "value" .Values.envoy.extraEnvVars "context" $) | nindent 12 }}
{{- end }}
{{- if or .Values.envoy.extraEnvVarsCM .Values.envoy.extraEnvVarsSecret }}
envFrom:
{{- if .Values.envoy.extraEnvVarsCM }}
- configMapRef:
name: {{ include "common.tplvalues.render" ( dict "value" .Values.envoy.extraEnvVarsCM "context" $ ) }}
{{- end }}
{{- if .Values.envoy.extraEnvVarsSecret }}
- secretRef:
name: {{ include "common.tplvalues.render" ( dict "value" .Values.envoy.extraEnvVarsSecret "context" $ ) }}
{{- end }}
{{- end }}
ports:
- containerPort: {{ .Values.envoy.containerPorts.http }}
{{- if .Values.envoy.useHostPort.http }}
hostPort: {{ .Values.envoy.hostPorts.http }}
{{- end }}
{{- if .Values.envoy.useHostIP }}
hostIP: {{ .Values.envoy.hostIPs.http }}
{{- end }}
name: http
protocol: TCP
- containerPort: {{ .Values.envoy.containerPorts.https }}
{{- if .Values.envoy.useHostPort.https }}
hostPort: {{ .Values.envoy.hostPorts.https }}
{{- end }}
{{- if .Values.envoy.useHostIP }}
hostIP: {{ .Values.envoy.hostIPs.https }}
{{- end }}
name: https
protocol: TCP
- containerPort: {{ .Values.envoy.containerPorts.metrics }}
{{- if .Values.envoy.useHostPort.metrics }}
hostPort: {{ .Values.envoy.hostPorts.metrics }}
{{- end }}
{{- if .Values.envoy.useHostIP }}
hostIP: {{ .Values.envoy.hostIPs.metrics }}
{{- end }}
name: metrics
protocol: TCP
{{- if .Values.envoy.customReadinessProbe }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.envoy.customReadinessProbe "context" $) | nindent 12 }}
{{- else if .Values.envoy.readinessProbe.enabled }}
readinessProbe:
httpGet:
path: /ready
port: {{ .Values.envoy.containerPorts.metrics }}
initialDelaySeconds: {{ .Values.envoy.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.envoy.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.envoy.readinessProbe.timeoutSeconds }}
successThreshold: {{ .Values.envoy.readinessProbe.successThreshold }}
failureThreshold: {{ .Values.envoy.readinessProbe.failureThreshold }}
{{- end }}
{{- if .Values.envoy.livenessProbe.enabled }}
livenessProbe:
tcpSocket:
port: {{ .Values.envoy.containerPorts.metrics }}
initialDelaySeconds: {{ .Values.envoy.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.envoy.livenessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.envoy.livenessProbe.timeoutSeconds }}
successThreshold: {{ .Values.envoy.livenessProbe.successThreshold }}
failureThreshold: {{ .Values.envoy.livenessProbe.failureThreshold }}
{{- end }}
{{- if .Values.envoy.resources }}
resources: {{- toYaml .Values.envoy.resources | nindent 12 }}
{{- else if ne .Values.envoy.resourcesPreset "none" }}
resources: {{- include "common.resources.preset" (dict "type" .Values.envoy.resourcesPreset) | nindent 12 }}
{{- end }}
volumeMounts:
- name: empty-dir
mountPath: /config
subPath: app-conf-dir
- name: envoycert
mountPath: /certs
readOnly: true
- name: empty-dir
mountPath: /admin
subPath: app-admin-dir
{{- if .Values.envoy.extraVolumeMounts }}
{{- include "common.tplvalues.render" ( dict "value" .Values.envoy.extraVolumeMounts "context" $ ) | nindent 12 }}
{{- end }}
lifecycle:
preStop:
{{- if .Values.envoy.shutdownManager.enabled }}
httpGet:
path: /shutdown
port: {{ coalesce .Values.envoy.shutdownManager.port .Values.envoy.shutdownManager.containerPorts.http }}
scheme: HTTP
{{- else }}
exec:
command:
- sh
- '-c'
- sleep {{ .Values.envoy.terminationGracePeriodSeconds }}; kill 1
{{- end }}
{{- if .Values.envoy.sidecars }}
{{- include "common.tplvalues.render" ( dict "value" .Values.envoy.sidecars "context" $ ) | nindent 8 }}
{{- end }}
initContainers:
{{- include "contour.envoy.defaultInitContainers.initConfig" . | nindent 8 }}
{{- if .Values.envoy.initContainers }}
{{- include "common.tplvalues.render" ( dict "value" .Values.envoy.initContainers "context" $ ) | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "envoy.envoyServiceAccountName" . }}
volumes:
- name: empty-dir
emptyDir: {}
- name: envoycert
secret:
secretName: {{ include "contour.envoy.certs-secret.name" . }}
{{- if .Values.envoy.extraVolumes }}
{{- include "common.tplvalues.render" ( dict "value" .Values.envoy.extraVolumes "context" $ ) | nindent 8 }}
{{- end }}
restartPolicy: Always
{{- end }}
@@ -0,0 +1,347 @@
{{- /*
Copyright Broadcom, Inc. All Rights Reserved.
SPDX-License-Identifier: APACHE-2.0
*/}}
{{- if and .Values.envoy.enabled (eq .Values.envoy.kind "deployment") }}
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
kind: Deployment
metadata:
name: {{ printf "%s-envoy" (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.envoy.image "chart" .Chart ) ) }}
{{- $labels := include "common.tplvalues.merge" ( dict "values" ( list .Values.commonLabels $versionLabel ) "context" . ) }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/component: envoy
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
{{- if not .Values.envoy.autoscaling.enabled }}
replicas: {{ .Values.envoy.replicaCount }}
{{- end }}
revisionHistoryLimit: {{ .Values.envoy.revisionHistoryLimit }}
{{- if .Values.envoy.updateStrategy }}
strategy: {{- toYaml .Values.envoy.updateStrategy | nindent 4 }}
{{- end }}
minReadySeconds: {{ .Values.envoy.minReadySeconds }}
{{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.envoy.podLabels .Values.commonLabels $versionLabel ) "context" . ) }}
selector:
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }}
app.kubernetes.io/component: envoy
template:
metadata:
{{- if or .Values.envoy.podAnnotations .Values.commonAnnotations }}
{{- $podAnnotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.envoy.podAnnotations .Values.commonAnnotations ) "context" . ) }}
annotations: {{- include "common.tplvalues.render" (dict "value" $podAnnotations "context" $) | nindent 8 }}
{{- end }}
labels: {{- include "common.labels.standard" ( dict "customLabels" $podLabels "context" $ ) | nindent 8 }}
app.kubernetes.io/component: envoy
spec:
{{- include "common.images.pullSecrets" ( dict "images" (list .Values.contour.image .Values.envoy.image) "global" .Values.global) | nindent 6 }}
automountServiceAccountToken: {{ .Values.envoy.automountServiceAccountToken }}
{{- if .Values.envoy.hostAliases }}
hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.envoy.hostAliases "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.envoy.affinity }}
affinity: {{- include "common.tplvalues.render" (dict "value" .Values.envoy.affinity "context" $) | nindent 8 }}
{{- else }}
affinity:
podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.envoy.podAffinityPreset "component" "envoy" "customLabels" $podLabels "context" $) | nindent 10 }}
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.envoy.podAntiAffinityPreset "component" "envoy" "customLabels" $podLabels "context" $) | nindent 10 }}
nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.envoy.nodeAffinityPreset.type "key" .Values.envoy.nodeAffinityPreset.key "values" .Values.envoy.nodeAffinityPreset.values) | nindent 10 }}
{{- end }}
{{- if .Values.envoy.priorityClassName }}
priorityClassName: {{ .Values.envoy.priorityClassName | quote }}
{{- end }}
{{- if .Values.envoy.schedulerName }}
schedulerName: {{ .Values.envoy.schedulerName | quote }}
{{- end }}
{{- if .Values.envoy.topologySpreadConstraints }}
topologySpreadConstraints: {{- include "common.tplvalues.render" (dict "value" .Values.envoy.topologySpreadConstraints "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.envoy.nodeSelector }}
nodeSelector: {{- include "common.tplvalues.render" (dict "value" .Values.envoy.nodeSelector "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.envoy.tolerations }}
tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.envoy.tolerations "context" $) | nindent 8 }}
{{- end }}
terminationGracePeriodSeconds: {{ .Values.envoy.terminationGracePeriodSeconds }}
hostNetwork: {{ .Values.envoy.hostNetwork }}
dnsPolicy: {{ .Values.envoy.dnsPolicy }}
{{- if .Values.envoy.podSecurityContext.enabled }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" .Values.envoy.podSecurityContext "context" $) | nindent 8 }}
{{- end }}
containers:
{{- if .Values.envoy.shutdownManager.enabled }}
- command:
- contour
args:
- envoy
- shutdown-manager
- --serve-port={{ coalesce .Values.envoy.shutdownManager.port .Values.envoy.shutdownManager.containerPorts.http }}
{{- if .Values.envoy.shutdownManager.extraArgs }}
{{- include "common.tplvalues.render" (dict "value" .Values.envoy.shutdownManager.extraArgs "context" $) | nindent 12 }}
{{- end }}
image: {{ include "common.images.image" ( dict "imageRoot" .Values.contour.image "global" .Values.global) }}
imagePullPolicy: {{ .Values.contour.image.pullPolicy }}
{{- if .Values.contour.extraEnvVars }}
env:
{{- 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 }}
ports:
- containerPort: {{ coalesce .Values.envoy.shutdownManager.containerPorts.http .Values.envoy.shutdownManager.port }}
name: http-shutdown
protocol: TCP
{{- if .Values.envoy.shutdownManager.containerSecurityContext.enabled }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" .Values.envoy.shutdownManager.containerSecurityContext "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.envoy.shutdownManager.customStartupProbe }}
startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.envoy.shutdownManager.customStartupProbe "context" $) | nindent 12 }}
{{- else if .Values.envoy.shutdownManager.startupProbe.enabled }}
startupProbe:
exec:
command:
- pgrep
- contour
initialDelaySeconds: {{ .Values.envoy.shutdownManager.startupProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.envoy.shutdownManager.startupProbe.periodSeconds }}
timeoutSeconds: {{ .Values.envoy.shutdownManager.startupProbe.timeoutSeconds }}
successThreshold: {{ .Values.envoy.shutdownManager.startupProbe.successThreshold }}
failureThreshold: {{ .Values.envoy.shutdownManager.startupProbe.failureThreshold }}
{{- end }}
{{- if .Values.envoy.shutdownManager.customLivenessProbe }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.envoy.shutdownManager.customLivenessProbe "context" $) | nindent 12 }}
{{- else if .Values.envoy.shutdownManager.livenessProbe.enabled }}
livenessProbe:
tcpSocket:
port: http-shutdown
initialDelaySeconds: {{ .Values.envoy.shutdownManager.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.envoy.shutdownManager.livenessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.envoy.shutdownManager.livenessProbe.timeoutSeconds }}
successThreshold: {{ .Values.envoy.shutdownManager.livenessProbe.successThreshold }}
failureThreshold: {{ .Values.envoy.shutdownManager.livenessProbe.failureThreshold }}
{{- end }}
{{- if .Values.envoy.shutdownManager.customReadinessProbe }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.envoy.shutdownManager.customReadinessProbe "context" $) | nindent 12 }}
{{- else if .Values.envoy.shutdownManager.readinessProbe.enabled }}
readinessProbe:
httpGet:
port: http-shutdown
path: /healthz
initialDelaySeconds: {{ .Values.envoy.shutdownManager.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.envoy.shutdownManager.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.envoy.shutdownManager.readinessProbe.timeoutSeconds }}
successThreshold: {{ .Values.envoy.shutdownManager.readinessProbe.successThreshold }}
failureThreshold: {{ .Values.envoy.shutdownManager.readinessProbe.failureThreshold }}
{{- end }}
{{- if .Values.envoy.shutdownManager.lifecycleHooks }}
lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.envoy.shutdownManager.lifecycleHooks "context" $) | nindent 12 }}
{{- else }}
lifecycle:
preStop:
exec:
command:
- contour
- envoy
- shutdown
{{- end }}
name: shutdown-manager
{{- if .Values.envoy.shutdownManager.resources }}
resources: {{- toYaml .Values.envoy.shutdownManager.resources | nindent 12 }}
{{- else if ne .Values.envoy.shutdownManager.resourcesPreset "none" }}
resources: {{- include "common.resources.preset" (dict "type" .Values.envoy.shutdownManager.resourcesPreset) | nindent 12 }}
{{- end }}
volumeMounts:
- name: empty-dir
mountPath: /admin
subPath: app-admin-dir
{{- if .Values.envoy.extraVolumeMounts }}
{{- include "common.tplvalues.render" ( dict "value" .Values.envoy.extraVolumeMounts "context" $ ) | nindent 12 }}
{{- end }}
{{- end }}
- name: envoy
{{- if .Values.envoy.command }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.envoy.command "context" $) | nindent 12 }}
{{- else }}
command:
- envoy
{{- end }}
{{- if .Values.envoy.args }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.envoy.args "context" $) | nindent 12 }}
{{- else }}
args:
- -c
- /config/envoy.json
- --service-cluster $(CONTOUR_NAMESPACE)
- --service-node $(ENVOY_POD_NAME)
- --log-level {{ .Values.envoy.logLevel }}
{{- if .Values.envoy.extraArgs }}
{{- include "common.tplvalues.render" (dict "value" .Values.envoy.extraArgs "context" $) | nindent 12 }}
{{- end }}
{{- end }}
image: {{ include "common.images.image" ( dict "imageRoot" .Values.envoy.image "global" .Values.global ) }}
imagePullPolicy: {{ .Values.envoy.image.pullPolicy }}
{{- if .Values.envoy.containerSecurityContext.enabled }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" .Values.envoy.containerSecurityContext "context" $) | nindent 12 }}
{{- end }}
env:
- name: CONTOUR_NAMESPACE
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
- name: ENVOY_POD_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.name
{{- if .Values.envoy.extraEnvVars }}
{{- include "common.tplvalues.render" (dict "value" .Values.envoy.extraEnvVars "context" $) | nindent 12 }}
{{- end }}
{{- if or .Values.envoy.extraEnvVarsCM .Values.envoy.extraEnvVarsSecret }}
envFrom:
{{- if .Values.envoy.extraEnvVarsCM }}
- configMapRef:
name: {{ include "common.tplvalues.render" ( dict "value" .Values.envoy.extraEnvVarsCM "context" $ ) }}
{{- end }}
{{- if .Values.envoy.extraEnvVarsSecret }}
- secretRef:
name: {{ include "common.tplvalues.render" ( dict "value" .Values.envoy.extraEnvVarsSecret "context" $ ) }}
{{- end }}
{{- end }}
ports:
- containerPort: {{ .Values.envoy.containerPorts.http }}
# Use of .Values.envoy.useHostPort as boolean is DEPRECATED. Support will be removed in upcoming versions.
{{- if or (and (kindIs "boolean" .Values.envoy.useHostPort) .Values.envoy.useHostPort) (and (kindIs "map" .Values.envoy.useHostPort) .Values.envoy.useHostPort.http) }}
hostPort: {{ .Values.envoy.hostPorts.http }}
{{- end }}
{{- if .Values.envoy.useHostIP }}
hostIP: {{ .Values.envoy.hostIPs.http }}
{{- end }}
name: http
protocol: TCP
- containerPort: {{ .Values.envoy.containerPorts.https }}
# Use of .Values.envoy.useHostPort as boolean is DEPRECATED. Support will be removed in upcoming versions.
{{- if or (and (kindIs "boolean" .Values.envoy.useHostPort) .Values.envoy.useHostPort) (and (kindIs "map" .Values.envoy.useHostPort) .Values.envoy.useHostPort.https) }}
hostPort: {{ .Values.envoy.hostPorts.https }}
{{- end }}
{{- if .Values.envoy.useHostIP }}
hostIP: {{ .Values.envoy.hostIPs.https }}
{{- end }}
name: https
protocol: TCP
- containerPort: {{ .Values.envoy.containerPorts.metrics }}
# Use of .Values.envoy.useHostPort as boolean is DEPRECATED. Support will be removed in upcoming versions.
{{- if or (and (kindIs "boolean" .Values.envoy.useHostPort) .Values.envoy.useHostPort) (and (kindIs "map" .Values.envoy.useHostPort) .Values.envoy.useHostPort.metrics) }}
hostPort: {{ .Values.envoy.hostPorts.metrics }}
{{- end }}
{{- if .Values.envoy.useHostIP }}
hostIP: {{ .Values.envoy.hostIPs.metrics }}
{{- end }}
name: metrics
protocol: TCP
{{- if .Values.envoy.customReadinessProbe }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.envoy.customReadinessProbe "context" $) | nindent 12 }}
{{- else if .Values.envoy.readinessProbe.enabled }}
readinessProbe:
httpGet:
path: /ready
port: {{ .Values.envoy.containerPorts.metrics }}
initialDelaySeconds: {{ .Values.envoy.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.envoy.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.envoy.readinessProbe.timeoutSeconds }}
successThreshold: {{ .Values.envoy.readinessProbe.successThreshold }}
failureThreshold: {{ .Values.envoy.readinessProbe.failureThreshold }}
{{- end }}
{{- if .Values.envoy.customLivenessProbe }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.envoy.customLivenessProbe "context" $) | nindent 12 }}
{{- else if .Values.envoy.livenessProbe.enabled }}
livenessProbe:
tcpSocket:
port: {{ .Values.envoy.containerPorts.metrics }}
initialDelaySeconds: {{ .Values.envoy.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.envoy.livenessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.envoy.livenessProbe.timeoutSeconds }}
successThreshold: {{ .Values.envoy.livenessProbe.successThreshold }}
failureThreshold: {{ .Values.envoy.livenessProbe.failureThreshold }}
{{- end }}
{{- if .Values.envoy.customStartupProbe }}
startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.envoy.customStartupProbe "context" $) | nindent 12 }}
{{- else if .Values.envoy.startupProbe.enabled }}
startupProbe:
httpGet:
path: /ready
port: {{ .Values.envoy.containerPorts.metrics }}
initialDelaySeconds: {{ .Values.envoy.startupProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.envoy.startupProbe.periodSeconds }}
timeoutSeconds: {{ .Values.envoy.startupProbe.timeoutSeconds }}
successThreshold: {{ .Values.envoy.startupProbe.successThreshold }}
failureThreshold: {{ .Values.envoy.startupProbe.failureThreshold }}
{{- end }}
{{- if .Values.envoy.resources }}
resources: {{- toYaml .Values.envoy.resources | nindent 12 }}
{{- else if ne .Values.envoy.resourcesPreset "none" }}
resources: {{- include "common.resources.preset" (dict "type" .Values.envoy.resourcesPreset) | nindent 12 }}
{{- end }}
volumeMounts:
- name: empty-dir
mountPath: /config
subPath: app-conf-dir
- name: envoycert
mountPath: /certs
- name: empty-dir
mountPath: /admin
subPath: app-admin-dir
{{- if .Values.envoy.extraVolumeMounts }}
{{- include "common.tplvalues.render" ( dict "value" .Values.envoy.extraVolumeMounts "context" $ ) | nindent 12 }}
{{- end }}
{{- if .Values.envoy.lifecycleHooks }}
lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.envoy.lifecycleHooks "context" $) | nindent 12 }}
{{- else }}
lifecycle:
preStop:
{{- if .Values.envoy.shutdownManager.enabled }}
httpGet:
path: /shutdown
port: {{ coalesce .Values.envoy.shutdownManager.port .Values.envoy.shutdownManager.containerPorts.http }}
scheme: HTTP
{{- else }}
exec:
command:
- sh
- '-c'
- sleep {{ .Values.envoy.terminationGracePeriodSeconds }}; kill 1
{{- end }}
{{- end }}
{{- if .Values.envoy.sidecars }}
{{- include "common.tplvalues.render" ( dict "value" .Values.envoy.sidecars "context" $ ) | nindent 8 }}
{{- end }}
initContainers:
{{- include "contour.envoy.defaultInitContainers.initConfig" . | nindent 8 }}
{{- if .Values.envoy.initContainers }}
{{- include "common.tplvalues.render" ( dict "value" .Values.envoy.initContainers "context" $ ) | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "envoy.envoyServiceAccountName" . }}
volumes:
- name: empty-dir
emptyDir: {}
- name: envoycert
secret:
secretName: {{ include "contour.envoy.certs-secret.name" . }}
{{- if .Values.envoy.extraVolumes }}
{{- include "common.tplvalues.render" ( dict "value" .Values.envoy.extraVolumes "context" $ ) | nindent 8 }}
{{- end }}
restartPolicy: Always
{{- end }}
@@ -0,0 +1,9 @@
{{- /*
Copyright Broadcom, Inc. All Rights Reserved.
SPDX-License-Identifier: APACHE-2.0
*/}}
{{- range .Values.extraDeploy }}
---
{{ include "common.tplvalues.render" (dict "value" . "context" $) }}
{{- end }}
@@ -0,0 +1,39 @@
{{- /*
Meesho Custom: Headless service for Envoy DNS-based discovery
*/}}
{{- if .Values.envoy.enabled }}
{{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.envoy.podLabels .Values.commonLabels ) "context" . ) }}
apiVersion: v1
kind: Service
metadata:
name: {{ printf "%s-envoy" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }}-headless
namespace: {{ include "common.names.namespace" . | quote }}
{{- $versionLabel := dict "app.kubernetes.io/version" ( include "common.images.version" ( dict "imageRoot" .Values.envoy.image "chart" .Chart ) ) }}
{{- $labels := include "common.tplvalues.merge" ( dict "values" ( list .Values.envoy.service.labels .Values.commonLabels $versionLabel ) "context" . ) }}
labels: {{- include "common.labels.standard" ( dict "customLabels" $labels "context" $ ) | nindent 4 }}
app.kubernetes.io/component: envoy
spec:
clusterIP: None
{{- if .Values.envoy.service.sessionAffinity }}
sessionAffinity: {{ .Values.envoy.service.sessionAffinity }}
{{- end }}
{{- if .Values.envoy.service.sessionAffinityConfig }}
sessionAffinityConfig: {{- include "common.tplvalues.render" (dict "value" .Values.envoy.service.sessionAffinityConfig "context" $) | nindent 4 }}
{{- end }}
{{- if .Values.envoy.service.ipFamilyPolicy }}
ipFamilyPolicy: {{ .Values.envoy.service.ipFamilyPolicy }}
{{- end }}
ports:
- name: http
port: {{ .Values.envoy.service.ports.http }}
protocol: TCP
targetPort: {{ .Values.envoy.service.targetPorts.http }}
nodePort: null
{{- if .Values.envoy.service.extraPorts }}
{{- include "common.tplvalues.render" (dict "value" .Values.envoy.service.extraPorts "context" $) | nindent 4 }}
{{- end }}
selector: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/component: envoy
type: ClusterIP
{{- end }}
@@ -0,0 +1,47 @@
{{- /*
Copyright Broadcom, Inc. All Rights Reserved.
SPDX-License-Identifier: APACHE-2.0
*/}}
{{- if and .Values.envoy.enabled .Values.envoy.autoscaling.enabled (eq .Values.envoy.kind "deployment") (not .Values.envoy.autoscaling.keda.enabled) }}
apiVersion: {{ include "common.capabilities.hpa.apiVersion" ( dict "context" $ ) }}
kind: HorizontalPodAutoscaler
metadata:
name: {{ printf "%s-envoy" (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.envoy.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: envoy
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
{{- if .Values.envoy.autoscaling.behavior }}
behavior:
{{- toYaml .Values.envoy.autoscaling.behavior | nindent 4 }}
{{- end }}
scaleTargetRef:
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
kind: Deployment
name: {{ printf "%s-envoy" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }}
minReplicas: {{ .Values.envoy.autoscaling.minReplicas }}
maxReplicas: {{ .Values.envoy.autoscaling.maxReplicas }}
metrics:
{{- if .Values.envoy.autoscaling.targetCPU }}
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.envoy.autoscaling.targetCPU }}
{{- end }}
{{- if .Values.envoy.autoscaling.targetMemory }}
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: {{ .Values.envoy.autoscaling.targetMemory }}
{{- end }}
{{- end }}
@@ -0,0 +1,88 @@
{{- /*
Copyright Broadcom, Inc. All Rights Reserved.
SPDX-License-Identifier: APACHE-2.0
*/}}
{{- if and .Values.envoy.enabled .Values.envoy.networkPolicy.enabled }}
kind: NetworkPolicy
apiVersion: {{ include "common.capabilities.networkPolicy.apiVersion" . }}
metadata:
name: {{ printf "%s-envoy" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/component: envoy
{{- 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.podLabels .Values.commonLabels ) "context" . ) }}
podSelector:
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }}
app.kubernetes.io/component: envoy
policyTypes:
- Ingress
- Egress
{{- if .Values.envoy.networkPolicy.allowExternalEgress }}
egress:
- {}
{{- else }}
egress:
- ports:
- port: 53
protocol: UDP
- port: 53
protocol: TCP
# Allow outbound connections to envoy
- ports:
- port: {{ .Values.envoy.containerPorts.http }}
- port: {{ .Values.envoy.containerPorts.https }}
- port: {{ .Values.envoy.containerPorts.metrics }}
to:
- podSelector:
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 14 }}
app.kubernetes.io/component: envoy
{{- if .Values.contour.enabled }}
# Allow outbound connections to other contour pods
- ports:
- port: {{ .Values.contour.containerPorts.xds }}
- port: {{ .Values.contour.containerPorts.metrics }}
to:
- podSelector:
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 14 }}
app.kubernetes.io/component: contour
{{- end }}
{{- if .Values.envoy.networkPolicy.extraEgress }}
{{- include "common.tplvalues.render" ( dict "value" .Values.envoy.networkPolicy.extraEgress "context" $ ) | nindent 4 }}
{{- end }}
{{- end }}
ingress:
- ports:
- port: {{ .Values.envoy.containerPorts.http }}
- port: {{ .Values.envoy.containerPorts.https }}
- port: {{ .Values.envoy.containerPorts.metrics }}
{{- if not .Values.envoy.networkPolicy.allowExternal }}
from:
- podSelector:
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 14 }}
- podSelector:
matchLabels:
{{ template "common.names.fullname" . }}-client: "true"
{{- if .Values.envoy.networkPolicy.ingressNSMatchLabels }}
- namespaceSelector:
matchLabels:
{{- range $key, $value := .Values.envoy.networkPolicy.ingressNSMatchLabels }}
{{ $key | quote }}: {{ $value | quote }}
{{- end }}
{{- if .Values.envoy.networkPolicy.ingressNSPodMatchLabels }}
podSelector:
matchLabels:
{{- range $key, $value := .Values.envoy.networkPolicy.ingressNSPodMatchLabels }}
{{ $key | quote }}: {{ $value | quote }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.envoy.networkPolicy.extraIngress }}
{{- include "common.tplvalues.render" ( dict "value" .Values.envoy.networkPolicy.extraIngress "context" $ ) | nindent 4 }}
{{- end }}
{{- end }}
@@ -0,0 +1,31 @@
{{- /*
Copyright Broadcom, Inc. All Rights Reserved.
SPDX-License-Identifier: APACHE-2.0
*/}}
{{- $replicaCount := int .Values.envoy.replicaCount }}
{{- if and .Values.envoy.enabled (eq .Values.envoy.kind "deployment") .Values.envoy.pdb.create (or (gt $replicaCount 1) .Values.envoy.autoscaling.enabled) }}
apiVersion: {{ include "common.capabilities.policy.apiVersion" . }}
kind: PodDisruptionBudget
metadata:
name: {{ printf "%s-envoy" (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.envoy.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: envoy
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
{{- if .Values.envoy.pdb.minAvailable }}
minAvailable: {{ .Values.envoy.pdb.minAvailable }}
{{- end }}
{{- if or .Values.envoy.pdb.maxUnavailable ( not .Values.envoy.pdb.minAvailable ) }}
maxUnavailable: {{ .Values.envoy.pdb.maxUnavailable | default 0 }}
{{- end }}
{{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.envoy.podLabels .Values.commonLabels ) "context" . ) }}
selector:
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }}
app.kubernetes.io/component: envoy
{{- end }}
@@ -0,0 +1,26 @@
{{- /*
Copyright Broadcom, Inc. All Rights Reserved.
SPDX-License-Identifier: APACHE-2.0
*/}}
{{- if and .Values.metrics.prometheusRule.enabled .Values.envoy.enabled .Values.metrics.enabled}}
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
name: {{ include "common.names.fullname" . }}
namespace: {{ default .Release.Namespace .Values.metrics.prometheusRule.namespace | quote }}
{{- $versionLabel := dict "app.kubernetes.io/version" ( include "common.images.version" ( dict "imageRoot" .Values.envoy.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: metrics
{{- if .Values.metrics.prometheusRule.additionalLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.metrics.prometheusRule.additionalLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
groups:
- name: {{ include "common.names.fullname" . }}
rules: {{- include "common.tplvalues.render" ( dict "value" .Values.metrics.prometheusRule.rules "context" $ ) | nindent 6 }}
{{- end }}
@@ -0,0 +1,60 @@
{{- /*
Meesho Custom: KEDA ScaledObject for Envoy autoscaling
*/}}
{{- if .Values.envoy.autoscaling.keda.enabled }}
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
name: {{ printf "%s-envoy" (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.envoy.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: envoy
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ printf "%s-envoy" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }}
pollingInterval: {{ .Values.envoy.autoscaling.keda.pollingInterval }}
minReplicaCount: {{ .Values.envoy.autoscaling.minReplicas }}
maxReplicaCount: {{ .Values.envoy.autoscaling.maxReplicas }}
advanced:
horizontalPodAutoscalerConfig:
behavior:
scaleDown:
stabilizationWindowSeconds: {{ .Values.envoy.autoscaling.keda.stabilizationWindowSeconds | default "300" }}
policies:
{{- range .Values.envoy.autoscaling.keda.scaledown.policies }}
- type: {{ .type }}
value: {{ .value }}
periodSeconds: {{ .periodseconds }}
{{- end }}
selectPolicy: {{ .Values.envoy.autoscaling.keda.scaledown.selectpolicy }}
scaleUp:
stabilizationWindowSeconds: {{ .Values.envoy.autoscaling.keda.scaleup.stabilizationWindowSeconds }}
policies:
{{- range .Values.envoy.autoscaling.keda.scaleup.policies }}
- type: {{ .type }}
value: {{ .value }}
periodSeconds: {{ .periodseconds }}
{{- end }}
selectPolicy: {{ .Values.envoy.autoscaling.keda.scaleup.selectpolicy }}
triggers:
- metadata:
value: {{ .Values.envoy.autoscaling.targetCPU | quote }}
metricType: Utilization
type: cpu
- metadata:
value: {{ .Values.envoy.autoscaling.targetMemory | quote }}
metricType: Utilization
type: memory
{{- if .Values.envoy.autoscaling.keda.triggers }}
{{- toYaml .Values.envoy.autoscaling.keda.triggers | nindent 2 }}
{{- end }}
{{- end }}
@@ -0,0 +1,17 @@
{{- /*
Meesho Custom: GKE ServiceExport for multi-cluster networking
*/}}
{{- if .Values.envoy.service.export.enabled }}
kind: ServiceExport
apiVersion: net.gke.io/v1
metadata:
namespace: {{ include "common.names.namespace" . | quote }}
name: {{ default (printf "%s-envoy" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-") .Values.envoy.service.name }}
---
kind: ServiceExport
apiVersion: net.gke.io/v1
metadata:
namespace: {{ include "common.names.namespace" . | quote }}
name: {{ default (printf "%s-envoy" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-") .Values.envoy.service.name }}-headless
{{- end }}
@@ -0,0 +1,47 @@
{{- /*
Meesho Custom: GCP Internal Load Balancer for Envoy service
*/}}
{{- if .Values.envoy.enabled }}
{{- if .Values.envoy.service.tcpLB }}
{{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.envoy.podLabels .Values.commonLabels ) "context" . ) }}
apiVersion: v1
kind: Service
metadata:
name: {{ printf "%s-envoy" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }}-tcp-lb
namespace: {{ include "common.names.namespace" . | quote }}
annotations:
networking.gke.io/load-balancer-type: "Internal"
{{- $versionLabel := dict "app.kubernetes.io/version" ( include "common.images.version" ( dict "imageRoot" .Values.envoy.image "chart" .Chart ) ) }}
{{- $labels := include "common.tplvalues.merge" ( dict "values" ( list .Values.envoy.service.labels .Values.commonLabels $versionLabel ) "context" . ) }}
labels: {{- include "common.labels.standard" ( dict "customLabels" $labels "context" $ ) | nindent 4 }}
app.kubernetes.io/component: envoy
spec:
{{- if .Values.envoy.service.sessionAffinity }}
sessionAffinity: {{ .Values.envoy.service.sessionAffinity }}
{{- end }}
{{- if .Values.envoy.service.sessionAffinityConfig }}
sessionAffinityConfig: {{- include "common.tplvalues.render" (dict "value" .Values.envoy.service.sessionAffinityConfig "context" $) | nindent 4 }}
{{- end }}
{{- if .Values.envoy.service.ipFamilyPolicy }}
ipFamilyPolicy: {{ .Values.envoy.service.ipFamilyPolicy }}
{{- end }}
ports:
- name: http
port: {{ .Values.envoy.service.ports.http }}
protocol: TCP
targetPort: {{ .Values.envoy.service.targetPorts.http }}
{{- if .Values.envoy.service.ports.grpc }}
- name: grpc
port: {{ .Values.envoy.service.ports.grpc }}
protocol: TCP
targetPort: {{ .Values.envoy.service.targetPorts.http }}
{{- end }}
{{- if .Values.envoy.service.extraPorts }}
{{- include "common.tplvalues.render" (dict "value" .Values.envoy.service.extraPorts "context" $) | nindent 4 }}
{{- end }}
selector: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/component: envoy
type: LoadBalancer
{{- end }}
{{- end }}
@@ -0,0 +1,36 @@
{{- /*
Copyright Broadcom, Inc. All Rights Reserved.
SPDX-License-Identifier: APACHE-2.0
*/}}
{{- $versionLabel := dict "app.kubernetes.io/version" ( include "common.images.version" ( dict "imageRoot" .Values.envoy.image "chart" .Chart ) ) }}
{{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.envoy.podLabels .Values.commonLabels ) "context" . ) }}
{{- if and .Values.envoy.service.multiAz.enabled .Values.envoy.service.multiAz.zones .Values.envoy.enabled }}
{{ include "envoy.envoyServiceMultiAZ" . }}
{{- else if .Values.envoy.enabled }}
{{ include "envoy.envoyService" . }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.enabled }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ printf "%s-envoy-metrics" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }}
namespace: {{ include "common.names.namespace" . | quote }}
{{- $labels := include "common.tplvalues.merge" ( dict "values" ( list .Values.commonLabels $versionLabel ) "context" . ) }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/component: envoy
spec:
type: ClusterIP
clusterIP: None
{{- if not .Values.envoy.shutdownManager.enabled }}
publishNotReadyAddresses: true
{{- end }}
selector: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/component: envoy
ports:
- name: metrics
port: {{ .Values.envoy.service.ports.metrics }}
protocol: TCP
targetPort: {{ .Values.envoy.service.targetPorts.metrics }}
{{- end }}
@@ -0,0 +1,21 @@
{{- /*
Copyright Broadcom, Inc. All Rights Reserved.
SPDX-License-Identifier: APACHE-2.0
*/}}
{{- if and .Values.envoy.serviceAccount.create .Values.envoy.enabled }}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "envoy.envoyServiceAccountName" . }}
namespace: {{ include "common.names.namespace" . | quote }}
{{- $versionLabel := dict "app.kubernetes.io/version" ( include "common.images.version" ( dict "imageRoot" .Values.envoy.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: envoy
{{- if or .Values.envoy.serviceAccount.annotations .Values.commonAnnotations }}
{{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.envoy.serviceAccount.annotations .Values.commonAnnotations ) "context" . ) }}
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }}
{{- end }}
automountServiceAccountToken: {{ .Values.envoy.serviceAccount.automountServiceAccountToken }}
{{- end }}
@@ -0,0 +1,48 @@
{{- /*
Copyright Broadcom, Inc. All Rights Reserved.
SPDX-License-Identifier: APACHE-2.0
*/}}
{{- if and .Values.metrics.serviceMonitor.enabled .Values.envoy.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ printf "%s-envoy" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }}
namespace: {{ default (include "common.names.namespace" .) .Values.metrics.serviceMonitor.namespace | quote }}
{{- $versionLabel := dict "app.kubernetes.io/version" ( include "common.images.version" ( dict "imageRoot" .Values.envoy.image "chart" .Chart ) ) }}
{{- $labels := include "common.tplvalues.merge" ( dict "values" ( list .Values.metrics.serviceMonitor.labels .Values.commonLabels $versionLabel ) "context" . ) }}
labels: {{- include "common.labels.standard" ( dict "customLabels" $labels "context" $ ) | nindent 4 }}
app.kubernetes.io/component: envoy
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
jobLabel: {{ .Values.metrics.serviceMonitor.jobLabel | quote }}
selector:
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 6 }}
app.kubernetes.io/component: envoy
{{- if .Values.metrics.serviceMonitor.selector }}
{{- include "common.tplvalues.render" (dict "value" .Values.metrics.serviceMonitor.selector "context" $) | nindent 6 }}
{{- end }}
namespaceSelector:
matchNames:
- {{ include "common.names.namespace" . | quote }}
endpoints:
- port: metrics
path: /stats/prometheus
{{- if .Values.metrics.serviceMonitor.interval }}
interval: {{ .Values.metrics.serviceMonitor.interval }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ .Values.metrics.serviceMonitor.scrapeTimeout }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.honorLabels }}
honorLabels: {{ .Values.metrics.serviceMonitor.honorLabels }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.metricRelabelings }}
metricRelabelings: {{ toYaml .Values.metrics.serviceMonitor.metricRelabelings | nindent 6 }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.relabelings }}
relabelings: {{ toYaml .Values.metrics.serviceMonitor.relabelings | nindent 6 }}
{{- end }}
{{- end }}