Skip to content

Commit e89f35b

Browse files
committed
feat(helm): add global image overrides
Signed-off-by: Bobbins228 <mcampbel@redhat.com>
1 parent 7dcc44d commit e89f35b

7 files changed

Lines changed: 59 additions & 28 deletions

File tree

‎deploy/helm/openshell/README.md‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,12 @@ discovery endpoint or its TLS CA.
187187
| certManager.serverIssuerRef | object | `{"group":"","kind":"","name":""}` | Override the issuerRef for the external server Certificate (e.g. a real LetsEncrypt/ACME ClusterIssuer for a publicly-trusted cert on an external hostname). When set, the chart creates a second server certificate from this issuer with only the hostnames in serverDnsNames; the internal server certificate is always signed by the chart's own CA. Leave name empty to use the chart CA for all server certificates (default). Requires certManager.enabled=true. |
188188
| fullnameOverride | string | `""` | Override the full generated resource name. |
189189
| gateway.image.digest | string | `""` | Gateway image digest. When set, this takes precedence over tag. |
190-
| gateway.image.pullPolicy | string | `"IfNotPresent"` | Gateway image pull policy. |
191-
| gateway.image.repository | string | `"ghcr.io/nvidia/openshell/gateway"` | Gateway image repository. |
190+
| gateway.image.pullPolicy | string | `nil` | Gateway image pull policy. |
191+
| gateway.image.repository | string | `""` | Gateway image repository. |
192192
| gateway.image.tag | string | `""` | Gateway image tag. Defaults to the chart appVersion when empty. |
193+
| global.image.pullPolicy | string | `"IfNotPresent"` | Shared OpenShell image pull policy. Individual image pull policies take precedence. |
194+
| global.image.repository | string | `"ghcr.io/nvidia/openshell"` | Shared OpenShell image repository. Individual image repositories take precedence. |
195+
| global.image.tag | string | `""` | Shared OpenShell image tag. Defaults to the chart appVersion when empty. |
193196
| grpcRoute.backendTLSPolicy.caCertificateConfigMapName | string | `""` | Name of the ConfigMap containing the CA certificate (key: ca.crt) used to validate the gateway pod's TLS certificate. Defaults to `<fullname>-backend-ca` when empty. The certgen hook auto-creates this: with pkiInitJob (default), immediately on install/upgrade; with cert-manager, the hook polls for pkiInitJob.timeoutSeconds seconds waiting for cert-manager to issue the server certificate, then creates the ConfigMap. A single install usually succeeds; if cert-manager takes longer, increase pkiInitJob.timeoutSeconds. By default (pkiInitJob.failOnTimeout=true), the install fails if the timeout is reached; set failOnTimeout=false to allow the install to succeed and run `helm upgrade` after the certificate is issued. |
194197
| grpcRoute.backendTLSPolicy.enabled | bool | `false` | Create a BackendTLSPolicy resource for end-to-end TLS between the Gateway proxy and the OpenShell gateway pod. The traffic flow is: client → HTTPS → Gateway (terminate) → TLS (re-encrypt) → gateway pod. Requires server.disableTls=false and server.tls.enableMtls=false. The certgen hook auto-creates the backend CA ConfigMap. |
195198
| grpcRoute.backendTLSPolicy.hostname | string | `""` | Hostname the Gateway proxy validates against the backend's TLS certificate SAN. Defaults to the service FQDN (`<fullname>.<namespace>.svc.cluster.local`) when empty, which matches the SAN included by both cert-manager and the pkiInitJob. |
@@ -236,8 +239,8 @@ discovery endpoint or its TLS CA.
236239
| sandbox.image.pullPolicy | string | `nil` | Sandbox image pull policy. Leave unset to use the Kubernetes image default. |
237240
| sandbox.image.repository | string | `"ghcr.io/nvidia/openshell-community/sandboxes/base"` | Default standalone sandbox image repository. |
238241
| sandbox.image.tag | string | `"latest"` | Sandbox image tag. Defaults to latest when empty. |
239-
| sandboxRuntime.image.pullPolicy | string | `""` | Sandbox runtime image pull policy. Defaults to the gateway image pull policy when empty. |
240-
| sandboxRuntime.image.repository | string | `"ghcr.io/nvidia/openshell/sandbox"` | Sandbox runtime image repository. Changing it uses the effective gateway image tag unless tag is also set. |
242+
| sandboxRuntime.image.pullPolicy | string | `nil` | Sandbox runtime image pull policy. Defaults to the gateway image pull policy when empty. |
243+
| sandboxRuntime.image.repository | string | `""` | Sandbox runtime image repository. Changing it uses the effective gateway image tag unless tag is also set. |
241244
| sandboxRuntime.image.tag | string | `""` | Sandbox runtime image tag override. Empty uses the version pinned into the gateway unless repository is changed. |
242245
| sandboxServiceAccount.annotations | object | `{}` | Annotations to add to the generated sandbox service account. |
243246
| sandboxServiceAccount.create | bool | `true` | Create a service account for sandbox pods. |
@@ -318,7 +321,7 @@ discovery endpoint or its TLS CA.
318321
| serviceAccount.name | string | `""` | Existing service account name to use when serviceAccount.create is false. |
319322
| supervisor.image.digest | string | `""` | Supervisor image digest. When set, this takes precedence over tag. |
320323
| supervisor.image.pullPolicy | string | `nil` | Sandbox supervisor pull policy. Leave unset to use the Kubernetes image default. Prefer always, if_not_present, or never; the chart also accepts legacy Kubernetes spellings Always, IfNotPresent, and Never. |
321-
| supervisor.image.repository | string | `"ghcr.io/nvidia/openshell/supervisor"` | Supervisor image repository. Changing it uses the effective gateway image tag unless tag is also set. |
324+
| supervisor.image.repository | string | `""` | Supervisor image repository. Changing it uses the effective gateway image tag unless tag is also set. |
322325
| supervisor.image.tag | string | `""` | Supervisor image tag override. Empty uses the version pinned into the gateway unless repository is changed. |
323326
| supervisor.sandboxRuntime.boundaryPort | int | `5500` | Workload boundary TLS listener port. |
324327
| supervisor.sandboxRuntime.networkPolicyEnforced | bool | `false` | Required operator acknowledgement that the cluster CNI enforces NetworkPolicy. |

‎deploy/helm/openshell/templates/_gateway-workload.tpl‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ spec:
4343
securityContext:
4444
{{- toYaml .Values.securityContext | nindent 8 }}
4545
image: {{ include "openshell.image" . | quote }}
46-
imagePullPolicy: {{ .Values.gateway.image.pullPolicy }}
46+
imagePullPolicy: {{ .Values.gateway.image.pullPolicy | default .Values.global.image.pullPolicy }}
4747
args:
4848
- --config
4949
- /etc/openshell/gateway.toml

‎deploy/helm/openshell/templates/_helpers.tpl‎

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,12 @@ default to enabled so upgrades with --reuse-values preserve the old topology.
8686
{{/* Gateway image reference. A digest takes precedence over a tag. */}}
8787
{{- define "openshell.image" -}}
8888
{{- $image := .Values.gateway.image -}}
89+
{{- $global := .Values.global.image -}}
90+
{{- $repository := $image.repository | default (printf "%s/gateway" $global.repository) -}}
8991
{{- if $image.digest -}}
90-
{{- printf "%s@%s" $image.repository $image.digest -}}
92+
{{- printf "%s@%s" $repository $image.digest -}}
9193
{{- else -}}
92-
{{- printf "%s:%s" $image.repository ($image.tag | default .Chart.AppVersion) -}}
94+
{{- printf "%s:%s" $repository ($image.tag | default $global.tag | default .Chart.AppVersion) -}}
9395
{{- end }}
9496
{{- end }}
9597

@@ -111,14 +113,16 @@ ghcr.io/nvidia/openshell/sandbox
111113
{{/* Whether Helm must propagate a sandbox runtime image override. */}}
112114
{{- define "openshell.sandboxRuntimeImageOverrideEnabled" -}}
113115
{{- $defaultRepository := include "openshell.defaultSandboxRuntimeRepository" . -}}
114-
{{- $repository := .Values.sandboxRuntime.image.repository | default $defaultRepository -}}
115-
{{- if or (ne $repository $defaultRepository) .Values.sandboxRuntime.image.tag -}}true{{- end -}}
116+
{{- $global := .Values.global.image -}}
117+
{{- $repository := .Values.sandboxRuntime.image.repository | default (printf "%s/sandbox" $global.repository) -}}
118+
{{- if or (ne $repository $defaultRepository) .Values.sandboxRuntime.image.tag .Values.global.image.tag -}}true{{- end -}}
116119
{{- end }}
117120

118121
{{/* Sandbox runtime image override. */}}
119122
{{- define "openshell.sandboxRuntimeImage" -}}
120-
{{- $repository := .Values.sandboxRuntime.image.repository | default (include "openshell.defaultSandboxRuntimeRepository" .) -}}
121-
{{- $tag := .Values.sandboxRuntime.image.tag | default .Values.gateway.image.tag | default .Chart.AppVersion -}}
123+
{{- $global := .Values.global.image -}}
124+
{{- $repository := .Values.sandboxRuntime.image.repository | default (printf "%s/sandbox" $global.repository) -}}
125+
{{- $tag := .Values.sandboxRuntime.image.tag | default $global.tag | default .Chart.AppVersion -}}
122126
{{- printf "%s:%s" $repository $tag }}
123127
{{- end }}
124128

@@ -155,11 +159,12 @@ Supervisor image override. A tag-only override uses the official repository;
155159
a repository-only override uses the effective gateway image tag.
156160
*/}}
157161
{{- define "openshell.supervisorImage" -}}
158-
{{- $repository := .Values.supervisor.image.repository | default (include "openshell.defaultSupervisorRepository" .) -}}
162+
{{- $global := .Values.global.image -}}
163+
{{- $repository := .Values.supervisor.image.repository | default (printf "%s/supervisor" $global.repository) -}}
159164
{{- if .Values.supervisor.image.digest -}}
160165
{{- printf "%s@%s" $repository .Values.supervisor.image.digest -}}
161166
{{- else -}}
162-
{{- $tag := .Values.supervisor.image.tag | default .Values.gateway.image.tag | default .Chart.AppVersion -}}
167+
{{- $tag := .Values.supervisor.image.tag | default $global.tag | default .Chart.AppVersion -}}
163168
{{- printf "%s:%s" $repository $tag -}}
164169
{{- end }}
165170
{{- end }}

‎deploy/helm/openshell/templates/certgen.yaml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ spec:
8686
containers:
8787
- name: certgen
8888
image: {{ include "openshell.image" . | quote }}
89-
imagePullPolicy: {{ .Values.gateway.image.pullPolicy }}
89+
imagePullPolicy: {{ .Values.gateway.image.pullPolicy | default .Values.global.image.pullPolicy }}
9090
securityContext:
9191
allowPrivilegeEscalation: false
9292
capabilities:
@@ -157,7 +157,7 @@ spec:
157157
containers:
158158
- name: certgen
159159
image: {{ include "openshell.image" . | quote }}
160-
imagePullPolicy: {{ .Values.gateway.image.pullPolicy }}
160+
imagePullPolicy: {{ .Values.gateway.image.pullPolicy | default .Values.global.image.pullPolicy }}
161161
securityContext:
162162
allowPrivilegeEscalation: false
163163
capabilities:

‎deploy/helm/openshell/templates/gateway-config.yaml‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,11 @@ data:
208208
{{- if .Values.server.defaultRuntimeClassName }}
209209
default_runtime_class_name = {{ .Values.server.defaultRuntimeClassName | quote }}
210210
{{- end }}
211-
{{- if .Values.supervisor.image.pullPolicy }}
212-
supervisor_image_pull_policy = {{ include "openshell.canonicalImagePullPolicy" .Values.supervisor.image.pullPolicy | quote }}
211+
{{- if (.Values.supervisor.image.pullPolicy | default .Values.global.image.pullPolicy) }}
212+
supervisor_image_pull_policy = {{ include "openshell.canonicalImagePullPolicy" (.Values.supervisor.image.pullPolicy | default .Values.global.image.pullPolicy) | quote }}
213213
{{- end }}
214-
{{- if .Values.sandboxRuntime.image.pullPolicy }}
215-
sandbox_runtime_image_pull_policy = {{ include "openshell.canonicalImagePullPolicy" .Values.sandboxRuntime.image.pullPolicy | quote }}
214+
{{- if (.Values.sandboxRuntime.image.pullPolicy | default .Values.global.image.pullPolicy) }}
215+
sandbox_runtime_image_pull_policy = {{ include "openshell.canonicalImagePullPolicy" (.Values.sandboxRuntime.image.pullPolicy | default .Values.global.image.pullPolicy) | quote }}
216216
{{- end }}
217217
218218
[openshell.drivers.kubernetes.managed_ssh_ingress]

‎deploy/helm/openshell/tests/gateway_config_test.yaml‎

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,20 @@ tests:
5656
path: spec.template.spec.containers[0].image
5757
value: registry.example/gateway:0.0.0
5858

59+
- it: applies global image values to gateway, supervisor, and sandbox runtime
60+
template: templates/gateway-config.yaml
61+
set:
62+
global.image.repository: registry.example.com/openshell
63+
global.image.tag: v0.1.0
64+
global.image.pullPolicy: IfNotPresent
65+
asserts:
66+
- matchRegex:
67+
path: data["gateway.toml"]
68+
pattern: 'supervisor_image\s*=\s*"registry\.example\.com/openshell/supervisor:v0\.1\.0"'
69+
- matchRegex:
70+
path: data["gateway.toml"]
71+
pattern: 'sandbox_runtime_image\s*=\s*"registry\.example\.com/openshell/sandbox:v0\.1\.0"'
72+
5973
- it: defaults a repository-only sandbox image to latest
6074
template: templates/gateway-config.yaml
6175
set:
@@ -235,12 +249,12 @@ tests:
235249
path: data["gateway.toml"]
236250
pattern: '(?ms)\[openshell\.gateway\][^\[]*?grpc_endpoint'
237251

238-
- it: omits pull policies by default so Kubernetes applies its own defaults
252+
- it: applies the global pull policy by default
239253
template: templates/gateway-config.yaml
240254
asserts:
241-
- notMatchRegex:
255+
- matchRegex:
242256
path: data["gateway.toml"]
243-
pattern: '(?m)^\s*(image_pull_policy|supervisor_image_pull_policy)\s*='
257+
pattern: '(?ms)supervisor_image_pull_policy\s*=\s*"if_not_present".*?sandbox_runtime_image_pull_policy\s*=\s*"if_not_present"'
244258

245259
- it: renders canonical image pull policies in the Kubernetes driver table
246260
template: templates/gateway-config.yaml

‎deploy/helm/openshell/values.yaml‎

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@
77
# server.externalDbSecret because the default SQLite backend is per pod.
88
replicaCount: 1
99

10+
global:
11+
image:
12+
# -- Shared OpenShell image repository. Individual image repositories take precedence.
13+
repository: ghcr.io/nvidia/openshell
14+
# -- Shared OpenShell image tag. Defaults to the chart appVersion when empty.
15+
tag: ""
16+
# -- Shared OpenShell image pull policy. Individual image pull policies take precedence.
17+
pullPolicy: IfNotPresent
18+
1019
workload:
1120
# -- Gateway workload controller kind. Use `statefulset` for the default
1221
# SQLite database, or `deployment` when server.externalDbSecret points at an
@@ -21,9 +30,9 @@ workload:
2130
gateway:
2231
image:
2332
# -- Gateway image repository.
24-
repository: ghcr.io/nvidia/openshell/gateway
33+
repository: ""
2534
# -- Gateway image pull policy.
26-
pullPolicy: IfNotPresent
35+
pullPolicy: null
2736
# -- Gateway image tag. Defaults to the chart appVersion when empty.
2837
tag: ""
2938
# -- Gateway image digest. When set, this takes precedence over tag.
@@ -33,17 +42,17 @@ gateway:
3342
sandboxRuntime:
3443
image:
3544
# -- Sandbox runtime image repository. Changing it uses the effective gateway image tag unless tag is also set.
36-
repository: ghcr.io/nvidia/openshell/sandbox
45+
repository: ""
3746
# -- Sandbox runtime image pull policy. Defaults to the gateway image pull policy when empty.
38-
pullPolicy: ""
47+
pullPolicy: null
3948
# -- Sandbox runtime image tag override. Empty uses the version pinned into the gateway unless repository is changed.
4049
tag: ""
4150

4251
# Trusted control-side runtime image.
4352
supervisor:
4453
image:
4554
# -- Supervisor image repository. Changing it uses the effective gateway image tag unless tag is also set.
46-
repository: ghcr.io/nvidia/openshell/supervisor
55+
repository: ""
4756
# -- Sandbox supervisor pull policy. Leave unset to use the Kubernetes
4857
# image default. Prefer always, if_not_present, or never; the chart also
4958
# accepts legacy Kubernetes spellings Always, IfNotPresent, and Never.

0 commit comments

Comments
 (0)