Skip to content

Commit

Permalink
WIP: Configure IPv6 for Calico
Browse files Browse the repository at this point in the history
  • Loading branch information
ederst committed Sep 28, 2024
1 parent 0cda1b8 commit 8e4a222
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ data:
"mtu": __CNI_MTU__,
"ipam": {
"assign_ipv4": "{{ not IsIPv6Only }}",
"assign_ipv6": "{{ IsIPv6Only }}",
"assign_ipv6": "{{ CalicoUseIPv6 }}",
{{- if IsIPv6Only }}
"type": "host-local",
"ranges": [[{ "subnet": "usePodCidrIPv6" }]]
Expand Down Expand Up @@ -4633,7 +4633,7 @@ spec:
- name: IP
value: "{{- if not IsIPv6Only -}}autodetect{{- else -}}none{{- end -}}"
- name: IP6
value: "{{- if IsIPv6Only -}}autodetect{{- else -}}none{{- end -}}"
value: "{{- if CalicoUseIPv6 -}}autodetect{{- else -}}none{{- end -}}"
{{- if IsIPv6Only }}
- name: IP_AUTODETECTION_METHOD
value: "{{- or .Networking.Calico.IPv4AutoDetectionMethod "none" }}"
Expand Down Expand Up @@ -4680,6 +4680,8 @@ spec:
{{- else }}
- name: CALICO_IPV4POOL_CIDR
value: "{{ .KubeControllerManager.ClusterCIDR }}"
- name: CALICO_IPV6POOL_NAT_OUTGOING
value: "{{- CalicoUseIPv6 }}"
{{- end }}
# Disable file logging so `kubectl logs` works.
- name: CALICO_DISABLE_FILE_LOGGING
Expand All @@ -4689,7 +4691,7 @@ spec:
value: "ACCEPT"
# Set IPv6 on Kubernetes.
- name: FELIX_IPV6SUPPORT
value: "{{ IsIPv6Only }}"
value: "{{ CalicoUseIPv6 }}"
- name: FELIX_HEALTHENABLED
value: "true"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ data:
"mtu": __CNI_MTU__,
"ipam": {
"assign_ipv4": "{{ not IsIPv6Only }}",
"assign_ipv6": "{{ IsIPv6Only }}",
"assign_ipv6": "{{ CalicoUseIPv6 }}",
{{- if IsIPv6Only }}
"type": "host-local",
"ranges": [[{ "subnet": "usePodCidrIPv6" }]]
Expand Down Expand Up @@ -4987,7 +4987,7 @@ spec:
- name: IP
value: "{{- if not IsIPv6Only -}}autodetect{{- else -}}none{{- end -}}"
- name: IP6
value: "{{- if IsIPv6Only -}}autodetect{{- else -}}none{{- end -}}"
value: "{{- if CalicoUseIPv6 -}}autodetect{{- else -}}none{{- end -}}"
{{- if IsIPv6Only }}
- name: IP_AUTODETECTION_METHOD
value: "{{- or .Networking.Calico.IPv4AutoDetectionMethod "none" }}"
Expand Down Expand Up @@ -5034,6 +5034,8 @@ spec:
{{- else }}
- name: CALICO_IPV4POOL_CIDR
value: "{{ .KubeControllerManager.ClusterCIDR }}"
- name: CALICO_IPV6POOL_NAT_OUTGOING
value: "{{- CalicoUseIPv6 }}"
{{- end }}
# Disable file logging so `kubectl logs` works.
- name: CALICO_DISABLE_FILE_LOGGING
Expand All @@ -5043,7 +5045,7 @@ spec:
value: "ACCEPT"
# Set IPv6 on Kubernetes.
- name: FELIX_IPV6SUPPORT
value: "{{ IsIPv6Only }}"
value: "{{ CalicoUseIPv6 }}"
- name: FELIX_HEALTHENABLED
value: "true"

Expand Down
7 changes: 7 additions & 0 deletions upup/pkg/fi/cloudup/template_functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,13 @@ func (tf *TemplateFunctions) AddTo(dest template.FuncMap, secretStore fi.SecretS
}
return "CrossSubnet"
}
dest["CalicoUseIPv6"] = func() bool {
// TODO:
// In the templates this is done:
// value: "{{- or .Networking.Calico.IPv6AutoDetectionMethod "none" }}"
// But doc states that default is "first-found", so this might not work like expected (IPv6 always on)
return cluster.Spec.IsIPv6Only() || (c.IPv6AutoDetectionMethod != "" && c.IPv6AutoDetectionMethod != "none")
}
}

if cluster.Spec.Networking.Cilium != nil {
Expand Down

0 comments on commit 8e4a222

Please sign in to comment.