Merge pull request #265 from rbrtbnfgl/calico-fix-ipvalue

Fixed calico chart when IPpool configured as value
pull/266/head
Roberto Bonafiglia 2022-05-24 09:48:39 +02:00 committed by GitHub
commit 022d0ba55e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 20 deletions

View File

@ -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 }}

View File

@ -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:

View File

@ -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: