Skip to content

Commit 430d1a4

Browse files
Bobbins228krishicks
authored andcommitted
feat(helm): support image registry overrides
Signed-off-by: Bobbins228 <mcampbel@redhat.com> Signed-off-by: Kris Hicks <khicks@nvidia.com>
1 parent a3af4ca commit 430d1a4

15 files changed

Lines changed: 179 additions & 69 deletions

‎TESTING.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -374,10 +374,10 @@ mise run e2e:kubernetes
374374
```
375375

376376
`GATEWAY_IMAGE` applies to the Kubernetes gateway container. `SUPERVISOR_IMAGE`
377-
applies to the supervisor image selected by the Kubernetes, Docker, and Podman
378-
wrappers. `SANDBOX_IMAGE` applies to the standalone sandbox image selected by
379-
all test wrappers. A repository-only value inherits `IMAGE_TAG` for gateway and
380-
supervisor images; a value with an explicit tag or `@sha256:` digest is used
377+
applies to the trusted supervisor image selected by the Kubernetes, Docker, and
378+
Podman wrappers. `SANDBOX_IMAGE` applies to the trusted workload-side runtime
379+
image that stages the `openshell-sandbox` binary. A repository-only value
380+
inherits `IMAGE_TAG`; a value with an explicit tag or `@sha256:` digest is used
381381
as-is. When these variables are unset, the existing `OPENSHELL_REGISTRY` plus
382382
`IMAGE_TAG` behavior is retained.
383383
The Docker and Podman wrappers continue to give
@@ -419,7 +419,7 @@ Kubernetes e2e environment variables:
419419
| `OPENSHELL_REGISTRY` | Image registry prefix (default: `ghcr.io/nvidia/openshell`) |
420420
| `GATEWAY_IMAGE` | Kubernetes gateway image repository or complete tagged/digest-pinned image reference; digests require `OPENSHELL_E2E_KUBE_BUILD_IMAGES=0` |
421421
| `SUPERVISOR_IMAGE` | Gateway/supervisor image repository or complete tagged/digest-pinned image reference; Kubernetes digests require `OPENSHELL_E2E_KUBE_BUILD_IMAGES=0` |
422-
| `SANDBOX_IMAGE` | Standalone sandbox image repository or complete tagged/digest-pinned image reference |
422+
| `SANDBOX_IMAGE` | Trusted sandbox runtime image repository or complete tagged/digest-pinned image reference |
423423

424424
Run a single test directly with cargo:
425425

‎deploy/helm/openshell/README.md‎

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -210,11 +210,12 @@ discovery endpoint or its TLS CA.
210210
| 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. |
211211
| fullnameOverride | string | `""` | Override the full generated resource name. |
212212
| gateway.image.digest | string | `""` | Gateway image digest. When set, this takes precedence over tag. |
213-
| gateway.image.pullPolicy | string | `nil` | Gateway image pull policy. |
214-
| gateway.image.repository | string | `""` | Gateway image repository. |
213+
| gateway.image.pullPolicy | string | `nil` | Gateway image pull policy. Empty uses global.image.pullPolicy. |
214+
| gateway.image.registry | string | `""` | Gateway image registry. Empty uses global.image.registry. |
215+
| gateway.image.repository | string | `"openshell/gateway"` | Gateway image repository. |
215216
| gateway.image.tag | string | `""` | Gateway image tag. Defaults to the chart appVersion when empty. |
216217
| global.image.pullPolicy | string | `"IfNotPresent"` | Shared OpenShell image pull policy. Individual image pull policies take precedence. |
217-
| global.image.repository | string | `"ghcr.io/nvidia/openshell"` | Shared OpenShell image repository. Individual image repositories take precedence. |
218+
| global.image.registry | string | `"ghcr.io/nvidia"` | Shared OpenShell image registry. Individual image registries take precedence. |
218219
| global.image.tag | string | `""` | Shared OpenShell image tag. Defaults to the chart appVersion when empty. |
219220
| 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. |
220221
| 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. |
@@ -262,9 +263,11 @@ discovery endpoint or its TLS CA.
262263
| sandbox.image.pullPolicy | string | `nil` | Sandbox image pull policy. Leave unset to use the Kubernetes image default. |
263264
| sandbox.image.repository | string | `"ghcr.io/nvidia/openshell-community/sandboxes/base"` | Default standalone sandbox image repository. |
264265
| sandbox.image.tag | string | `"latest"` | Sandbox image tag. Defaults to latest when empty. |
265-
| sandboxRuntime.image.pullPolicy | string | `nil` | Sandbox runtime image pull policy. Defaults to the gateway image pull policy when empty. |
266-
| sandboxRuntime.image.repository | string | `""` | Sandbox runtime image repository. Changing it uses the effective gateway image tag unless tag is also set. |
267-
| sandboxRuntime.image.tag | string | `""` | Sandbox runtime image tag override. Empty uses the version pinned into the gateway unless repository is changed. |
266+
| sandboxRuntime.image.digest | string | `""` | Sandbox runtime image digest. When set, this takes precedence over tag. |
267+
| sandboxRuntime.image.pullPolicy | string | `nil` | Sandbox runtime image pull policy. Empty uses global.image.pullPolicy. |
268+
| sandboxRuntime.image.registry | string | `""` | Sandbox runtime image registry. Empty uses global.image.registry. |
269+
| sandboxRuntime.image.repository | string | `"openshell/sandbox"` | Sandbox runtime image repository. |
270+
| sandboxRuntime.image.tag | string | `""` | Sandbox runtime image tag. Defaults to the chart appVersion when empty. |
268271
| sandboxServiceAccount.annotations | object | `{}` | Annotations to add to the generated sandbox service account. |
269272
| sandboxServiceAccount.create | bool | `true` | Create a service account for sandbox pods. |
270273
| sandboxServiceAccount.name | string | `""` | Existing service account name for sandbox pods when sandboxServiceAccount.create is false. |
@@ -346,9 +349,10 @@ discovery endpoint or its TLS CA.
346349
| serviceAccount.create | bool | `true` | Create a service account for the gateway. |
347350
| serviceAccount.name | string | `""` | Existing service account name to use when serviceAccount.create is false. |
348351
| supervisor.image.digest | string | `""` | Supervisor image digest. When set, this takes precedence over tag. |
349-
| 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. |
350-
| supervisor.image.repository | string | `""` | Supervisor image repository. Changing it uses the effective gateway image tag unless tag is also set. |
351-
| supervisor.image.tag | string | `""` | Supervisor image tag override. Empty uses the version pinned into the gateway unless repository is changed. |
352+
| supervisor.image.pullPolicy | string | `nil` | Supervisor image pull policy. Empty uses global.image.pullPolicy. Prefer always, if_not_present, or never; the chart also accepts legacy Kubernetes spellings Always, IfNotPresent, and Never. |
353+
| supervisor.image.registry | string | `""` | Supervisor image registry. Empty uses global.image.registry. |
354+
| supervisor.image.repository | string | `"openshell/supervisor"` | Supervisor image repository. |
355+
| supervisor.image.tag | string | `""` | Supervisor image tag. Defaults to the chart appVersion when empty. |
352356
| supervisor.sandboxRuntime.boundaryPort | int | `5500` | Workload boundary TLS listener port. |
353357
| supervisor.sandboxRuntime.networkPolicyEnforced | bool | `false` | Required operator acknowledgement that the cluster CNI enforces NetworkPolicy. |
354358
| tolerations | list | `[]` | Tolerations for the gateway pod. |

‎deploy/helm/openshell/skaffold.yaml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,9 @@ deploy:
139139
# To test multi-replica external PostgreSQL behavior:
140140
#- ci/values-high-availability.yaml
141141
setValueTemplates:
142+
# Skaffold supplies complete image repositories. Clear the chart's
143+
# shared registry so these values are used verbatim.
144+
global.image.registry: ''
142145
gateway.image.repository: '{{.IMAGE_REPO_openshell_gateway}}'
143146
gateway.image.tag: '{{.IMAGE_TAG_openshell_gateway}}'
144147
supervisor.image.repository: '{{.IMAGE_REPO_openshell_supervisor}}'

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

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ default to enabled so upgrades with --reuse-values preserve the old topology.
9090
{{- define "openshell.image" -}}
9191
{{- $image := .Values.gateway.image -}}
9292
{{- $global := .Values.global.image -}}
93-
{{- $repository := $image.repository | default (printf "%s/gateway" $global.repository) -}}
93+
{{- $registry := $image.registry | default $global.registry -}}
94+
{{- $repository := ternary (printf "%s/%s" $registry $image.repository) $image.repository (ne $registry "") -}}
9495
{{- if $image.digest -}}
9596
{{- printf "%s@%s" $repository $image.digest -}}
9697
{{- else -}}
@@ -117,16 +118,22 @@ ghcr.io/nvidia/openshell/sandbox
117118
{{- define "openshell.sandboxRuntimeImageOverrideEnabled" -}}
118119
{{- $defaultRepository := include "openshell.defaultSandboxRuntimeRepository" . -}}
119120
{{- $global := .Values.global.image -}}
120-
{{- $repository := .Values.sandboxRuntime.image.repository | default (printf "%s/sandbox" $global.repository) -}}
121-
{{- if or (ne $repository $defaultRepository) .Values.sandboxRuntime.image.tag .Values.global.image.tag -}}true{{- end -}}
121+
{{- $registry := .Values.sandboxRuntime.image.registry | default $global.registry -}}
122+
{{- $repository := ternary (printf "%s/%s" $registry .Values.sandboxRuntime.image.repository) .Values.sandboxRuntime.image.repository (ne $registry "") -}}
123+
{{- if or (ne $repository $defaultRepository) .Values.sandboxRuntime.image.tag .Values.sandboxRuntime.image.digest .Values.global.image.tag -}}true{{- end -}}
122124
{{- end }}
123125

124126
{{/* Sandbox runtime image override. */}}
125127
{{- define "openshell.sandboxRuntimeImage" -}}
126128
{{- $global := .Values.global.image -}}
127-
{{- $repository := .Values.sandboxRuntime.image.repository | default (printf "%s/sandbox" $global.repository) -}}
129+
{{- $registry := .Values.sandboxRuntime.image.registry | default $global.registry -}}
130+
{{- $repository := ternary (printf "%s/%s" $registry .Values.sandboxRuntime.image.repository) .Values.sandboxRuntime.image.repository (ne $registry "") -}}
131+
{{- if .Values.sandboxRuntime.image.digest -}}
132+
{{- printf "%s@%s" $repository .Values.sandboxRuntime.image.digest -}}
133+
{{- else -}}
128134
{{- $tag := .Values.sandboxRuntime.image.tag | default $global.tag | default .Chart.AppVersion -}}
129-
{{- printf "%s:%s" $repository $tag }}
135+
{{- printf "%s:%s" $repository $tag -}}
136+
{{- end -}}
130137
{{- end }}
131138

132139
{{/* Official supervisor repository used by the gateway's built-in default. */}}
@@ -157,13 +164,11 @@ The chart's documented repository and empty tag are the gateway-owned default.
157164
true
158165
{{- end }}
159166

160-
{{/*
161-
Supervisor image override. A tag-only override uses the official repository;
162-
a repository-only override uses the effective gateway image tag.
163-
*/}}
167+
{{/* Supervisor image override. */}}
164168
{{- define "openshell.supervisorImage" -}}
165169
{{- $global := .Values.global.image -}}
166-
{{- $repository := .Values.supervisor.image.repository | default (printf "%s/supervisor" $global.repository) -}}
170+
{{- $registry := .Values.supervisor.image.registry | default $global.registry -}}
171+
{{- $repository := ternary (printf "%s/%s" $registry .Values.supervisor.image.repository) .Values.supervisor.image.repository (ne $registry "") -}}
167172
{{- if .Values.supervisor.image.digest -}}
168173
{{- printf "%s@%s" $repository .Values.supervisor.image.digest -}}
169174
{{- else -}}

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

Lines changed: 51 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ tests:
8585
- it: preserves a complete tagged gateway image reference
8686
template: templates/statefulset.yaml
8787
set:
88-
gateway.image.repository: registry.example/gateway
88+
gateway.image.registry: registry.example
89+
gateway.image.repository: gateway
8990
gateway.image.tag: branch
9091
asserts:
9192
- equal:
@@ -95,7 +96,8 @@ tests:
9596
- it: defaults a repository-only gateway image to the chart appVersion
9697
template: templates/statefulset.yaml
9798
set:
98-
gateway.image.repository: registry.example/gateway
99+
gateway.image.registry: registry.example
100+
gateway.image.repository: gateway
99101
asserts:
100102
- equal:
101103
path: spec.template.spec.containers[0].image
@@ -104,7 +106,7 @@ tests:
104106
- it: applies global image values to gateway, supervisor, and sandbox runtime
105107
template: templates/gateway-config.yaml
106108
set:
107-
global.image.repository: registry.example.com/openshell
109+
global.image.registry: registry.example.com
108110
global.image.tag: v0.1.0
109111
global.image.pullPolicy: IfNotPresent
110112
asserts:
@@ -115,6 +117,28 @@ tests:
115117
path: data["gateway.toml"]
116118
pattern: 'sandbox_runtime_image\s*=\s*"registry\.example\.com/openshell/sandbox:v0\.1\.0"'
117119

120+
- it: lets an individual registry override the global registry
121+
template: templates/statefulset.yaml
122+
set:
123+
global.image.registry: registry.example.com
124+
gateway.image.registry: mirror.example.com
125+
gateway.image.repository: custom/gateway
126+
global.image.tag: v0.1.0
127+
asserts:
128+
- equal:
129+
path: spec.template.spec.containers[0].image
130+
value: mirror.example.com/custom/gateway:v0.1.0
131+
132+
- it: applies the global registry to the gateway image
133+
template: templates/statefulset.yaml
134+
set:
135+
global.image.registry: registry.example.com
136+
global.image.tag: v0.1.0
137+
asserts:
138+
- equal:
139+
path: spec.template.spec.containers[0].image
140+
value: registry.example.com/openshell/gateway:v0.1.0
141+
118142
- it: defaults a repository-only sandbox image to latest
119143
template: templates/gateway-config.yaml
120144
set:
@@ -127,7 +151,8 @@ tests:
127151
- it: gives a gateway digest precedence over its tag
128152
template: templates/statefulset.yaml
129153
set:
130-
gateway.image.repository: registry.example/gateway
154+
gateway.image.registry: registry.example
155+
gateway.image.repository: gateway
131156
gateway.image.tag: ignored
132157
gateway.image.digest: sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
133158
asserts:
@@ -138,7 +163,8 @@ tests:
138163
- it: gives supervisor and sandbox digests precedence over their tags
139164
template: templates/gateway-config.yaml
140165
set:
141-
supervisor.image.repository: registry.example/supervisor
166+
supervisor.image.registry: registry.example
167+
supervisor.image.repository: supervisor
142168
supervisor.image.tag: ignored
143169
supervisor.image.digest: sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
144170
sandbox.image.repository: registry.example/sandbox
@@ -431,10 +457,12 @@ tests:
431457
- it: renders independent sandbox runtime and supervisor image overrides
432458
template: templates/gateway-config.yaml
433459
set:
434-
sandboxRuntime.image.repository: registry.example.com/openshell/sandbox
460+
sandboxRuntime.image.registry: registry.example.com
461+
sandboxRuntime.image.repository: openshell/sandbox
435462
sandboxRuntime.image.tag: sandbox-build
436463
sandboxRuntime.image.pullPolicy: Always
437-
supervisor.image.repository: registry.example.com/openshell/supervisor
464+
supervisor.image.registry: registry.example.com
465+
supervisor.image.repository: openshell/supervisor
438466
supervisor.image.tag: supervisor-build
439467
asserts:
440468
- matchRegex:
@@ -447,6 +475,18 @@ tests:
447475
path: data["gateway.toml"]
448476
pattern: 'supervisor_image\s*=\s*"registry\.example\.com/openshell/supervisor:supervisor-build"'
449477

478+
- it: gives a sandbox runtime digest precedence over its tag
479+
template: templates/gateway-config.yaml
480+
set:
481+
sandboxRuntime.image.registry: registry.example.com
482+
sandboxRuntime.image.repository: openshell/sandbox
483+
sandboxRuntime.image.tag: ignored
484+
sandboxRuntime.image.digest: sha256:cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
485+
asserts:
486+
- matchRegex:
487+
path: data["gateway.toml"]
488+
pattern: 'sandbox_runtime_image\s*=\s*"registry\.example\.com/openshell/sandbox@sha256:cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"'
489+
450490
- it: renders a supervisor tag override with the official repository
451491
template: templates/gateway-config.yaml
452492
set:
@@ -459,7 +499,8 @@ tests:
459499
- it: renders a supervisor repository override with the default chart tag
460500
template: templates/gateway-config.yaml
461501
set:
462-
supervisor.image.repository: registry.example.com/openshell/supervisor
502+
supervisor.image.registry: registry.example.com
503+
supervisor.image.repository: openshell/supervisor
463504
asserts:
464505
- matchRegex:
465506
path: data["gateway.toml"]
@@ -468,7 +509,8 @@ tests:
468509
- it: renders complete supervisor repository and tag overrides
469510
template: templates/gateway-config.yaml
470511
set:
471-
supervisor.image.repository: registry.example.com/openshell/supervisor
512+
supervisor.image.registry: registry.example.com
513+
supervisor.image.repository: openshell/supervisor
472514
supervisor.image.tag: supervisor-build
473515
asserts:
474516
- matchRegex:

0 commit comments

Comments
 (0)