Skip to content

Commit 9827acd

Browse files
committed
feat(t8s-cluster/cilium): enable kubeProxy replacement
1 parent e984d19 commit 9827acd

5 files changed

Lines changed: 59 additions & 11 deletions

File tree

charts/t8s-cluster/templates/management-cluster/clusterClass/_helpers.tpl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,13 @@ server = {{ printf "https://%s" .registry | quote }}
145145
{{- end }}
146146

147147
{{- define "t8s-cluster.clusterClass.args.controllerManager" -}}
148+
{{- $_ := mustMerge . (pick .context "Values") -}}
148149
{{- $args := include "t8s-cluster.clusterClass.args.shared" (dict) | fromYaml -}}
149150
{{- $args = mustMerge (include "t8s-cluster.clusterClass.args.sharedController" (dict "context" .context) | fromYaml) $args -}}
150151
{{- $args = set $args "terminated-pod-gc-threshold" "100" -}}
152+
{{- if .Values.controlPlane.hosted -}}
153+
{{- $args = set $args "allocate-node-cidrs" "true" -}}
154+
{{- end }}
151155
{{- toYaml $args -}}
152156
{{- end }}
153157

charts/t8s-cluster/templates/management-cluster/clusterClass/hostedControlPlaneTemplate/_hostedControlPlaneTemplateSpec.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ deployment:
6565
args: {{- include "t8s-cluster.clusterClass.args.scheduler" (dict) | nindent 6 }}
6666
resources: {{- include "common.resources" .Values.controlPlane | nindent 6 }}
6767
replicas: 1
68+
kubeProxy:
69+
disabled: {{ .Values.controlPlane.hosted }}
6870
gateway:
6971
namespace: capi-hosted-control-plane-system
7072
name: controlplane

charts/t8s-cluster/templates/management-cluster/clusterClass/openStackClusterTemplate/_openStackClusterTemplateSpec.yaml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ identityRef:
5252
{{- $cniSecurityGroupRules = set $cniSecurityGroupRules "VXLAN" (dict "port" 8472 "protocol" "udp") -}}
5353
{{- $cniSecurityGroupRules = set $cniSecurityGroupRules "health (http)" (dict "port" 4240) -}}
5454
{{- $cniSecurityGroupRules = set $cniSecurityGroupRules "health (ping)" (dict "protocol" "icmp") -}}
55+
{{- if .Values.controlPlane.hosted -}}
56+
{{- $cniSecurityGroupRules = set $cniSecurityGroupRules "allow pod-pod native routing (ingress)" (dict "remoteIPPrefix" "10.0.0.0/16" "protocol" nil) -}}
57+
{{- $cniSecurityGroupRules = set $cniSecurityGroupRules "allow node-pod native routing (ingress)" (dict "remoteIPPrefix" "10.6.0.0/16" "protocol" nil) -}}
58+
{{- end -}}
5559
{{- end }}
5660
{{- range $name, $securityGroupRule := $cniSecurityGroupRules -}}
5761
{{- $securityGroupRules = set $securityGroupRules (printf "%s %s" $cni $name) $securityGroupRule -}}
@@ -97,17 +101,18 @@ identityRef:
97101
"description" ($securityGroupRule.description | default $name)
98102
"direction" "ingress"
99103
"etherType" "IPv4"
100-
"protocol" ($securityGroupRule.protocol | default "tcp")
104+
"protocol" (hasKey $securityGroupRule "protocol" | ternary $securityGroupRule.protocol "tcp")
101105
-}}
102-
{{- if hasKey $securityGroupRule "remoteGroupID" -}}
103-
{{- $_securityGroupRule = set $_securityGroupRule "remoteGroupID" $securityGroupRule.remoteGroupID -}}
104-
{{- end -}}
105106
{{- if or (hasKey $securityGroupRule "port") (and (hasKey $securityGroupRule "portMin") (hasKey $securityGroupRule "portMax")) -}}
106107
{{- $_securityGroupRule = set $_securityGroupRule "portRangeMin" ($securityGroupRule.portMin | default $securityGroupRule.port) -}}
107108
{{- $_securityGroupRule = set $_securityGroupRule "portRangeMax" ($securityGroupRule.portMax | default $securityGroupRule.port) -}}
108109
{{- end -}}
109-
{{- if hasKey $securityGroupRule "remoteManagedGroups" -}}
110+
{{- if hasKey $securityGroupRule "remoteGroupID" -}}
111+
{{- $_securityGroupRule = set $_securityGroupRule "remoteGroupID" $securityGroupRule.remoteGroupID -}}
112+
{{- else if hasKey $securityGroupRule "remoteManagedGroups" -}}
110113
{{- $_securityGroupRule = set $_securityGroupRule "remoteManagedGroups" $securityGroupRule.remoteManagedGroups -}}
114+
{{- else if hasKey $securityGroupRule "remoteIPPrefix" -}}
115+
{{- $_securityGroupRule = set $_securityGroupRule "remoteIPPrefix" $securityGroupRule.remoteIPPrefix -}}
111116
{{- else -}}
112117
{{- $_securityGroupRule = set $_securityGroupRule "remoteManagedGroups" $allRemoteManagedGroups -}}
113118
{{- end -}}

charts/t8s-cluster/templates/management-cluster/clusterClass/openStackMachineTemplates/_openstackMachineTemplateSpec.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ Here we are generating a hash suffix.
55
{{- define "t8s-cluster.clusterClass.openStackMachineTemplate.spec" -}}
66
{{- $_ := mustMerge . (pick .context "Values") -}}
77
flavor: {{ eq .name "control-plane" | ternary .Values.controlPlane.flavor "compute-plane-placeholder" | required "flavor is required" }}
8+
{{- if .Values.controlPlane.hosted }}
9+
ports:
10+
- allowedAddressPairs:
11+
- ipAddress: 10.0.0.0/16
12+
{{- end }}
813
image:
914
filter:
1015
name: placeholder

charts/t8s-cluster/templates/workload-cluster/cni-cilium.yaml

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,45 @@ spec:
2727
values:
2828
nodePort:
2929
enabled: true
30-
# enable eBPF based routing instead of iptables
30+
{{- if .Values.controlPlane.hosted }}
3131
bpf:
32-
masquerade: false # disable for now as this creates routing problems
32+
masquerade: true
33+
tproxy: true
34+
enableTCX: true
35+
endpointRoutes:
36+
enabled: true
37+
bandwidthManager:
38+
enabled: true
3339
egressGateway:
34-
enabled: false # disable for now as this depends on bpf.masquerade
35-
# enable eBPF bases host routing
36-
# currently not really possible with CAPI, as they don't support disabling the built-in kube-proxy
37-
# kubeProxyReplacement: strict
40+
enabled: true
41+
# currently not really possible with kubeadmcontrolplane, as they don't support disabling the built-in kube-proxy
42+
kubeProxyReplacement: true
43+
ipam:
44+
mode: kubernetes
45+
routingMode: native
46+
autoDirectNodeRoutes: true
47+
directRoutingSkipUnreachable: true
48+
localRedirectPolicies:
49+
enabled: true
50+
k8s:
51+
requireIPv4PodCIDR: true
52+
{{- $gateway := lookup "gateway.networking.k8s.io/v1" "Gateway" "capi-hosted-control-plane-system" "controlplane" -}}
53+
{{- if not $gateway -}}
54+
{{- fail "Hosted control plane Gateway 'controlplane' in namespace 'capi-hosted-control-plane-system' not found" -}}
55+
{{- else }}
56+
k8sServiceHost: {{ printf "%s.%s.%s" .Release.Name .Release.Namespace (replace "*." "" (index $gateway.spec.listeners 0).hostname) }}
57+
{{- end }}
58+
k8sServicePort: 443
59+
ipv4NativeRoutingCIDR: 10.0.0.0/16 # default net, see hosted control plane controller
60+
{{- end }}
3861

3962
rollOutCiliumPods: true
4063
encryption:
4164
enabled: false
4265
nodeEncryption: false
66+
envoy:
67+
prometheus:
68+
enabled: true
4369
hubble:
4470
metrics:
4571
enabled:
@@ -57,6 +83,12 @@ spec:
5783
ui:
5884
rollOutPods: true
5985
enabled: true
86+
export:
87+
static:
88+
enabled: true
89+
filePath: stdout
90+
allowList:
91+
- '{"verdict":["DROPPED","ERROR"]}'
6092
operator:
6193
rollOutPods: true
6294
prometheus:

0 commit comments

Comments
 (0)