Skip to content

Commit 092cc67

Browse files
mgs255cnvergence
authored andcommitted
feat(chart): Allow configuring envoy proxy image via helm chart (#8785)
* feat: Allow configuring envoy proxy defaults via helm chart This commit is a continuation of the previous work to support supplying default proxy settings added in #7698 and adds three new chart values under `global.images.envoyProxy`: | Value | Type | Default | Description | |----------------------------------------|--------|------|---------------------------------------------------------------------| | `global.images.envoyProxy.image` | string | `""` | Full image name (`registry/repo:tag`) for the Envoy Proxy container | | `global.images.envoyProxy.pullPolicy` | string | `""` | Image pull policy | | `global.images.envoyProxy.pullSecrets` | list | `[]` | Image pull secrets | When any of these are set, the chart generates an `envoyProxy:` block inside the `EnvoyGateway` ConfigMap, wiring into the existing `EnvoyGatewaySpec.envoyProxy` field (added in #7698). The global `imageRegistry` override takes highest precedence, consistent with other chart components. Full EnvoyProxy defaults (replicas, resources, etc.) can be provided via `config.envoyGateway.envoyProxy`; the image values are merged on top. Closes #4764. Signed-off-by: Michael Sommerville <msommerville@gmail.com> (cherry picked from commit 8570285)
1 parent d28ab7e commit 092cc67

7 files changed

Lines changed: 85 additions & 1 deletion

File tree

charts/gateway-helm/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ helm uninstall eg -n envoy-gateway-system
103103
| global.images.envoyGateway.image | string | `nil` | |
104104
| global.images.envoyGateway.pullPolicy | string | `nil` | |
105105
| global.images.envoyGateway.pullSecrets | list | `[]` | |
106+
| global.images.envoyProxy.image | string | `""` | |
107+
| global.images.envoyProxy.pullPolicy | string | `""` | |
108+
| global.images.envoyProxy.pullSecrets | list | `[]` | |
106109
| global.images.ratelimit.image | string | `"docker.io/envoyproxy/ratelimit:05c08d03"` | |
107110
| global.images.ratelimit.pullPolicy | string | `"IfNotPresent"` | |
108111
| global.images.ratelimit.pullSecrets | list | `[]` | |

charts/gateway-helm/templates/_helpers.tpl

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,61 @@ imagePullSecrets: {{ toYaml list }}
148148
{{- end }}
149149
{{- end }}
150150

151+
{{/*
152+
Resolve the Envoy Proxy image.
153+
*/}}
154+
{{- define "eg.envoyProxy.image" -}}
155+
{{- $imageParts := splitn "/" 2 .Values.global.images.envoyProxy.image -}}
156+
{{/* if global.imageRegistry is defined, it takes precedence always */}}
157+
{{- $registryName := default $imageParts._0 .Values.global.imageRegistry -}}
158+
{{- $repositoryTag := $imageParts._1 -}}
159+
{{- $repositoryParts := splitn ":" 2 $repositoryTag -}}
160+
{{- $repositoryName := $repositoryParts._0 -}}
161+
{{- $imageTag := default "distroless-dev" $repositoryParts._1 -}}
162+
{{- printf "%s/%s:%s" $registryName $repositoryName $imageTag -}}
163+
{{- end -}}
164+
165+
{{/*
166+
Resolve the Envoy Proxy image pull secrets.
167+
*/}}
168+
{{- define "eg.envoyProxy.image.pullSecrets" -}}
169+
{{- if .Values.global.imagePullSecrets }}
170+
imagePullSecrets:
171+
{{ toYaml .Values.global.imagePullSecrets }}
172+
{{- else if .Values.global.images.envoyProxy.pullSecrets -}}
173+
imagePullSecrets:
174+
{{ toYaml .Values.global.images.envoyProxy.pullSecrets }}
175+
{{- else }}
176+
imagePullSecrets: {{ toYaml list }}
177+
{{- end }}
178+
{{- end }}
151179

152180
{{/*
153181
The default Envoy Gateway configuration.
154182
*/}}
155183
{{- define "eg.default-envoy-gateway-config" -}}
184+
{{- if or .Values.global.images.envoyProxy.image .Values.config.envoyGateway.envoyProxy }}
185+
{{- $envoyProxyBase := .Values.config.envoyGateway.envoyProxy | default dict }}
186+
{{- $imageOverride := dict }}
187+
{{- if .Values.global.images.envoyProxy.image }}
188+
{{- $container := dict "image" (include "eg.envoyProxy.image" .) }}
189+
{{- if .Values.global.images.envoyProxy.pullPolicy }}
190+
{{- $_ := set $container "imagePullPolicy" .Values.global.images.envoyProxy.pullPolicy }}
191+
{{- end }}
192+
{{- $deployment := dict "container" $container }}
193+
{{- if or .Values.global.imagePullSecrets .Values.global.images.envoyProxy.pullSecrets }}
194+
{{- $pullSecretsYaml := include "eg.envoyProxy.image.pullSecrets" . }}
195+
{{- $pullSecrets := dict "imagePullSecrets" ($pullSecretsYaml | fromYaml).imagePullSecrets }}
196+
{{- $_ := set $deployment "pod" $pullSecrets }}
197+
{{- end }}
198+
{{- $kubernetes := dict "envoyDeployment" $deployment }}
199+
{{- $provider := dict "type" "Kubernetes" "kubernetes" $kubernetes }}
200+
{{- $imageOverride = dict "provider" $provider }}
201+
{{- end }}
202+
{{- $merged := mustMergeOverwrite (dict) $envoyProxyBase $imageOverride }}
203+
envoyProxy:
204+
{{ toYaml $merged | indent 2 }}
205+
{{- end }}
156206
provider:
157207
type: Kubernetes
158208
kubernetes:

charts/gateway-helm/values.tmpl.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Global settings
22
global:
3-
# If set, these take highest precedence and change both envoyGateway and ratelimit's container registry and pull secrets.
3+
# If set, these take highest precedence and change envoyGateway, envoyProxy, and ratelimit's container registry and pull secrets.
44
# -- Global override for image registry
55
imageRegistry: ""
66
# -- Global override for image pull secrets
@@ -25,6 +25,15 @@ global:
2525
pullPolicy: IfNotPresent
2626
# List of secrets in the same namespace of the component that can be used to pull images from private repositories.
2727
pullSecrets: []
28+
envoyProxy:
29+
# This is the full image name including the hub, repo, and tag for the Envoy Proxy data plane.
30+
# If not specified, uses the default image built into envoy-gateway.
31+
image: ""
32+
# Specify image pull policy if default behavior isn't desired.
33+
# Default behavior: IfNotPresent.
34+
pullPolicy: ""
35+
# List of secrets in the same namespace of the component that can be used to pull images from private repositories.
36+
pullSecrets: []
2837

2938
podDisruptionBudget:
3039
minAvailable: 0

release-notes/current.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ security updates: |
1010
Bump Envoy ratelimit image to `05c08d03`.
1111
# New features or capabilities added in this release.
1212
new features: |
13+
Added support for defining Envoy Proxy image, pullPolicy, and pullSecrets via the helm chart. Note that to merge these helm-configured values with EnvoyProxy resources, the EnvoyProxy must include `mergeType: StrategicMerge` or `mergeType: JSONMerge`.
1314
1415
bug fixes: |
1516
Rejected ClientTrafficPolicy if invalid TLS cipher suites are configured.

site/content/en/latest/install/gateway-helm-api.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ The Helm chart for Envoy Gateway
6767
| global.images.envoyGateway.image | string | `nil` | |
6868
| global.images.envoyGateway.pullPolicy | string | `nil` | |
6969
| global.images.envoyGateway.pullSecrets | list | `[]` | |
70+
| global.images.envoyProxy.image | string | `""` | |
71+
| global.images.envoyProxy.pullPolicy | string | `""` | |
72+
| global.images.envoyProxy.pullSecrets | list | `[]` | |
7073
| global.images.ratelimit.image | string | `"docker.io/envoyproxy/ratelimit:05c08d03"` | |
7174
| global.images.ratelimit.pullPolicy | string | `"IfNotPresent"` | |
7275
| global.images.ratelimit.pullSecrets | list | `[]` | |

test/helm/gateway-helm/global-images-config.in.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,9 @@ global:
1212
pullSecrets:
1313
- name: "secret3"
1414
- name: "secret4"
15+
envoyProxy:
16+
image: "private-hub/envoyproxy/envoy:dev"
17+
pullPolicy: Always
18+
pullSecrets:
19+
- name: "secret5"
20+
- name: "secret6"

test/helm/gateway-helm/global-images-config.out.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,18 @@ data:
2828
envoy-gateway.yaml: |
2929
apiVersion: gateway.envoyproxy.io/v1alpha1
3030
kind: EnvoyGateway
31+
envoyProxy:
32+
provider:
33+
kubernetes:
34+
envoyDeployment:
35+
container:
36+
image: private-hub/envoyproxy/envoy:dev
37+
imagePullPolicy: Always
38+
pod:
39+
imagePullSecrets:
40+
- name: secret5
41+
- name: secret6
42+
type: Kubernetes
3143
extensionApis: {}
3244
gateway:
3345
controllerName: gateway.envoyproxy.io/gatewayclass-controller

0 commit comments

Comments
 (0)