Skip to content
This repository was archived by the owner on Mar 18, 2025. It is now read-only.

Commit 23ecfff

Browse files
committed
double confirm with cilium install, cilium connectivity test and sonobuoy run --mode=certified-conformance
helm template cilium cilium/cilium \ --version 1.11.4 \ --namespace kube-system \ --set bpf.preallocateMaps=false \ --set cluster.id=0 \ --set cluster.name=4e8b0505-4c52-57ab-a7f4-481e7ed3a2e3 \ --set cni.binPath=/usr/libexec/cni \ --set cni.chainingMode=none \ --set cni.exclusive=true \ --set externalIPs.enabled=true \ --set hostPort.enabled=true \ --set hostServices.enabled=true \ --set hubble.enabled=false \ --set ipam.mode=cluster-pool \ --set ipam.operator.clusterPoolIPv4MaskSize=24 \ --set ipam.operator.clusterPoolIPv4PodCIDRList=10.233.64.0/18 \ --set ipv4.enabled=true \ --set ipv6.enabled=false \ --set kubeProxyReplacement=probe \ --set nodePort.enabled=true \ --set nodeinit.enabled=true \ --set operator.replicas=1 \ --set tunnel=vxlan \ | yq . > templates/etc/kubernetes/addons/60-cilium.yml.j2 Signed-off-by: Wong Hoi Sing Edison <[email protected]>
1 parent 9c316ef commit 23ecfff

File tree

2 files changed

+56
-14
lines changed

2 files changed

+56
-14
lines changed

defaults/main.yml

+12-5
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,19 @@
1515
# limitations under the License.
1616

1717
# Enable native IP masquerade support in eBPF.
18-
kube_cilium_bpf_masquerade: false
18+
kube_cilium_bpf_masquerade: ~
1919

2020
# Enables pre-allocation of eBPF map values. This increases memory usage
2121
# but can reduce latency.
2222
kube_cilium_bpf_preallocatemaps: false
2323

24+
# Unique ID of the cluster. Must be unique across all connected clusters
25+
# and in the range of 1 to 255. Only required for Cluster Mesh.
26+
kube_cilium_cluster_id: "0"
27+
28+
# Name of the cluster. Only required for Cluster Mesh.
29+
kube_cilium_cluster_name: "{{ hostvars[groups['kube_master'][0]].ansible_machine_id | to_uuid }}"
30+
2431
# Configure the path to the CNI binary directory on the host.
2532
kube_cilium_cni_binpath: "/usr/libexec/cni"
2633

@@ -35,10 +42,10 @@ kube_cilium_cni_exclusive: true
3542

3643
# Enable use of per endpoint routes instead of routing via the
3744
# cilium_host interface.
38-
kube_cilium_endpointroutes_enabled: false
45+
kube_cilium_endpointroutes_enabled: ~
3946

4047
# Enable ExternalIPs service support.
41-
kube_cilium_externalIPs_enabled: true
48+
kube_cilium_externalips_enabled: true
4249

4350
# Enable hostPort service support.
4451
kube_cilium_hostport_enabled: true
@@ -50,7 +57,7 @@ kube_cilium_hostservices_enabled: true
5057
kube_cilium_hubble_enabled: false
5158

5259
# Configure IP Address Management mode.
53-
kube_cilium_ipam_mode: "kubernetes"
60+
kube_cilium_ipam_mode: "cluster-pool"
5461

5562
# IPv4 CIDR mask size to delegate to individual nodes for IPAM.
5663
kube_cilium_ipam_operator_clusterpoolipv4masksize: "24"
@@ -69,7 +76,7 @@ kube_cilium_ipv6_enabled: false
6976

7077
# Enables waiting for Kubernetes to provide the PodCIDR range via the
7178
# Kubernetes node resource.
72-
kube_cilium_k8s_requireipv4podcidr: true
79+
kube_cilium_k8s_requireipv4podcidr: ~
7380

7481
# Controls how to enable kube-proxy replacement features in BPF datapath.
7582
kube_cilium_kubeproxyreplacement: "probe"

templates/etc/kubernetes/addons/60-cilium.yml.j2

+44-9
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,10 @@ data:
124124
# container image names
125125
sidecar-istio-proxy-image: "cilium/istio_proxy"
126126
# Name of the cluster. Only relevant when building a mesh of clusters.
127-
cluster-name: default
127+
cluster-name: "{{ kube_cilium_cluster_name }}"
128128
# Unique ID of the cluster. Must be unique across all conneted clusters and
129129
# in the range of 1 and 255. Only relevant when building a mesh of clusters.
130-
cluster-id: ""
130+
cluster-id: "{{ kube_cilium_cluster_id }}"
131131
# Encapsulation mode for communication between nodes
132132
# Possible values:
133133
# - disabled
@@ -146,33 +146,56 @@ data:
146146
cni-chaining-mode: "{{ kube_cilium_cni_chainingmode }}"
147147
enable-ipv4-masquerade: "true"
148148
enable-ipv6-masquerade: "true"
149+
{% if kube_cilium_bpf_masquerade %}
149150
enable-bpf-masquerade: "{{ kube_cilium_bpf_masquerade | bool | lower }}"
151+
{% endif %}
150152
enable-xt-socket-fallback: "true"
151153
install-iptables-rules: "true"
152154
install-no-conntrack-iptables-rules: "false"
153155
auto-direct-node-routes: "false"
154156
enable-bandwidth-manager: "false"
155157
enable-local-redirect-policy: "false"
158+
{% if kube_cilium_tunnel == "disabled" %}
156159
ipv4-native-routing-cidr: "{{ kube_cilium_ipv4nativeroutingcidr }}"
160+
{% endif %}
157161
kube-proxy-replacement: "{{ kube_cilium_kubeproxyreplacement }}"
162+
{% if kube_cilium_kubeproxyreplacement != "disabled" %}
158163
kube-proxy-replacement-healthz-bind-address: ""
164+
{% endif %}
165+
{% if kube_cilium_hostservices_enabled %}
159166
enable-host-reachable-services: "{{ kube_cilium_hostservices_enabled | bool | lower }}"
167+
{% endif %}
168+
{% if kube_cilium_hostport_enabled %}
169+
enable-host-port: "{{ kube_cilium_hostport_enabled | bool | lower }}"
170+
{% endif %}
171+
{% if kube_cilium_externalips_enabled %}
172+
enable-external-ips: "{{ kube_cilium_externalips_enabled | bool | lower }}"
173+
{% endif %}
174+
{% if kube_cilium_nodeport_enabled %}
175+
enable-node-port: "{{ kube_cilium_nodeport_enabled | bool | lower }}"
176+
{% endif %}
160177
enable-health-check-nodeport: "true"
161178
node-port-bind-protection: "true"
162179
enable-auto-protect-node-port-range: "true"
163180
enable-session-affinity: "true"
164181
enable-l2-neigh-discovery: "true"
165182
arping-refresh-period: "30s"
183+
{% if kube_cilium_k8s_requireipv4podcidr %}
166184
k8s-require-ipv4-pod-cidr: "{{ kube_cilium_k8s_requireipv4podcidr | bool | lower }}"
185+
{% endif %}
186+
{% if kube_cilium_endpointroutes_enabled %}
167187
enable-endpoint-routes: "{{ kube_cilium_endpointroutes_enabled | bool | lower }}"
188+
{% endif %}
168189
enable-endpoint-health-checking: "true"
169190
enable-health-checking: "true"
170191
enable-well-known-identities: "false"
171192
enable-remote-node-identity: "true"
172193
operator-api-serve-addr: "127.0.0.1:9234"
173194
ipam: "{{ kube_cilium_ipam_mode }}"
195+
{% if kube_cilium_ipam_mode == "cluster-pool" %}
174196
cluster-pool-ipv4-cidr: "{{ kube_cilium_ipam_operator_clusterpoolipv4podcidrlist }}"
175197
cluster-pool-ipv4-mask-size: "{{ kube_cilium_ipam_operator_clusterpoolipv4masksize }}"
198+
{% endif %}
176199
disable-cnp-status-updates: "true"
177200
cgroup-root: "/run/cilium/cgroupv2"
178201
enable-k8s-terminating-endpoint: "true"
@@ -429,13 +452,14 @@ metadata:
429452
name: cilium
430453
namespace: kube-system
431454
labels:
455+
k8s-app: cilium
432456
app.kubernetes.io/name: cilium
433457
app.kubernetes.io/part-of: kube-system
434458
addonmanager.kubernetes.io/mode: Reconcile
435459
spec:
436460
selector:
437461
matchLabels:
438-
app.kubernetes.io/name: cilium
462+
k8s-app: cilium
439463
updateStrategy:
440464
rollingUpdate:
441465
maxUnavailable: 2
@@ -449,7 +473,7 @@ spec:
449473
# https://kubernetes.io/docs/tasks/administer-cluster/guaranteed-scheduling-critical-addon-pods/
450474
scheduler.alpha.kubernetes.io/critical-pod: ""
451475
labels:
452-
app.kubernetes.io/name: cilium
476+
k8s-app: cilium
453477
spec:
454478
affinity:
455479
nodeAffinity:
@@ -469,7 +493,7 @@ spec:
469493
requiredDuringSchedulingIgnoredDuringExecution:
470494
- labelSelector:
471495
matchExpressions:
472-
- key: app.kubernetes.io/name
496+
- key: k8s-app
473497
operator: In
474498
values:
475499
- cilium
@@ -611,6 +635,7 @@ spec:
611635
mountPath: /hostbin
612636
securityContext:
613637
privileged: true
638+
{% if kube_cilium_nodeinit_enabled == true %}
614639
- name: wait-for-node-init
615640
image: quay.io/cilium/cilium:v1.11.4
616641
imagePullPolicy: IfNotPresent
@@ -625,6 +650,7 @@ spec:
625650
volumeMounts:
626651
- name: cilium-bootstrap-file-dir
627652
mountPath: "/tmp/cilium-bootstrap.d"
653+
{% endif %}
628654
- name: clean-cilium-state
629655
image: quay.io/cilium/cilium:v1.11.4
630656
imagePullPolicy: IfNotPresent
@@ -705,10 +731,12 @@ spec:
705731
hostPath:
706732
path: /run/xtables.lock
707733
type: FileOrCreate
734+
{% if kube_cilium_nodeinit_enabled == true %}
708735
- name: cilium-bootstrap-file-dir
709736
hostPath:
710737
path: "/tmp/cilium-bootstrap.d"
711738
type: DirectoryOrCreate
739+
{% endif %}
712740
# To read the clustermesh configuration
713741
- name: clustermesh-secrets
714742
secret:
@@ -721,6 +749,7 @@ spec:
721749
configMap:
722750
name: cilium-config
723751

752+
{% if kube_cilium_nodeinit_enabled == true %}
724753
---
725754
# Source: cilium/templates/cilium-nodeinit/daemonset.yaml
726755
kind: DaemonSet
@@ -729,18 +758,19 @@ metadata:
729758
name: cilium-node-init
730759
namespace: kube-system
731760
labels:
761+
app: cilium-node-init
732762
app.kubernetes.io/name: cilium-node-init
733763
app.kubernetes.io/part-of: kube-system
734764
addonmanager.kubernetes.io/mode: Reconcile
735765
spec:
736766
selector:
737767
matchLabels:
738-
app.kubernetes.io/name: cilium-node-init
768+
app: cilium-node-init
739769
template:
740770
metadata:
741771
annotations:
742772
labels:
743-
app.kubernetes.io/name: cilium-node-init
773+
app: cilium-node-init
744774
spec:
745775
tolerations:
746776
- operator: Exists
@@ -789,6 +819,7 @@ spec:
789819
mkdir -p "/tmp/cilium-bootstrap.d"
790820
date > "/tmp/cilium-bootstrap.d/cilium-bootstrap-time"
791821
echo "Node initialization complete"
822+
{% endif %}
792823

793824
---
794825
# Source: cilium/templates/cilium-operator/deployment.yaml
@@ -798,6 +829,8 @@ metadata:
798829
name: cilium-operator
799830
namespace: kube-system
800831
labels:
832+
io.cilium/app: operator
833+
name: cilium-operator
801834
app.kubernetes.io/name: cilium-operator
802835
app.kubernetes.io/part-of: kube-system
803836
addonmanager.kubernetes.io/mode: Reconcile
@@ -807,7 +840,8 @@ spec:
807840
replicas: {{ kube_cilium_operator_replicas }}
808841
selector:
809842
matchLabels:
810-
app.kubernetes.io/name: cilium-operator
843+
io.cilium/app: operator
844+
name: cilium-operator
811845
strategy:
812846
rollingUpdate:
813847
maxSurge: 1
@@ -817,7 +851,8 @@ spec:
817851
metadata:
818852
annotations:
819853
labels:
820-
app.kubernetes.io/name: cilium-operator
854+
io.cilium/app: operator
855+
name: cilium-operator
821856
spec:
822857
# In HA mode, cilium-operator pods must not be scheduled on the same
823858
# node as they will clash with each other.

0 commit comments

Comments
 (0)