Skip to content

Commit 84eca49

Browse files
committed
fix: add missing JOB_KUBE_CONNECTOR_IMAGE_REGISTRY (#16855)
1 parent e85106e commit 84eca49

File tree

3 files changed

+71
-0
lines changed

3 files changed

+71
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
package tests
2+
3+
import (
4+
"testing"
5+
6+
helmtests "github.com/airbytehq/airbyte-platform-internal/oss/charts/helm-tests"
7+
"github.com/stretchr/testify/assert"
8+
)
9+
10+
func TestDefaultConnectorImageRegistry(t *testing.T) {
11+
opts := helmtests.BaseHelmOptions()
12+
chartYaml, err := helmtests.RenderHelmChart(t, opts, chartPath, "airbyte", nil)
13+
assert.NoError(t, err)
14+
15+
expectedEnvVars := []helmtests.ExpectedEnvVar{
16+
helmtests.ExpectedConfigMapVar().RefName("airbyte-airbyte-env").RefKey("JOB_KUBE_CONNECTOR_IMAGE_REGISTRY").Value(""),
17+
}
18+
19+
releaseApps := appsForRelease("airbyte")
20+
rapp := releaseApps["workload-launcher"]
21+
app := chartYaml.GetResourceByKindAndName(rapp.Kind, rapp.FQN())
22+
assert.NotNil(t, app, "unable to find %s named '%s'", rapp.Kind, rapp.FQN())
23+
24+
pod := helmtests.GetPodSpec(app)
25+
assert.NotNil(t, pod, "unable to extract pod spec from %s: %s", rapp.Kind, rapp.FQN())
26+
chartYaml.VerifyEnvVarsForApp(t, rapp.Kind, rapp.FQN(), expectedEnvVars)
27+
}
28+
29+
func TestOverrideConnectorImageRegistry(t *testing.T) {
30+
opts := helmtests.BaseHelmOptions()
31+
opts.SetValues["global.image.registry"] = "not-the-default"
32+
chartYaml, err := helmtests.RenderHelmChart(t, opts, chartPath, "airbyte", nil)
33+
assert.NoError(t, err)
34+
35+
expectedEnvVars := []helmtests.ExpectedEnvVar{
36+
helmtests.ExpectedConfigMapVar().RefName("airbyte-airbyte-env").RefKey("JOB_KUBE_CONNECTOR_IMAGE_REGISTRY").Value("not-the-default"),
37+
}
38+
39+
releaseApps := appsForRelease("airbyte")
40+
rapp := releaseApps["workload-launcher"]
41+
app := chartYaml.GetResourceByKindAndName(rapp.Kind, rapp.FQN())
42+
assert.NotNil(t, app, "unable to find %s named '%s'", rapp.Kind, rapp.FQN())
43+
44+
pod := helmtests.GetPodSpec(app)
45+
assert.NotNil(t, pod, "unable to extract pod spec from %s: %s", rapp.Kind, rapp.FQN())
46+
chartYaml.VerifyEnvVarsForApp(t, rapp.Kind, rapp.FQN(), expectedEnvVars)
47+
}

charts/v2/airbyte/config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1481,6 +1481,10 @@ workloadLauncher.dataPlane:
14811481
workloadLauncher.images:
14821482
keyBasePath: workloadLauncher
14831483
config:
1484+
- env: JOB_KUBE_CONNECTOR_IMAGE_REGISTRY
1485+
keyBasePath: global.image
1486+
key: registry
1487+
14841488
- env: CONNECTOR_PROFILER_IMAGE
14851489
key: connectorProfiler.image
14861490
valueExp: include "imageUrl" (list .Values.workloadLauncher.connectorProfiler.image $)

charts/v2/airbyte/templates/config/_workloadLauncher.tpl

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,24 @@ DATAPLANE_CLIENT_ID: {{ include "airbyte.workloadLauncher.dataPlane.clientId" .
244244
DATAPLANE_CLIENT_SECRET: {{ include "airbyte.workloadLauncher.dataPlane.clientSecret" . | quote }}
245245
{{- end }}
246246

247+
{{/*
248+
Renders the global.image.registry value
249+
*/}}
250+
{{- define "airbyte.workloadLauncher.images.registry" }}
251+
{{- .Values.global.image.registry }}
252+
{{- end }}
253+
254+
{{/*
255+
Renders the workloadLauncher.images.registry environment variable
256+
*/}}
257+
{{- define "airbyte.workloadLauncher.images.registry.env" }}
258+
- name: JOB_KUBE_CONNECTOR_IMAGE_REGISTRY
259+
valueFrom:
260+
configMapKeyRef:
261+
name: {{ .Release.Name }}-airbyte-env
262+
key: JOB_KUBE_CONNECTOR_IMAGE_REGISTRY
263+
{{- end }}
264+
247265
{{/*
248266
Renders the workloadLauncher.connectorProfiler.image value
249267
*/}}
@@ -338,6 +356,7 @@ Renders the workloadLauncher.images.workloadInit.image environment variable
338356
Renders the set of all workloadLauncher.images environment variables
339357
*/}}
340358
{{- define "airbyte.workloadLauncher.images.envs" }}
359+
{{- include "airbyte.workloadLauncher.images.registry.env" . }}
341360
{{- include "airbyte.workloadLauncher.images.connectorProfiler.image.env" . }}
342361
{{- include "airbyte.workloadLauncher.images.connectorSidecar.image.env" . }}
343362
{{- include "airbyte.workloadLauncher.images.containerOrchestrator.enabled.env" . }}
@@ -349,6 +368,7 @@ Renders the set of all workloadLauncher.images environment variables
349368
Renders the set of all workloadLauncher.images config map variables
350369
*/}}
351370
{{- define "airbyte.workloadLauncher.images.configVars" }}
371+
JOB_KUBE_CONNECTOR_IMAGE_REGISTRY: {{ include "airbyte.workloadLauncher.images.registry" . | quote }}
352372
CONNECTOR_PROFILER_IMAGE: {{ include "airbyte.workloadLauncher.images.connectorProfiler.image" . | quote }}
353373
CONNECTOR_SIDECAR_IMAGE: {{ include "airbyte.workloadLauncher.images.connectorSidecar.image" . | quote }}
354374
CONTAINER_ORCHESTRATOR_ENABLED: {{ include "airbyte.workloadLauncher.images.containerOrchestrator.enabled" . | quote }}

0 commit comments

Comments
 (0)