From 190a6bbb7f2bfef5c70f3679f87644ac6c0e64f4 Mon Sep 17 00:00:00 2001 From: Roberto Bonafiglia Date: Mon, 23 May 2022 22:39:35 +0200 Subject: [PATCH] Fixed calico chart when IPpool configured as value Signed-off-by: Roberto Bonafiglia --- .../templates/crs/custom-resources.yaml.patch | 23 +++++++++---------- .../generated-changes/patch/values.yaml.patch | 9 ++------ packages/rke2-calico/package.yaml | 2 +- 3 files changed, 14 insertions(+), 20 deletions(-) diff --git a/packages/rke2-calico/generated-changes/patch/templates/crs/custom-resources.yaml.patch b/packages/rke2-calico/generated-changes/patch/templates/crs/custom-resources.yaml.patch index 207e4d3..96f01ce 100644 --- a/packages/rke2-calico/generated-changes/patch/templates/crs/custom-resources.yaml.patch +++ b/packages/rke2-calico/generated-changes/patch/templates/crs/custom-resources.yaml.patch @@ -1,27 +1,26 @@ --- charts-original/templates/crs/custom-resources.yaml +++ charts/templates/crs/custom-resources.yaml -@@ -6,6 +6,28 @@ +@@ -6,6 +6,27 @@ {{ $secrets = append $secrets $item }} {{ end }} {{ $_ := set $installSpec "imagePullSecrets" $secrets }} +{{ $defaultRegistry := get $installSpec "registry" }} +{{ $finalRegistry := coalesce .Values.global.systemDefaultRegistry $defaultRegistry }} +{{ $_ := set $installSpec "registry" $finalRegistry }} -+{{ $defaultipPools := get .Values.installation.calicoNetwork "ipPools" | first }} -+{{ $defaultCIDR := get $defaultipPools "cidr" }} -+{{ $finalCIDR := coalesce .Values.global.clusterCIDRv4 $defaultCIDR }} -+{{ $_ := set $defaultipPools "cidr" $finalCIDR }} -+{{- /* -+If there is a defined ipv6 CIDR, we must add it as a new IPPool, disable any encapsulation and enable bgp -+*/}} -+{{ if not (empty .Values.global.clusterCIDRv6) }} -+{{ $myIP6Dict := dict "natOutgoing" "Enabled" "encapsulation" "VXLAN" "cidr" .Values.global.clusterCIDRv6 }} ++{{ if empty .Values.installation.calicoNetwork.ipPools }} +{{ $calicoNetwork := get .Values.installation "calicoNetwork" }} +{{ if not (empty .Values.global.clusterCIDRv4) }} -+{{ $allIpPools := get .Values.installation.calicoNetwork "ipPools" }} -+{{ $finalIpPoolList := append $allIpPools $myIP6Dict }} ++{{ $myIP4Dict := dict "natOutgoing" "Enabled" "encapsulation" "VXLAN" "cidr" .Values.global.clusterCIDRv4 }} ++{{ if not (empty .Values.global.clusterCIDRv6) }} ++{{ $myIP6Dict := dict "natOutgoing" "Enabled" "encapsulation" "VXLAN" "cidr" .Values.global.clusterCIDRv6 }} ++{{ $finalIpPoolList := append $myIP4Dict $myIP6Dict }} +{{ $_ := set $calicoNetwork "ipPools" $finalIpPoolList }} +{{ else }} ++{{ $finalIpPoolList := list $myIP4Dict }} ++{{ $_ := set $calicoNetwork "ipPools" $finalIpPoolList }} ++{{ end }} ++{{ else if not (empty .Values.global.clusterCIDRv6) }} ++{{ $myIP6Dict := dict "natOutgoing" "Enabled" "encapsulation" "VXLAN" "cidr" .Values.global.clusterCIDRv6 }} +{{ $finalIpPoolList := list $myIP6Dict }} +{{ $_ := set $calicoNetwork "ipPools" $finalIpPoolList }} +{{ end }} diff --git a/packages/rke2-calico/generated-changes/patch/values.yaml.patch b/packages/rke2-calico/generated-changes/patch/values.yaml.patch index d3ee670..61eae3c 100644 --- a/packages/rke2-calico/generated-changes/patch/values.yaml.patch +++ b/packages/rke2-calico/generated-changes/patch/values.yaml.patch @@ -1,6 +1,6 @@ --- charts-original/values.yaml +++ charts/values.yaml -@@ -1,11 +1,28 @@ +@@ -1,11 +1,23 @@ imagePullSecrets: {} installation: @@ -15,11 +15,6 @@ kubernetesProvider: "" + calicoNetwork: + bgp: Disabled -+ ipPools: -+ - natOutgoing: Enabled -+ encapsulation: VXLAN -+ cidr: 10.42.0.0/16 -+ blockSize: 24 + imagePath: "rancher" + imagePrefix: "mirrored-calico-" + flexVolumePath: "/var/lib/kubelet/volumeplugins/" @@ -30,7 +25,7 @@ certs: node: -@@ -22,9 +39,25 @@ +@@ -22,9 +34,25 @@ # Configuration for the tigera operator tigeraOperator: diff --git a/packages/rke2-calico/package.yaml b/packages/rke2-calico/package.yaml index b00e0a3..3d61661 100644 --- a/packages/rke2-calico/package.yaml +++ b/packages/rke2-calico/package.yaml @@ -1,5 +1,5 @@ url: https://github.com/projectcalico/calico/releases/download/v3.23.1/tigera-operator-v3.23.1.tgz -packageVersion: 01 +packageVersion: 02 additionalCharts: - workingDir: charts-crd crdOptions: