Skip to content

Commit 997f8e1

Browse files
committed
WIP: Configure IPv6 for Calico
1 parent 9cabbf9 commit 997f8e1

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

upup/models/cloudup/resources/addons/networking.projectcalico.org/k8s-1.22.yaml.template

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ data:
4949
"mtu": __CNI_MTU__,
5050
"ipam": {
5151
"assign_ipv4": "{{ not IsIPv6Only }}",
52-
"assign_ipv6": "{{ IsIPv6Only }}",
52+
"assign_ipv6": "{{ CalicoUseIPv6 }}",
5353
{{- if IsIPv6Only }}
5454
"type": "host-local",
5555
"ranges": [[{ "subnet": "usePodCidrIPv6" }]]
@@ -4633,7 +4633,7 @@ spec:
46334633
- name: IP
46344634
value: "{{- if not IsIPv6Only -}}autodetect{{- else -}}none{{- end -}}"
46354635
- name: IP6
4636-
value: "{{- if IsIPv6Only -}}autodetect{{- else -}}none{{- end -}}"
4636+
value: "{{- if CalicoUseIPv6 -}}autodetect{{- else -}}none{{- end -}}"
46374637
{{- if IsIPv6Only }}
46384638
- name: IP_AUTODETECTION_METHOD
46394639
value: "{{- or .Networking.Calico.IPv4AutoDetectionMethod "none" }}"
@@ -4680,6 +4680,8 @@ spec:
46804680
{{- else }}
46814681
- name: CALICO_IPV4POOL_CIDR
46824682
value: "{{ .KubeControllerManager.ClusterCIDR }}"
4683+
- name: CALICO_IPV6POOL_NAT_OUTGOING
4684+
value: "{{- CalicoUseIPv6 }}"
46834685
{{- end }}
46844686
# Disable file logging so `kubectl logs` works.
46854687
- name: CALICO_DISABLE_FILE_LOGGING
@@ -4689,7 +4691,7 @@ spec:
46894691
value: "ACCEPT"
46904692
# Set IPv6 on Kubernetes.
46914693
- name: FELIX_IPV6SUPPORT
4692-
value: "{{ IsIPv6Only }}"
4694+
value: "{{ CalicoUseIPv6 }}"
46934695
- name: FELIX_HEALTHENABLED
46944696
value: "true"
46954697

upup/models/cloudup/resources/addons/networking.projectcalico.org/k8s-1.25.yaml.template

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ data:
102102
"mtu": __CNI_MTU__,
103103
"ipam": {
104104
"assign_ipv4": "{{ not IsIPv6Only }}",
105-
"assign_ipv6": "{{ IsIPv6Only }}",
105+
"assign_ipv6": "{{ CalicoUseIPv6 }}",
106106
{{- if IsIPv6Only }}
107107
"type": "host-local",
108108
"ranges": [[{ "subnet": "usePodCidrIPv6" }]]
@@ -4987,7 +4987,7 @@ spec:
49874987
- name: IP
49884988
value: "{{- if not IsIPv6Only -}}autodetect{{- else -}}none{{- end -}}"
49894989
- name: IP6
4990-
value: "{{- if IsIPv6Only -}}autodetect{{- else -}}none{{- end -}}"
4990+
value: "{{- if CalicoUseIPv6 -}}autodetect{{- else -}}none{{- end -}}"
49914991
{{- if IsIPv6Only }}
49924992
- name: IP_AUTODETECTION_METHOD
49934993
value: "{{- or .Networking.Calico.IPv4AutoDetectionMethod "none" }}"
@@ -5034,6 +5034,8 @@ spec:
50345034
{{- else }}
50355035
- name: CALICO_IPV4POOL_CIDR
50365036
value: "{{ .KubeControllerManager.ClusterCIDR }}"
5037+
- name: CALICO_IPV6POOL_NAT_OUTGOING
5038+
value: "{{- CalicoUseIPv6 }}"
50375039
{{- end }}
50385040
# Disable file logging so `kubectl logs` works.
50395041
- name: CALICO_DISABLE_FILE_LOGGING
@@ -5043,7 +5045,7 @@ spec:
50435045
value: "ACCEPT"
50445046
# Set IPv6 on Kubernetes.
50455047
- name: FELIX_IPV6SUPPORT
5046-
value: "{{ IsIPv6Only }}"
5048+
value: "{{ CalicoUseIPv6 }}"
50475049
- name: FELIX_HEALTHENABLED
50485050
value: "true"
50495051

upup/pkg/fi/cloudup/template_functions.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,13 @@ func (tf *TemplateFunctions) AddTo(dest template.FuncMap, secretStore fi.SecretS
301301
}
302302
return "CrossSubnet"
303303
}
304+
dest["CalicoUseIPv6"] = func() bool {
305+
// TODO:
306+
// In the templates this is done:
307+
// value: "{{- or .Networking.Calico.IPv6AutoDetectionMethod "none" }}"
308+
// But doc states that default is "first-found", so this might not work like expected (IPv6 always on)
309+
return cluster.Spec.IsIPv6Only() || (c.IPv6AutoDetectionMethod != "" && c.IPv6AutoDetectionMethod != "none")
310+
}
304311
}
305312

306313
if cluster.Spec.Networking.Cilium != nil {

0 commit comments

Comments
 (0)