|
| 1 | +{{- if .Values.dynamicNetworksController.enabled }} |
| 2 | +{{- if .Values.manifests.clusterRole }} |
| 3 | +--- |
| 4 | +kind: ClusterRole |
| 5 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 6 | +metadata: |
| 7 | + name: {{ .Chart.Name }}-dnc |
| 8 | +rules: |
| 9 | + - apiGroups: ["k8s.cni.cncf.io"] |
| 10 | + resources: |
| 11 | + - network-attachment-definitions |
| 12 | + verbs: |
| 13 | + - get |
| 14 | + - list |
| 15 | + - watch |
| 16 | + - apiGroups: |
| 17 | + - "" |
| 18 | + resources: |
| 19 | + - pods |
| 20 | + - pods/status |
| 21 | + verbs: |
| 22 | + - get |
| 23 | + - list |
| 24 | + - update |
| 25 | + - watch |
| 26 | + - apiGroups: |
| 27 | + - "" |
| 28 | + - events.k8s.io |
| 29 | + resources: |
| 30 | + - events |
| 31 | + verbs: |
| 32 | + - create |
| 33 | + - patch |
| 34 | + - update |
| 35 | +{{- end }} |
| 36 | +{{- if .Values.manifests.clusterRoleBinding }} |
| 37 | +--- |
| 38 | +kind: ClusterRoleBinding |
| 39 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 40 | +metadata: |
| 41 | + name: {{ .Chart.Name }}-dnc |
| 42 | +roleRef: |
| 43 | + apiGroup: rbac.authorization.k8s.io |
| 44 | + kind: ClusterRole |
| 45 | + name: {{ .Chart.Name }}-dnc |
| 46 | +subjects: |
| 47 | + - kind: ServiceAccount |
| 48 | + name: {{ .Chart.Name }}-dnc |
| 49 | + namespace: {{ .Release.Namespace }} |
| 50 | +{{- end }} |
| 51 | +--- |
| 52 | +{{- if .Values.manifests.serviceAccount }} |
| 53 | +apiVersion: v1 |
| 54 | +kind: ServiceAccount |
| 55 | +metadata: |
| 56 | + name: {{ .Chart.Name }}-dnc |
| 57 | + namespace: {{ .Release.Namespace }} |
| 58 | +{{- end }} |
| 59 | +--- |
| 60 | +{{- if .Values.manifests.configMap }} |
| 61 | +kind: ConfigMap |
| 62 | +apiVersion: v1 |
| 63 | +metadata: |
| 64 | + name: dynamic-networks-controller-config |
| 65 | + namespace: {{ .Release.Namespace }} |
| 66 | + labels: |
| 67 | +{{- include "dynamicNetworksController.labels" . | indent 8 }} |
| 68 | +data: |
| 69 | + dynamic-networks-config.json: | |
| 70 | + { |
| 71 | + "criSocketPath": "/host{{ .Values.dynamicNetworksController.sockets.containerd }}", |
| 72 | + "multusSocketPath": "/host{{ .Values.dynamicNetworksController.sockets.multus }}" |
| 73 | + } |
| 74 | +{{- end }} |
| 75 | +--- |
| 76 | +apiVersion: apps/v1 |
| 77 | +kind: DaemonSet |
| 78 | +metadata: |
| 79 | + name: {{ .Release.Name }}-dnc |
| 80 | + namespace: {{ .Release.Namespace }} |
| 81 | + labels: |
| 82 | +{{- include "dynamicNetworksController.labels" . | indent 8 }} |
| 83 | +spec: |
| 84 | + selector: |
| 85 | + matchLabels: |
| 86 | + app: {{ .Chart.Name }}-dnc |
| 87 | + updateStrategy: |
| 88 | + type: RollingUpdate |
| 89 | + template: |
| 90 | + metadata: |
| 91 | + labels: |
| 92 | +{{- include "dynamicNetworksController.labels" . | indent 8 }} |
| 93 | + spec: |
| 94 | + {{- with .Values.tolerations }} |
| 95 | + tolerations: |
| 96 | + {{- toYaml . | trim | nindent 8 }} |
| 97 | + {{- end }} |
| 98 | + serviceAccountName: {{ .Chart.Name }}-dnc |
| 99 | + containers: |
| 100 | + - name: dynamic-networks-controller |
| 101 | + env: |
| 102 | + - name: NODE_NAME |
| 103 | + valueFrom: |
| 104 | + fieldRef: |
| 105 | + fieldPath: spec.nodeName |
| 106 | + image: {{ template "system_default_registry" . }}{{ .Values.dynamicNetworksController.image.repository }}:{{ .Values.dynamicNetworksController.image.tag }} |
| 107 | + command: [ "/dynamic-networks-controller" ] |
| 108 | + args: |
| 109 | + - "-config=/etc/dynamic-networks-controller/dynamic-networks-config.json" |
| 110 | + - "-v=5" |
| 111 | + {{- if .Values.pod.resources.enabled }} |
| 112 | + resources: {{- toYaml .Values.pod.resources.dynamicNetworksController | nindent 10 }} |
| 113 | + {{- end }} |
| 114 | + securityContext: |
| 115 | + privileged: true |
| 116 | + volumeMounts: |
| 117 | + - name: dynamic-networks-controller-config-dir |
| 118 | + mountPath: /etc/dynamic-networks-controller/ |
| 119 | + readOnly: true |
| 120 | + - name: multus-server-socket |
| 121 | + mountPath: /host{{ .Values.dynamicNetworksController.sockets.multus }} |
| 122 | + - name: cri-socket |
| 123 | + mountPath: /host{{ .Values.dynamicNetworksController.sockets.containerd }} |
| 124 | + terminationMessagePolicy: FallbackToLogsOnError |
| 125 | + terminationGracePeriodSeconds: 10 |
| 126 | + volumes: |
| 127 | + - name: dynamic-networks-controller-config-dir |
| 128 | + configMap: |
| 129 | + name: dynamic-networks-controller-config |
| 130 | + items: |
| 131 | + - key: dynamic-networks-config.json |
| 132 | + path: dynamic-networks-config.json |
| 133 | + - name: multus-server-socket |
| 134 | + hostPath: |
| 135 | + path: {{ .Values.dynamicNetworksController.sockets.multus }} |
| 136 | + type: Socket |
| 137 | + - name: cri-socket |
| 138 | + hostPath: |
| 139 | + path: {{ .Values.dynamicNetworksController.sockets.containerd }} |
| 140 | + type: Socket |
| 141 | +{{- end }} |
0 commit comments