Use ChartLoader to set operator deployment images

This allows the (operator) unittests to use dummy values instead of
relying on the real image string from versions.go.
This commit is contained in:
Otto Bittner 2022-11-28 09:15:39 +01:00
parent 3b6bc3b28f
commit fc8a2be843
6 changed files with 35 additions and 23 deletions

View File

@ -47,6 +47,8 @@ type ChartLoader struct {
verificationServiceImage string
gcpGuestAgentImage string
konnectivityImage string
constellationOperatorImage string
nodeMaintenanceOperatorImage string
}
// NewLoader creates a new ChartLoader.
@ -71,6 +73,8 @@ func NewLoader(csp cloudprovider.Provider, k8sVersion versions.ValidK8sVersion)
verificationServiceImage: versions.VerificationImage,
gcpGuestAgentImage: versions.GcpGuestImage,
konnectivityImage: versions.KonnectivityAgentImage,
constellationOperatorImage: versions.ConstellationOperatorImage,
nodeMaintenanceOperatorImage: versions.NodeMaintenanceOperatorImage,
}
}
@ -266,14 +270,14 @@ func (i *ChartLoader) loadOperatorsHelper(csp cloudprovider.Provider) (*chart.Ch
"constellation-operator": map[string]any{
"controllerManager": map[string]any{
"manager": map[string]any{
"image": versions.ConstellationOperatorImage,
"image": i.constellationOperatorImage,
},
},
},
"node-maintenance-operator": map[string]any{
"controllerManager": map[string]any{
"manager": map[string]any{
"image": versions.NodeMaintenanceOperatorImage,
"image": i.nodeMaintenanceOperatorImage,
},
},
},

View File

@ -170,7 +170,15 @@ func TestOperators(t *testing.T) {
assert := assert.New(t)
require := require.New(t)
chartLoader := ChartLoader{joinServiceImage: "joinServiceImage", kmsImage: "kmsImage", ccmImage: "ccmImage", cnmImage: "cnmImage", autoscalerImage: "autoscalerImage"}
chartLoader := ChartLoader{
joinServiceImage: "joinServiceImage",
kmsImage: "kmsImage",
ccmImage: "ccmImage",
cnmImage: "cnmImage",
autoscalerImage: "autoscalerImage",
constellationOperatorImage: "constellationOperatorImage",
nodeMaintenanceOperatorImage: "nodeMaintenanceOperatorImage",
}
chart, vals, err := chartLoader.loadOperatorsHelper(tc.csp)
require.NoError(err)

View File

@ -71,7 +71,7 @@ spec:
value: Azure
- name: constellation-uid
value: "42424242424242"
image: ghcr.io/edgelesssys/constellation/node-operator:v2.3.0-pre.0.20221125134926-1af3ff00adbc@sha256:fae7160eba0259d3dcbe974460ff983ae2c6cab18319a5b8ef585dd1630cb077
image: constellationOperatorImage
livenessProbe:
httpGet:
path: /healthz

View File

@ -64,7 +64,7 @@ spec:
fieldPath: metadata.namespace
- name: KUBERNETES_CLUSTER_DOMAIN
value: cluster.local
image: ghcr.io/edgelesssys/constellation/node-maintenance-operator:v0.13.1-alpha1@sha256:e011d428dba3ef66a2a4656a2bf58bcfe89836c62b0a75676f5c12350502a3cf
image: nodeMaintenanceOperatorImage
livenessProbe:
httpGet:
path: /healthz

View File

@ -71,7 +71,7 @@ spec:
value: GCP
- name: constellation-uid
value: "42424242424242"
image: ghcr.io/edgelesssys/constellation/node-operator:v2.3.0-pre.0.20221125134926-1af3ff00adbc@sha256:fae7160eba0259d3dcbe974460ff983ae2c6cab18319a5b8ef585dd1630cb077
image: constellationOperatorImage
livenessProbe:
httpGet:
path: /healthz

View File

@ -64,7 +64,7 @@ spec:
fieldPath: metadata.namespace
- name: KUBERNETES_CLUSTER_DOMAIN
value: cluster.local
image: ghcr.io/edgelesssys/constellation/node-maintenance-operator:v0.13.1-alpha1@sha256:e011d428dba3ef66a2a4656a2bf58bcfe89836c62b0a75676f5c12350502a3cf
image: nodeMaintenanceOperatorImage
livenessProbe:
httpGet:
path: /healthz