rke2-charts/packages/rke2-calico/generated-changes/patch/templates/crs/custom-resources.yaml.patch

34 lines
1.5 KiB
Diff
Raw Normal View History

--- charts-original/templates/crs/custom-resources.yaml
+++ charts/templates/crs/custom-resources.yaml
@@ -6,6 +6,30 @@
{{ $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" "cidr" .Values.global.clusterCIDRv6 }}
+{{ $finalIpPoolList := list $myIP6Dict }}
+{{ if not (empty .Values.global.clusterCIDRv4) }}
+{{ $allIpPools := get .Values.installation.calicoNetwork "ipPools" }}
+{{ range $allIpPools }}
+{{ $_ := set . "encapsulation" "None" }}
+{{ end }}
+{{ $finalIpPoolList := append $allIpPools $myIP6Dict }}
+{ end }}
+{{ $calicoNetwork := get .Values.installation "calicoNetwork" }}
+{{ $_ := set $calicoNetwork "ipPools" $finalIpPoolList }}
+{{ $_ := set $calicoNetwork "bgp" "Enabled" }}
+{{ end }}
apiVersion: operator.tigera.io/v1
kind: Installation