Skip to content

Commit

Permalink
update cilium to v1.12.0
Browse files Browse the repository at this point in the history
  • Loading branch information
DockToFuture committed Jul 22, 2022
1 parent 5849abb commit 66dbf7d
Show file tree
Hide file tree
Showing 14 changed files with 395 additions and 100 deletions.
10 changes: 5 additions & 5 deletions charts/images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ images:
- name: cilium-agent
sourceRepository: github.com/cilium/cilium
repository: quay.io/cilium/cilium
tag: v1.11.6
tag: v1.12.0
- name: cilium-preflight
sourceRepository: github.com/cilium/cilium
repository: quay.io/cilium/cilium
tag: v1.11.6
tag: v1.12.0
- name: cilium-operator
sourceRepository: github.com/cilium/cilium
repository: quay.io/cilium/operator
tag: v1.11.6
tag: v1.12.0
- name: cilium-etcd-operator
sourceRepository: github.com/cilium/cilium
repository: docker.io/cilium/cilium-etcd-operator
Expand All @@ -30,11 +30,11 @@ images:
- name: hubble-relay
sourceRepository: github.com/cilium/hubble-ui
repository: quay.io/cilium/hubble-relay
tag: v1.11.6
tag: v1.12.0
- name: certgen
sourceRepository: github.com/cilium/certgen
repository: quay.io/cilium/certgen
tag: v0.1.5
tag: v0.1.8
- name: kube-proxy
sourceRepository: github.com/kubernetes/kubernetes
repository: k8s.gcr.io/hyperkube
Expand Down
71 changes: 50 additions & 21 deletions charts/internal/cilium/charts/agent/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,13 @@ rules:
- get
- list
- watch
- apiGroups:
- ""
resources:
- nodes/status
verbs:
# To annotate the k8s node with Cilium's metadata
- patch
- apiGroups:
- apiextensions.k8s.io
resources:
- customresourcedefinitions
verbs:
# Deprecated for removal in v1.10
- create
- list
- watch
- update
# This is used when validating policies in preflight. This will need to stay
# until we figure out how to avoid "get" inside the preflight, and then
# should be removed ideally.
Expand All @@ -63,19 +53,58 @@ rules:
- apiGroups:
- cilium.io
resources:
- ciliumnetworkpolicies
- ciliumnetworkpolicies/status
- ciliumbgploadbalancerippools
- ciliumbgppeeringpolicies
- ciliumclusterwideenvoyconfigs
- ciliumclusterwidenetworkpolicies
- ciliumclusterwidenetworkpolicies/status
- ciliumegressgatewaypolicies
- ciliumegressnatpolicies
- ciliumendpoints
- ciliumendpoints/status
- ciliumnodes
- ciliumnodes/status
- ciliumendpointslices
- ciliumenvoyconfigs
- ciliumidentities
- ciliumlocalredirectpolicies
- ciliumlocalredirectpolicies/status
- ciliumlocalredirectpolicies/finalizers
- ciliumegressnatpolicies
- ciliumendpointslices
- ciliumnetworkpolicies
- ciliumnodes
verbs:
- list
- watch
- apiGroups:
- cilium.io
resources:
- ciliumidentities
- ciliumendpoints
- ciliumnodes
verbs:
- create
- apiGroups:
- cilium.io
# To synchronize garbage collection of such resources
resources:
- ciliumidentities
verbs:
- '*'
- update
- apiGroups:
- cilium.io
resources:
- ciliumendpoints
verbs:
- delete
- get
- apiGroups:
- cilium.io
resources:
- ciliumnodes
- ciliumnodes/status
verbs:
- get
- update
- apiGroups:
- cilium.io
resources:
- ciliumnetworkpolicies/status
- ciliumclusterwidenetworkpolicies/status
- ciliumendpoints/status
- ciliumendpoints
verbs:
- patch
193 changes: 178 additions & 15 deletions charts/internal/cilium/charts/agent/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,16 @@ spec:
prometheus.io/port: "{{ .Values.global.prometheus.port }}"
prometheus.io/scrape: "true"
{{- end }}
# Set app AppArmor's profile to "unconfined". The value of this annotation
# can be modified as long users know which profiles they have available
# in AppArmor.
container.apparmor.security.beta.kubernetes.io/cilium-agent: "unconfined"
container.apparmor.security.beta.kubernetes.io/clean-cilium-state: "unconfined"
container.apparmor.security.beta.kubernetes.io/mount-cgroup: "unconfined"
container.apparmor.security.beta.kubernetes.io/apply-sysctl-overwrites: "unconfined"
labels:
k8s-app: cilium
spec:
{{- if .Values.global.affinity }}
affinity:
{{ toYaml .Values.global.affinity | indent 8 }}
{{- end }}
containers:
{{- if .Values.global.sleepAfterInit }}
- command: [ "/bin/bash", "-c", "--" ]
Expand Down Expand Up @@ -143,6 +146,7 @@ spec:
- "/cni-install.sh"
-{{- if .Values.global.debug.enabled }} "--enable-debug=true"{{- else }} "--enable-debug=false"{{- end }}
- "--cni-exclusive=true"
- "--log-file=/var/run/cilium/cilium-cni.log"
preStop:
exec:
command:
Expand All @@ -165,13 +169,59 @@ spec:
protocol: TCP
{{- end }}
securityContext:
privileged: true
seLinuxOptions:
level: 's0'
# Running with spc_t since we have removed the privileged mode.
# Users can change it to a different type as long as they have the
# type available on the system.
type: 'spc_t'
capabilities:
add:
# Use to set socket permission
- CHOWN
# Used to terminate envoy child process
- KILL
# Used since cilium modifies routing tables, etc...
- NET_ADMIN
# Used since cilium creates raw sockets, etc...
- NET_RAW
# Used since cilium monitor uses mmap
- IPC_LOCK
# Used in iptables. Consider removing once we are iptables-free
- SYS_MODULE
# We need it for now but might not need it for >= 5.11 specially
# for the 'SYS_RESOURCE'.
# In >= 5.8 there's already BPF and PERMON capabilities
- SYS_ADMIN
# Could be an alternative for the SYS_ADMIN for the RLIMIT_NPROC
- SYS_RESOURCE
# Both PERFMON and BPF requires kernel 5.8, container runtime
# cri-o >= v1.22.0 or containerd >= v1.5.0.
# If available, SYS_ADMIN can be removed.
#- PERFMON
#- BPF
- DAC_OVERRIDE
- FOWNER
- SETGID
- SETUID
drop:
- ALL
volumeMounts:
{{- /* CRI-O already mounts the BPF filesystem */ -}}
{{- if not (eq .Values.global.containerRuntime.integration "crio") }}
# Unprivileged containers need to mount /proc/sys/net from the host
# to have write access
- mountPath: /host/proc/sys/net
name: host-proc-sys-net
# Unprivileged containers need to mount /proc/sys/kernel from the host
# to have write access
- mountPath: /host/proc/sys/kernel
name: host-proc-sys-kernel
- name: bpf-maps
mountPath: /sys/fs/bpf
{{- end }}
# Unprivileged containers can't set mount propagation to bidirectional
# in this case we will mount the bpf fs from an init container that
# is privileged and set the mount propagation from host to container
# in Cilium.
mountPropagation: HostToContainer
- name: cilium-run
mountPath: /var/run/cilium
- name: cni-path
Expand Down Expand Up @@ -243,7 +293,6 @@ spec:
# the etcd service
dnsPolicy: ClusterFirstWithHostNet
{{- end }}
hostNetwork: true
initContainers:
# Disable source validation / rp_filter.
- name: disable-rp-filter
Expand Down Expand Up @@ -283,8 +332,79 @@ spec:
mountPath: /hostproc
- name: cni-path
mountPath: /hostbin
securityContext:
seLinuxOptions:
level: 's0'
# Running with spc_t since we have removed the privileged mode.
# Users can change it to a different type as long as they have the
# type available on the system.
type: 'spc_t'
capabilities:
drop:
- ALL
add:
# Only used for 'mount' cgroup
- SYS_ADMIN
# Used for nsenter
- SYS_CHROOT
- SYS_PTRACE
- name: apply-sysctl-overwrites
image: {{ index .Values.global.images "cilium-agent" }}
imagePullPolicy: IfNotPresent
env:
- name: BIN_PATH
value: /opt/cni/bin
command:
- sh
- -ec
# The statically linked Go program binary is invoked to avoid any
# dependency on utilities like sh that can be missing on certain
# distros installed on the underlying host. Copy the binary to the
# same directory where we install cilium cni plugin so that exec permissions
# are available.
- |
cp /usr/bin/cilium-sysctlfix /hostbin/cilium-sysctlfix;
nsenter --mount=/hostproc/1/ns/mnt "${BIN_PATH}/cilium-sysctlfix";
rm /hostbin/cilium-sysctlfix
volumeMounts:
- name: hostproc
mountPath: /hostproc
- name: cni-path
mountPath: /hostbin
securityContext:
seLinuxOptions:
level: 's0'
# Running with spc_t since we have removed the privileged mode.
# Users can change it to a different type as long as they have the
# type available on the system.
type: 'spc_t'
capabilities:
drop:
- ALL
add:
# Required in order to access host's /etc/sysctl.d dir
- SYS_ADMIN
# Used for nsenter
- SYS_CHROOT
- SYS_PTRACE
# Mount the bpf fs if it is not mounted. We will perform this task
# from a privileged container because the mount propagation bidirectional
# only works from privileged containers.
- name: mount-bpf-fs
image: {{ index .Values.global.images "cilium-agent" }}
imagePullPolicy: IfNotPresent
args:
- 'mount | grep "/sys/fs/bpf type bpf" || mount -t bpf bpf /sys/fs/bpf'
command:
- /bin/bash
- -c
- --
securityContext:
privileged: true
volumeMounts:
- name: bpf-maps
mountPath: /sys/fs/bpf
mountPropagation: Bidirectional
{{- if and .Values.global.nodeinit.enabled (not (eq .Values.global.nodeinit.bootstrapFile "")) }}
- name: wait-for-node-init
command: ['sh', '-c', 'until stat {{ .Values.global.nodeinit.bootstrapFile }} > /dev/null 2>&1; do echo "Waiting on node-init to run..."; sleep 1; done']
Expand All @@ -294,7 +414,8 @@ spec:
- mountPath: {{ .Values.global.nodeinit.bootstrapFile }}
name: cilium-bootstrap-file
{{- end }}
- command:
- name: clean-cilium-state
command:
- /init-container.sh
env:
- name: CILIUM_ALL_STATE
Expand All @@ -311,9 +432,36 @@ spec:
optional: true
image: {{ index .Values.global.images "cilium-agent" }}
imagePullPolicy: {{ .Values.global.pullPolicy }}
name: clean-cilium-state
securityContext:
privileged: true
seLinuxOptions:
level: 's0'
# Running with spc_t since we have removed the privileged mode.
# Users can change it to a different type as long as they have the
# type available on the system.
type: 'spc_t'
capabilities:
# Most of the capabilities here are the same ones used in the
# cilium-agent's container because this container can be used to
# uninstall all Cilium resources, and therefore it is likely that
# will need the same capabilities.
add:
# Used since cilium modifies routing tables, etc...
- NET_ADMIN
# Used in iptables. Consider removing once we are iptables-free
- SYS_MODULE
# We need it for now but might not need it for >= 5.11 specially
# for the 'SYS_RESOURCE'.
# In >= 5.8 there's already BPF and PERMON capabilities
- SYS_ADMIN
# Could be an alternative for the SYS_ADMIN for the RLIMIT_NPROC
- SYS_RESOURCE
# Both PERFMON and BPF requires kernel 5.8, container runtime
# cri-o >= v1.22.0 or containerd >= v1.5.0.
# If available, SYS_ADMIN can be removed.
#- PERFMON
#- BPF
drop:
- ALL
volumeMounts:
{{- /* CRI-O already mounts the BPF filesystem */ -}}
{{- if not (eq .Values.global.containerRuntime.integration "crio") }}
Expand Down Expand Up @@ -371,11 +519,18 @@ spec:
{{- if and (eq .Release.Namespace "kube-system") (or (gt .Capabilities.KubeVersion.Minor "10") (gt .Capabilities.KubeVersion.Major "1"))}}
priorityClassName: system-node-critical
{{- end }}
serviceAccount: cilium
serviceAccountName: cilium
serviceAccount: "cilium"
serviceAccountName: "cilium"
terminationGracePeriodSeconds: 1
hostNetwork: true
{{- if .Values.global.affinity }}
affinity:
{{ toYaml .Values.global.affinity | indent 8 }}
{{- end }}
nodeSelector:
kubernetes.io/os: linux
tolerations:
- operator: Exists
- operator: Exists
volumes:
# To keep state between restarts / upgrades
- name: cilium-run
Expand Down Expand Up @@ -465,6 +620,14 @@ spec:
- name: cilium-config-path
configMap:
name: cilium-config
- name: host-proc-sys-net
hostPath:
path: /proc/sys/net
type: Directory
- name: host-proc-sys-kernel
hostPath:
path: /proc/sys/kernel
type: Directory
- name: hubble-tls
projected:
# note: the leading zero means this number is in octal representation: do not remove it
Expand Down
Loading

0 comments on commit 66dbf7d

Please sign in to comment.