Skip to content

Commit f1f6073

Browse files
Merge pull request #2878 from Nordix/peppi-lotta/fix-podcidr-replace-in-calico-manifest
🌱 Fix PodCIDR replace in Calico manifest
2 parents b91fe68 + e31ea89 commit f1f6073

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

test/e2e/config/e2e_conf.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ variables:
275275

276276
PROVIDER_ID_FORMAT: "metal3://{{ ds.meta_data.providerid }}"
277277
# Pin Calico version
278-
CALICO_PATCH_RELEASE: "v3.25.2"
278+
CALICO_VERSION: "${CALICO_VERSION:-v3.30.3}"
279279
# Pin CertManager for upgrade tests
280280
CERT_MANAGER_RELEASE: v1.17.1
281281
# Default vars for the template, those values could be overridden by the env-vars.

test/e2e/e2e_suite_test.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ func validateGlobals(specName string) {
265265
}
266266

267267
func updateCalico(config *clusterctl.E2EConfig, calicoYaml, calicoInterface string) {
268-
calicoManifestURL := fmt.Sprintf("https://raw.githubusercontent.com/projectcalico/calico/%s/manifests/calico.yaml", config.MustGetVariable("CALICO_PATCH_RELEASE"))
268+
calicoManifestURL := fmt.Sprintf("https://raw.githubusercontent.com/projectcalico/calico/%s/manifests/calico.yaml", config.MustGetVariable("CALICO_VERSION"))
269269
err := DownloadFile(calicoYaml, calicoManifestURL)
270270
Expect(err).ToNot(HaveOccurred(), "Unable to download Calico manifest")
271271
cniYaml, err := os.ReadFile(calicoYaml)
@@ -274,8 +274,10 @@ func updateCalico(config *clusterctl.E2EConfig, calicoYaml, calicoInterface stri
274274
Logf("Replace the default CIDR with the one set in $POD_CIDR")
275275
podCIDR := config.MustGetVariable("POD_CIDR")
276276
calicoContainerRegistry := config.MustGetVariable("DOCKER_HUB_PROXY")
277-
cniYaml = []byte(strings.Replace(string(cniYaml), "192.168.0.0/16", podCIDR, -1))
278-
cniYaml = []byte(strings.Replace(string(cniYaml), "docker.io", calicoContainerRegistry, -1))
277+
// Uncomment the CALICO_IPV4POOL_CIDR environment variable
278+
cniYaml = []byte(strings.ReplaceAll(string(cniYaml), "# - name: CALICO_IPV4POOL_CIDR", "- name: CALICO_IPV4POOL_CIDR"))
279+
cniYaml = []byte(strings.ReplaceAll(string(cniYaml), "# value: \"192.168.0.0/16\"", " value: \""+podCIDR+"\""))
280+
cniYaml = []byte(strings.ReplaceAll(string(cniYaml), "docker.io", calicoContainerRegistry))
279281

280282
yamlDocuments, err := splitYAML(cniYaml)
281283
Expect(err).ToNot(HaveOccurred(), "Cannot unmarshal the calico yaml elements to golang objects")

0 commit comments

Comments
 (0)