|
| 1 | +apiVersion: v1 |
| 2 | +kind: ServiceAccount |
| 3 | +metadata: |
| 4 | + name: cozyplane-kpr |
| 5 | + namespace: {{ .Release.Namespace }} |
| 6 | +--- |
| 7 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 8 | +kind: ClusterRole |
| 9 | +metadata: |
| 10 | + name: cozyplane-kpr |
| 11 | +rules: |
| 12 | + # The LB control plane watches Services + their endpoints and node/topology. |
| 13 | + - apiGroups: [""] |
| 14 | + resources: [services, endpoints, nodes, namespaces, pods] |
| 15 | + verbs: [get, list, watch] |
| 16 | + - apiGroups: [discovery.k8s.io] |
| 17 | + resources: [endpointslices] |
| 18 | + verbs: [get, list, watch] |
| 19 | + # Leader election. |
| 20 | + - apiGroups: [coordination.k8s.io] |
| 21 | + resources: [leases] |
| 22 | + verbs: [get, list, watch, create, update, patch, delete] |
| 23 | + - apiGroups: [""] |
| 24 | + resources: [events] |
| 25 | + verbs: [create, patch] |
| 26 | + # Cilium's imported cells reconcile their own CRDs (CiliumNode, LB IP pools, …). |
| 27 | + - apiGroups: [cilium.io] |
| 28 | + resources: ["*"] |
| 29 | + verbs: [get, list, watch, create, update, patch, delete] |
| 30 | +--- |
| 31 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 32 | +kind: ClusterRoleBinding |
| 33 | +metadata: |
| 34 | + name: cozyplane-kpr |
| 35 | +roleRef: |
| 36 | + apiGroup: rbac.authorization.k8s.io |
| 37 | + kind: ClusterRole |
| 38 | + name: cozyplane-kpr |
| 39 | +subjects: |
| 40 | + - kind: ServiceAccount |
| 41 | + name: cozyplane-kpr |
| 42 | + namespace: {{ .Release.Namespace }} |
| 43 | +--- |
| 44 | +apiVersion: apps/v1 |
| 45 | +kind: DaemonSet |
| 46 | +metadata: |
| 47 | + name: cozyplane-kpr |
| 48 | + namespace: {{ .Release.Namespace }} |
| 49 | + labels: {app: cozyplane-kpr} |
| 50 | +spec: |
| 51 | + selector: |
| 52 | + matchLabels: {app: cozyplane-kpr} |
| 53 | + updateStrategy: |
| 54 | + type: RollingUpdate |
| 55 | + template: |
| 56 | + metadata: |
| 57 | + labels: {app: cozyplane-kpr} |
| 58 | + spec: |
| 59 | + serviceAccountName: cozyplane-kpr |
| 60 | + hostNetwork: true |
| 61 | + dnsPolicy: ClusterFirstWithHostNet |
| 62 | + priorityClassName: system-node-critical |
| 63 | + tolerations: |
| 64 | + - operator: Exists |
| 65 | + {{- with .Values.imagePullSecrets }} |
| 66 | + imagePullSecrets: |
| 67 | + {{- toYaml . | nindent 8 }} |
| 68 | + {{- end }} |
| 69 | + initContainers: |
| 70 | + # Ensure bpffs is mounted on the host so the LB map pins are a real |
| 71 | + # bpffs and outlive the process; Bidirectional propagation pushes it to |
| 72 | + # the node. Cilium's DaemonSet does the equivalent. |
| 73 | + - name: mount-bpffs |
| 74 | + image: busybox:1.36 |
| 75 | + command: ["sh", "-c", "mount | grep -q 'bpf on {{ .Values.bpffsRoot }} ' || mount -t bpf bpf {{ .Values.bpffsRoot }}"] |
| 76 | + securityContext: |
| 77 | + privileged: true |
| 78 | + volumeMounts: |
| 79 | + - {name: bpffs, mountPath: {{ .Values.bpffsRoot }}, mountPropagation: Bidirectional} |
| 80 | + containers: |
| 81 | + - name: kpr |
| 82 | + image: {{ .Values.image }} |
| 83 | + imagePullPolicy: {{ .Values.imagePullPolicy }} |
| 84 | + args: |
| 85 | + {{- if .Values.apiServerURL }} |
| 86 | + - --k8s-api-server-urls={{ .Values.apiServerURL }} |
| 87 | + {{- end }} |
| 88 | + env: |
| 89 | + - {name: KPR_CGROUP_ROOT, value: {{ .Values.cgroupRoot | quote }}} |
| 90 | + - {name: KPR_BPFFS_ROOT, value: {{ .Values.bpffsRoot | quote }}} |
| 91 | + securityContext: |
| 92 | + privileged: true |
| 93 | + volumeMounts: |
| 94 | + - {name: bpffs, mountPath: {{ .Values.bpffsRoot }}, mountPropagation: Bidirectional} |
| 95 | + - {name: cgroup2, mountPath: {{ .Values.cgroupRoot }}} |
| 96 | + volumes: |
| 97 | + - name: bpffs |
| 98 | + hostPath: {path: {{ .Values.bpffsRoot }}, type: DirectoryOrCreate} |
| 99 | + - name: cgroup2 |
| 100 | + hostPath: {path: /sys/fs/cgroup, type: Directory} |
0 commit comments