Skip to content

Commit

Permalink
Fixed file
Browse files Browse the repository at this point in the history
Signed-off-by: Omer Aplatony <[email protected]>
  • Loading branch information
omerap12 committed Jul 30, 2024
1 parent 1a4e7fd commit 81527ae
Show file tree
Hide file tree
Showing 10 changed files with 141 additions and 1,592 deletions.
2 changes: 1 addition & 1 deletion hack/charts/cluster-api-operator/templates/addon.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ spec:
secretNamespace: {{ $.Values.secretNamespace }}
{{- end }}
{{- end }}
{{- if hasKey $.Values.deploymentOverride "addon" }}
{{- if hasKey (default (dict) $.Values.deploymentOverride) "addon" }}
{{ .Values.deploymentOverride.addon | toYaml | nindent 2 }}
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion hack/charts/cluster-api-operator/templates/bootstrap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ spec:
{{- end }}
{{- end }}
{{- end }}
{{- if hasKey $.Values.deploymentOverride "bootstrap" }}
{{- if hasKey (default (dict) $.Values.deploymentOverride) "bootstrap" }}
{{ .Values.deploymentOverride.bootstrap | toYaml | nindent 2 }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ spec:
{{- end }}
{{- end }}
{{- end }}
{{- if hasKey $.Values.deploymentOverride "controlPlane" }}
{{- if hasKey (default (dict) $.Values.deploymentOverride) "controlPlane" }}
{{ .Values.deploymentOverride.controlPlane | toYaml | nindent 2 }}
{{- end }}
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ spec:
{{- end }}
{{- end }}
{{- end }}
{{- if hasKey $.Values.deploymentOverride "coreCondition" }}
{{- if hasKey (default (dict) $.Values.deploymentOverride ) "coreCondition" }}
{{ .Values.deploymentOverride.coreCondition| toYaml | nindent 2 }}
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion hack/charts/cluster-api-operator/templates/core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ spec:
namespace: {{ $.Values.configSecret.namespace }}
{{- end }}
{{- end }}
{{- if hasKey $.Values.deploymentOverride "core" }}
{{- if hasKey (default (dict) $.Values.deploymentOverride) "core" }}
{{ .Values.deploymentOverride.core | toYaml | nindent 2 }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ spec:
{{- end }}
{{- end }}
{{- end }}
{{- if hasKey $.Values.deploymentOverride "infraCondition" }}
{{- if hasKey (default (dict) $.Values.deploymentOverride ) "infraCondition" }}
{{ .Values.deploymentOverride.infraCondition | toYaml | nindent 2 }}
{{- end }}
{{- end }}
Expand Down
2 changes: 1 addition & 1 deletion hack/charts/cluster-api-operator/templates/infra.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ spec:
{{- include "recursivePrinter" $.Values.additionalDeployments | indent 2 }}
{{- end }}
{{- end }}
{{- if hasKey $.Values.deploymentOverride "infrastructure" }}
{{- if hasKey (default (dict) $.Values.deploymentOverride ) "infrastructure" }}
{{ .Values.deploymentOverride.infrastructure | toYaml | nindent 2 }}
{{- end }}
{{- end }}
35 changes: 11 additions & 24 deletions test/e2e/helm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,32 +262,19 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
Expect(manifests).To(MatchYAML(string(expectedManifests)))
})

It("should include deplpoymentoverrides when specified - all", func() {
manifest, err := helmChart.Run(map[string]string{
"core": "override-test-core",
"bootstrap": "override-test-core",
"controlPlane": "override-test-core",
"infrastructure": "override-test-core",
"addon": "override-test-core",
"deploymentOverride.addon.containers[0].name": "manager",
"deploymentOverride.addon.containers[0].imageUrl": "test.org/cluster-api-provider-aws/cluster-api-provider-aws-controller:v0.6.0",
"deploymentOverride.core.containers[0].name": "manager",
"deploymentOverride.core.containers[0].imageUrl": "test.org/cluster-api/cluster-api-controller:v1.7.1",
It("should include deplpoymentoverrides when specified", func() {
manifests, err := helmChart.Run(map[string]string{
"configSecret.name": "test-secret-name",
"configSecret.namespace": "test-secret-namespace",
"infrastructure": "docker",
"addon": "helm",
"deploymentOverride.infrastructure.deployment.containers[0].name": "manager",
"deploymentOverride.infrastructure.deployment.containers[0].imageUrl": "test.org/cluster-api-vsphere/cluster-api-vsphere-controller:v1.10.0",
"deploymentOverride.bootstrap.deployment.containers[0].name": "manager",
"deploymentOverride.bootstrap.deployment.containers[0].imageUrl": "test.org/cluster-api-bootstrap-provider-kubeadm/cluster-api-kubeadm-controller:v0.4.0",
"deploymentOverride.controlPlane.deployment.containers[0].name": "manager",
"deploymentOverride.controlPlane.deployment.containers[0].imageUrl": "test.org/cluster-api-control-plane/cluster-api-control-plane-controller:v0.4.0",
"deploymentOverride.coreConditions.containers[0].name": "manager",
"deploymentOverride.coreConditions.containers[0].imageUrl": "test.org/cluster-api/cluster-api-controller:v1.7.1",
"deploymentOverride.infraConditions.containers[0].name": "manager",
"deploymentOverride.infraConditions.containers[0].imageUrl": "test.org/cluster-api/cluster-api-controller:v1.7.1",
})
Except(err).ToNot(HaveOccurred())
Except(manifest).ToNot(BeEmpty())
expectedManifests, err := os.ReadFile(filepath.Join(customManifestsFolder, "deployment-overrides-all.yaml"))
Except(err).ToNot(HaveOccurred())
Except(manifest).To(Equal(string(expectedManifests)))
Expect(err).ToNot(HaveOccurred())
Expect(manifests).ToNot(BeEmpty())
expectedManifests, err := os.ReadFile(filepath.Join(customManifestsFolder, "only-infra-and-addon-override.yaml"))
Expect(err).ToNot(HaveOccurred())
Expect(manifests).To(MatchYAML(string(expectedManifests)))
})
})
Loading

0 comments on commit 81527ae

Please sign in to comment.