Skip to content

Commit d5665a8

Browse files
committed
feat: cilium configuration overrides for EKS provider
1 parent 936bbec commit d5665a8

File tree

3 files changed

+31
-4
lines changed

3 files changed

+31
-4
lines changed

charts/cluster-api-runtime-extensions-nutanix/addons/cni/cilium/values-template.yaml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,14 @@ hubble:
1818
image:
1919
useDigest: false
2020
priorityClassName: system-cluster-critical
21+
{{- $capiProvider := index .Cluster.Labels "cluster.x-k8s.io/provider" }}
22+
{{- if eq $capiProvider "eks" }}
23+
ipam:
24+
mode: eni
25+
{{- else }}
2126
ipam:
2227
mode: kubernetes
28+
{{- end }}
2329
image:
2430
useDigest: false
2531
operator:
@@ -33,7 +39,25 @@ socketLB:
3339
envoy:
3440
image:
3541
useDigest: false
36-
k8sServiceHost: auto
42+
3743
{{- if .EnableKubeProxyReplacement }}
3844
kubeProxyReplacement: true
3945
{{- end }}
46+
47+
{{- if eq $capiProvider "eks" }}
48+
k8sServiceHost: "{{ trimPrefix "https://" .Cluster.spec.controlPlaneEndpoint.host }}"
49+
k8sServicePort: "{{ .Cluster.spec.controlPlaneEndpoint.port }}"
50+
{{- else }}
51+
k8sServiceHost: auto
52+
{{- end }}
53+
54+
{{- if eq $capiProvider "eks" }}
55+
enableIPv4Masquerade: false
56+
eni:
57+
enabled: true
58+
awsReleaseExcessIPs: true
59+
routingMode: native
60+
endpointRoutes:
61+
enabled: true
62+
{{- end }}
63+

common/pkg/capi/utils/annotations.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@ import (
88
controlplanev1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1beta1"
99
)
1010

11-
// ShouldSkipKubeProxy returns true if the cluster is configured to skip kube proxy installation.
11+
// ShouldSkipKubeProxy returns true if the cluster is configured to skip kube proxy installation
12+
// or if the cluster is an EKS cluster where kube proxy is always disabled on AWSManagedControlPlaneTemplate.
1213
func ShouldSkipKubeProxy(cluster *clusterv1.Cluster) bool {
1314
if cluster.Spec.Topology != nil {
14-
_, isSkipKubeProxy := cluster.Spec.Topology.ControlPlane.Metadata.Annotations[controlplanev1.SkipKubeProxyAnnotation]
15-
return isSkipKubeProxy
15+
_, isSkipKubeProxyAnnotation := cluster.Spec.Topology.ControlPlane.Metadata.Annotations[controlplanev1.SkipKubeProxyAnnotation]
16+
return isSkipKubeProxyAnnotation
1617
}
1718
return false
1819
}

pkg/handlers/generic/lifecycle/cni/cilium/template.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,13 @@ func templateValues(cluster *clusterv1.Cluster, text string) (string, error) {
2121
}
2222

2323
type input struct {
24+
Cluster *clusterv1.Cluster
2425
EnableKubeProxyReplacement bool
2526
}
2627

2728
// Assume when kube-proxy is skipped, we should enable Cilium's kube-proxy replacement feature.
2829
templateInput := input{
30+
Cluster: cluster,
2931
EnableKubeProxyReplacement: capiutils.ShouldSkipKubeProxy(cluster),
3032
}
3133

0 commit comments

Comments
 (0)