@@ -40,15 +40,11 @@ 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 metallbValues = `prometheus:
44+ scrapeAnnotations: false`
4745
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 }}`
46+ var newMetallbValues = `prometheus:
47+ scrapeAnnotations: true`
5248
5349var _ = Describe ("Workload cluster creation" , func () {
5450 var (
@@ -121,7 +117,7 @@ var _ = Describe("Workload cluster creation", func() {
121117 })
122118
123119 Context ("Creating workload cluster [REQUIRED]" , func () {
124- It ("With default template to install, upgrade, and uninstall nginx Helm chart" , func () {
120+ It ("With default template to install, upgrade, and uninstall metallb Helm chart" , func () {
125121 clusterName = fmt .Sprintf ("%s-%s" , specName , util .RandomString (6 ))
126122 clusterctl .ApplyClusterTemplateAndWait (ctx , createApplyClusterTemplateInput (
127123 specName ,
@@ -136,26 +132,27 @@ var _ = Describe("Workload cluster creation", func() {
136132
137133 hcp := & addonsv1alpha1.HelmChartProxy {
138134 ObjectMeta : metav1.ObjectMeta {
139- Name : "nginx-ingress " ,
135+ Name : "metallb " ,
140136 Namespace : namespace .Name ,
141137 },
142138 Spec : addonsv1alpha1.HelmChartProxySpec {
143139 ClusterSelector : metav1.LabelSelector {
144140 MatchLabels : map [string ]string {
145- "nginxIngress " : "enabled" ,
141+ "MetalLBChart " : "enabled" ,
146142 },
147143 },
148- ReleaseName : "nginx-ingress" ,
149- ReleaseNamespace : "nginx-namespace" ,
150- ChartName : "nginx-ingress" ,
151- RepoURL : "https://helm.nginx.com/stable" ,
152- ValuesTemplate : nginxValues ,
144+ ReleaseName : "metallb-name" ,
145+ ReleaseNamespace : "metallb-namespace" ,
146+ ChartName : "metallb" ,
147+ RepoURL : "https://metallb.github.io/metallb" ,
148+ Version : "0.15.2" ,
149+ ValuesTemplate : metallbValues ,
153150 ReconcileStrategy : string (addonsv1alpha1 .ReconcileStrategyContinuous ),
154151 },
155152 }
156153
157154 // Create new Helm chart
158- By ("Creating new HelmChartProxy to install nginx " , func () {
155+ By ("Creating new HelmChartProxy to install metallb " , func () {
159156 HelmInstallSpec (ctx , func () HelmInstallInput {
160157 return HelmInstallInput {
161158 BootstrapClusterProxy : bootstrapClusterProxy ,
@@ -167,8 +164,8 @@ var _ = Describe("Workload cluster creation", func() {
167164 })
168165
169166 // Update existing Helm chart
170- By ("Updating nginx HelmChartProxy valuesTemplate " , func () {
171- hcp .Spec .ValuesTemplate = newNginxValues
167+ By ("Updating metallb HelmChartProxy valueTemplate " , func () {
168+ hcp .Spec .ValuesTemplate = newMetallbValues
172169 HelmUpgradeSpec (ctx , func () HelmUpgradeInput {
173170 return HelmUpgradeInput {
174171 BootstrapClusterProxy : bootstrapClusterProxy ,
@@ -182,7 +179,7 @@ var _ = Describe("Workload cluster creation", func() {
182179
183180 // Force reinstall of existing Helm chart by changing the release namespace
184181 By ("Updating HelmChartProxy release namespace" , func () {
185- hcp .Spec .ReleaseNamespace = "new-nginx -namespace"
182+ hcp .Spec .ReleaseNamespace = "new-metallb -namespace"
186183 HelmUpgradeSpec (ctx , func () HelmUpgradeInput {
187184 return HelmUpgradeInput {
188185 BootstrapClusterProxy : bootstrapClusterProxy ,
@@ -196,7 +193,7 @@ var _ = Describe("Workload cluster creation", func() {
196193
197194 // Force reinstall of existing Helm chart by changing the release name
198195 By ("Updating HelmChartProxy release name" , func () {
199- hcp .Spec .ReleaseName = "new-nginx -name"
196+ hcp .Spec .ReleaseName = "new-metallb -name"
200197 HelmUpgradeSpec (ctx , func () HelmUpgradeInput {
201198 return HelmUpgradeInput {
202199 BootstrapClusterProxy : bootstrapClusterProxy ,
@@ -223,7 +220,7 @@ var _ = Describe("Workload cluster creation", func() {
223220 })
224221
225222 Context ("Creating workload cluster [REQUIRED]" , func () {
226- It ("With default template to install and orphan an nginx Helm chart with InstallOnce strategy" , func () {
223+ It ("With default template to install and orphan an metallb Helm chart with InstallOnce strategy" , func () {
227224 clusterName = fmt .Sprintf ("%s-%s" , specName , util .RandomString (6 ))
228225 clusterctl .ApplyClusterTemplateAndWait (ctx , createApplyClusterTemplateInput (
229226 specName ,
@@ -238,26 +235,27 @@ var _ = Describe("Workload cluster creation", func() {
238235
239236 hcp := & addonsv1alpha1.HelmChartProxy {
240237 ObjectMeta : metav1.ObjectMeta {
241- Name : "nginx-ingress " ,
238+ Name : "metallb " ,
242239 Namespace : namespace .Name ,
243240 },
244241 Spec : addonsv1alpha1.HelmChartProxySpec {
245242 ClusterSelector : metav1.LabelSelector {
246243 MatchLabels : map [string ]string {
247- "nginxIngress " : "enabled" ,
244+ "MetalLBChart " : "enabled" ,
248245 },
249246 },
250- ReleaseName : "nginx-ingress" ,
251- ReleaseNamespace : "nginx-namespace" ,
252- ChartName : "nginx-ingress" ,
253- RepoURL : "https://helm.nginx.com/stable" ,
254- ValuesTemplate : nginxValues ,
247+ ReleaseName : "metallb-name" ,
248+ ReleaseNamespace : "metallb-namespace" ,
249+ ChartName : "metallb" ,
250+ RepoURL : "https://metallb.github.io/metallb" ,
251+ Version : "0.15.2" ,
252+ ValuesTemplate : metallbValues ,
255253 ReconcileStrategy : string (addonsv1alpha1 .ReconcileStrategyInstallOnce ),
256254 },
257255 }
258256
259257 // Create new Helm chart
260- By ("Creating new HelmChartProxy to install nginx " , func () {
258+ By ("Creating new HelmChartProxy to install metallb " , func () {
261259 HelmInstallSpec (ctx , func () HelmInstallInput {
262260 return HelmInstallInput {
263261 BootstrapClusterProxy : bootstrapClusterProxy ,
@@ -269,8 +267,8 @@ var _ = Describe("Workload cluster creation", func() {
269267 })
270268
271269 // Update existing Helm chart and expect Helm release to remain unchanged
272- By ("Updating nginx HelmChartProxy valuesTemplate" , func () {
273- hcp .Spec .ValuesTemplate = newNginxValues
270+ By ("Updating metallb HelmChartProxy valuesTemplate" , func () {
271+ hcp .Spec .ValuesTemplate = newMetallbValues
274272 HelmReleaseUnchangedSpec (ctx , func () HelmReleaseUnchangedInput {
275273 return HelmReleaseUnchangedInput {
276274 BootstrapClusterProxy : bootstrapClusterProxy ,
@@ -290,7 +288,7 @@ var _ = Describe("Workload cluster creation", func() {
290288 Namespace : namespace ,
291289 ClusterName : clusterName ,
292290 HelmChartProxy : hcp ,
293- Values : []string {fmt .Sprintf ("--controller.name=new-nginx-controller- %d" , i )},
291+ Values : []string {fmt .Sprintf ("--prometheus.metricsPort= %d" , 7470 + i )},
294292 WaitPeriod : installOnceWaitPeriod ,
295293 }
296294 })
@@ -317,7 +315,7 @@ var _ = Describe("Workload cluster creation", func() {
317315 })
318316
319317 Context ("Creating multiple workload clusters [REQUIRED]" , func () {
320- It ("With default template to install and uninstall nginx Helm chart" , func () {
318+ It ("With default template to install and uninstall metallb Helm chart" , func () {
321319 clusterName = fmt .Sprintf ("%s-%s" , specName , util .RandomString (6 ))
322320 clusterctl .ApplyClusterTemplateAndWait (ctx , createApplyClusterTemplateInput (
323321 specName ,
@@ -362,25 +360,26 @@ var _ = Describe("Workload cluster creation", func() {
362360
363361 hcp := & addonsv1alpha1.HelmChartProxy {
364362 ObjectMeta : metav1.ObjectMeta {
365- Name : "nginx-ingress " ,
363+ Name : "metallb " ,
366364 Namespace : namespace .Name ,
367365 },
368366 Spec : addonsv1alpha1.HelmChartProxySpec {
369367 ClusterSelector : metav1.LabelSelector {
370368 MatchLabels : map [string ]string {
371- "nginxIngress " : "enabled" ,
369+ "MetalLBChart " : "enabled" ,
372370 },
373371 },
374- ReleaseName : "nginx-ingress" ,
375- ReleaseNamespace : "nginx-namespace" ,
376- ChartName : "nginx-ingress" ,
377- RepoURL : "https://helm.nginx.com/stable" ,
378- ValuesTemplate : nginxValues ,
372+ ReleaseName : "metallb-name" ,
373+ ReleaseNamespace : "metallb-namespace" ,
374+ ChartName : "metallb" ,
375+ RepoURL : "https://metallb.github.io/metallb" ,
376+ Version : "0.15.2" ,
377+ ValuesTemplate : metallbValues ,
379378 },
380379 }
381380
382381 // Create a new HelmChartProxy and install on Cluster 1
383- By ("Creating new HelmChartProxy to install nginx on Cluster 1" , func () {
382+ By ("Creating new HelmChartProxy to install metallb on Cluster 1" , func () {
384383 HelmInstallSpec (ctx , func () HelmInstallInput {
385384 return HelmInstallInput {
386385 BootstrapClusterProxy : bootstrapClusterProxy ,
@@ -392,7 +391,7 @@ var _ = Describe("Workload cluster creation", func() {
392391 })
393392
394393 // Patch Cluster 2 labels to match HelmChartProxy's clusterSelector.
395- By ("Patching Cluster 2 labels to install nginx " , func () {
394+ By ("Patching Cluster 2 labels to install metallb " , func () {
396395 installInput := & HelmInstallInput {
397396 BootstrapClusterProxy : bootstrapClusterProxy ,
398397 Namespace : namespace ,
@@ -415,7 +414,7 @@ var _ = Describe("Workload cluster creation", func() {
415414 })
416415
417416 // Ensure that Helm chart is still installed on Cluster 2.
418- By ("Ensuring that nginx is still installed on Cluster 2" , func () {
417+ By ("Ensuring that metallb is still installed on Cluster 2" , func () {
419418 installInput := & HelmInstallInput {
420419 BootstrapClusterProxy : bootstrapClusterProxy ,
421420 Namespace : namespace ,
0 commit comments