@@ -40,15 +40,9 @@ import (
4040 addonsv1alpha1 "sigs.k8s.io/cluster-api-addon-provider-helm/api/v1alpha1"
4141)
4242
43- var nginxValues = `controller:
44- name: "{{ .ControlPlane.metadata.name }}-nginx"
45- nginxStatus:
46- allowCidrs: {{ index .Cluster.spec.clusterNetwork.pods.cidrBlocks 0 }}`
43+ var postgresValues = `debug: false`
4744
48- var newNginxValues = `controller:
49- name: "{{ .Cluster.metadata.name }}-nginx"
50- nginxStatus:
51- allowCidrs: 127.0.0.1,::1,{{ index .Cluster.spec.clusterNetwork.pods.cidrBlocks 0 }}`
45+ var newPostgresValues = `debug: true`
5246
5347var _ = Describe ("Workload cluster creation" , func () {
5448 var (
@@ -121,7 +115,7 @@ var _ = Describe("Workload cluster creation", func() {
121115 })
122116
123117 Context ("Creating workload cluster [REQUIRED]" , func () {
124- It ("With default template to install, upgrade, and uninstall nginx Helm chart" , func () {
118+ It ("With default template to install, upgrade, and uninstall postgres Helm chart" , func () {
125119 clusterName = fmt .Sprintf ("%s-%s" , specName , util .RandomString (6 ))
126120 clusterctl .ApplyClusterTemplateAndWait (ctx , createApplyClusterTemplateInput (
127121 specName ,
@@ -136,26 +130,27 @@ var _ = Describe("Workload cluster creation", func() {
136130
137131 hcp := & addonsv1alpha1.HelmChartProxy {
138132 ObjectMeta : metav1.ObjectMeta {
139- Name : "nginx-ingress " ,
133+ Name : "pg " ,
140134 Namespace : namespace .Name ,
141135 },
142136 Spec : addonsv1alpha1.HelmChartProxySpec {
143137 ClusterSelector : metav1.LabelSelector {
144138 MatchLabels : map [string ]string {
145- "nginxIngress " : "enabled" ,
139+ "postgresChart " : "enabled" ,
146140 },
147141 },
148- ReleaseName : "nginx-ingress" ,
149- ReleaseNamespace : "nginx-namespace" ,
150- ChartName : "nginx-ingress" ,
151- RepoURL : "https://helm.nginx.com/stable" ,
152- ValuesTemplate : nginxValues ,
142+ ReleaseName : "postgres" ,
143+ ReleaseNamespace : "postgres-namespace" ,
144+ ChartName : "pgo" ,
145+ RepoURL : "oci://registry.developers.crunchydata.com/crunchydata" ,
146+ Version : "5.3.1" ,
147+ ValuesTemplate : postgresValues ,
153148 ReconcileStrategy : string (addonsv1alpha1 .ReconcileStrategyContinuous ),
154149 },
155150 }
156151
157152 // Create new Helm chart
158- By ("Creating new HelmChartProxy to install nginx " , func () {
153+ By ("Creating new HelmChartProxy to install postgres " , func () {
159154 HelmInstallSpec (ctx , func () HelmInstallInput {
160155 return HelmInstallInput {
161156 BootstrapClusterProxy : bootstrapClusterProxy ,
@@ -167,8 +162,8 @@ var _ = Describe("Workload cluster creation", func() {
167162 })
168163
169164 // Update existing Helm chart
170- By ("Updating nginx HelmChartProxy valuesTemplate " , func () {
171- hcp .Spec .ValuesTemplate = newNginxValues
165+ By ("Updating postgres HelmChartProxy valueTemplate " , func () {
166+ hcp .Spec .ValuesTemplate = newPostgresValues
172167 HelmUpgradeSpec (ctx , func () HelmUpgradeInput {
173168 return HelmUpgradeInput {
174169 BootstrapClusterProxy : bootstrapClusterProxy ,
@@ -182,7 +177,7 @@ var _ = Describe("Workload cluster creation", func() {
182177
183178 // Force reinstall of existing Helm chart by changing the release namespace
184179 By ("Updating HelmChartProxy release namespace" , func () {
185- hcp .Spec .ReleaseNamespace = "new-nginx -namespace"
180+ hcp .Spec .ReleaseNamespace = "new-postgres -namespace"
186181 HelmUpgradeSpec (ctx , func () HelmUpgradeInput {
187182 return HelmUpgradeInput {
188183 BootstrapClusterProxy : bootstrapClusterProxy ,
@@ -196,7 +191,7 @@ var _ = Describe("Workload cluster creation", func() {
196191
197192 // Force reinstall of existing Helm chart by changing the release name
198193 By ("Updating HelmChartProxy release name" , func () {
199- hcp .Spec .ReleaseName = "new-nginx-name "
194+ hcp .Spec .ReleaseName = "new-postgres "
200195 HelmUpgradeSpec (ctx , func () HelmUpgradeInput {
201196 return HelmUpgradeInput {
202197 BootstrapClusterProxy : bootstrapClusterProxy ,
@@ -223,7 +218,7 @@ var _ = Describe("Workload cluster creation", func() {
223218 })
224219
225220 Context ("Creating workload cluster [REQUIRED]" , func () {
226- It ("With default template to install and orphan an nginx Helm chart with InstallOnce strategy" , func () {
221+ It ("With default template to install and orphan an postgres Helm chart with InstallOnce strategy" , func () {
227222 clusterName = fmt .Sprintf ("%s-%s" , specName , util .RandomString (6 ))
228223 clusterctl .ApplyClusterTemplateAndWait (ctx , createApplyClusterTemplateInput (
229224 specName ,
@@ -238,26 +233,27 @@ var _ = Describe("Workload cluster creation", func() {
238233
239234 hcp := & addonsv1alpha1.HelmChartProxy {
240235 ObjectMeta : metav1.ObjectMeta {
241- Name : "nginx-ingress " ,
236+ Name : "pg " ,
242237 Namespace : namespace .Name ,
243238 },
244239 Spec : addonsv1alpha1.HelmChartProxySpec {
245240 ClusterSelector : metav1.LabelSelector {
246241 MatchLabels : map [string ]string {
247- "nginxIngress " : "enabled" ,
242+ "postgresChart " : "enabled" ,
248243 },
249244 },
250- ReleaseName : "nginx-ingress" ,
251- ReleaseNamespace : "nginx-namespace" ,
252- ChartName : "nginx-ingress" ,
253- RepoURL : "https://helm.nginx.com/stable" ,
254- ValuesTemplate : nginxValues ,
245+ ReleaseName : "postgres" ,
246+ ReleaseNamespace : "postgres-namespace" ,
247+ ChartName : "pgo" ,
248+ RepoURL : "oci://registry.developers.crunchydata.com/crunchydata" ,
249+ Version : "5.3.1" ,
250+ ValuesTemplate : postgresValues ,
255251 ReconcileStrategy : string (addonsv1alpha1 .ReconcileStrategyInstallOnce ),
256252 },
257253 }
258254
259255 // Create new Helm chart
260- By ("Creating new HelmChartProxy to install nginx " , func () {
256+ By ("Creating new HelmChartProxy to install postgres " , func () {
261257 HelmInstallSpec (ctx , func () HelmInstallInput {
262258 return HelmInstallInput {
263259 BootstrapClusterProxy : bootstrapClusterProxy ,
@@ -269,8 +265,8 @@ var _ = Describe("Workload cluster creation", func() {
269265 })
270266
271267 // Update existing Helm chart and expect Helm release to remain unchanged
272- By ("Updating nginx HelmChartProxy valuesTemplate" , func () {
273- hcp .Spec .ValuesTemplate = newNginxValues
268+ By ("Updating postgres HelmChartProxy valuesTemplate" , func () {
269+ hcp .Spec .Version = newPostgresValues
274270 HelmReleaseUnchangedSpec (ctx , func () HelmReleaseUnchangedInput {
275271 return HelmReleaseUnchangedInput {
276272 BootstrapClusterProxy : bootstrapClusterProxy ,
@@ -290,7 +286,7 @@ var _ = Describe("Workload cluster creation", func() {
290286 Namespace : namespace ,
291287 ClusterName : clusterName ,
292288 HelmChartProxy : hcp ,
293- Values : []string {fmt .Sprintf ("--controller.name=new-nginx-controller- %d" , i )},
289+ Values : []string {fmt .Sprintf ("replicas= %d" , i + 2 )},
294290 WaitPeriod : installOnceWaitPeriod ,
295291 }
296292 })
@@ -317,7 +313,7 @@ var _ = Describe("Workload cluster creation", func() {
317313 })
318314
319315 Context ("Creating multiple workload clusters [REQUIRED]" , func () {
320- It ("With default template to install and uninstall nginx Helm chart" , func () {
316+ It ("With default template to install and uninstall postgres Helm chart" , func () {
321317 clusterName = fmt .Sprintf ("%s-%s" , specName , util .RandomString (6 ))
322318 clusterctl .ApplyClusterTemplateAndWait (ctx , createApplyClusterTemplateInput (
323319 specName ,
@@ -362,25 +358,25 @@ var _ = Describe("Workload cluster creation", func() {
362358
363359 hcp := & addonsv1alpha1.HelmChartProxy {
364360 ObjectMeta : metav1.ObjectMeta {
365- Name : "nginx-ingress " ,
361+ Name : "pg " ,
366362 Namespace : namespace .Name ,
367363 },
368364 Spec : addonsv1alpha1.HelmChartProxySpec {
369365 ClusterSelector : metav1.LabelSelector {
370366 MatchLabels : map [string ]string {
371- "nginxIngress " : "enabled" ,
367+ "postgresChart " : "enabled" ,
372368 },
373369 },
374- ReleaseName : "nginx-ingress " ,
375- ReleaseNamespace : "nginx -namespace" ,
376- ChartName : "nginx-ingress " ,
377- RepoURL : "https ://helm.nginx. com/stable " ,
378- ValuesTemplate : nginxValues ,
370+ ReleaseName : "postgres " ,
371+ ReleaseNamespace : "postgres -namespace" ,
372+ ChartName : "pgo " ,
373+ RepoURL : "oci ://registry.developers.crunchydata. com/crunchydata " ,
374+ Version : "5.3.1" ,
379375 },
380376 }
381377
382378 // Create a new HelmChartProxy and install on Cluster 1
383- By ("Creating new HelmChartProxy to install nginx on Cluster 1" , func () {
379+ By ("Creating new HelmChartProxy to install postgres on Cluster 1" , func () {
384380 HelmInstallSpec (ctx , func () HelmInstallInput {
385381 return HelmInstallInput {
386382 BootstrapClusterProxy : bootstrapClusterProxy ,
@@ -392,7 +388,7 @@ var _ = Describe("Workload cluster creation", func() {
392388 })
393389
394390 // Patch Cluster 2 labels to match HelmChartProxy's clusterSelector.
395- By ("Patching Cluster 2 labels to install nginx " , func () {
391+ By ("Patching Cluster 2 labels to install postgres " , func () {
396392 installInput := & HelmInstallInput {
397393 BootstrapClusterProxy : bootstrapClusterProxy ,
398394 Namespace : namespace ,
@@ -415,7 +411,7 @@ var _ = Describe("Workload cluster creation", func() {
415411 })
416412
417413 // Ensure that Helm chart is still installed on Cluster 2.
418- By ("Ensuring that nginx is still installed on Cluster 2" , func () {
414+ By ("Ensuring that postgres is still installed on Cluster 2" , func () {
419415 installInput := & HelmInstallInput {
420416 BootstrapClusterProxy : bootstrapClusterProxy ,
421417 Namespace : namespace ,
0 commit comments