forked from cilium/cilium
/
deployment.yaml
210 lines (210 loc) · 6.64 KB
/
deployment.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
io.cilium/app: operator
name: cilium-operator
name: cilium-operator
namespace: {{ .Release.Namespace }}
spec:
replicas: 1
selector:
matchLabels:
io.cilium/app: operator
name: cilium-operator
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
type: RollingUpdate
template:
metadata:
annotations:
{{- if and .Values.global.prometheus.enabled (not .Values.global.prometheus.serviceMonitor.enabled) }}
prometheus.io/port: {{ .Values.global.operatorPrometheus.port | quote }}
prometheus.io/scrape: "true"
{{- end }}
labels:
io.cilium/app: operator
name: cilium-operator
spec:
containers:
- args:
- --config-dir=/tmp/cilium/config-map
- --debug=$(CILIUM_DEBUG)
command:
{{- if .Values.global.eni }}
- cilium-operator-aws
{{- else if .Values.global.azure.enabled }}
- cilium-operator-azure
{{- else if .Values.global.ipam.operator }}
- cilium-operator-generic
{{- else }}
- cilium-operator
{{- end }}
env:
- name: K8S_NODE_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: spec.nodeName
{{- if .Values.global.ci.kubeCacheMutationDetector }}
- name: KUBE_CACHE_MUTATION_DETECTOR
value: "true"
{{- end }}
- name: CILIUM_K8S_NAMESPACE
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
- name: CILIUM_DEBUG
valueFrom:
configMapKeyRef:
key: debug
name: cilium-config
optional: true
- name: AWS_ACCESS_KEY_ID
valueFrom:
secretKeyRef:
key: AWS_ACCESS_KEY_ID
name: cilium-aws
optional: true
- name: AWS_SECRET_ACCESS_KEY
valueFrom:
secretKeyRef:
key: AWS_SECRET_ACCESS_KEY
name: cilium-aws
optional: true
- name: AWS_DEFAULT_REGION
valueFrom:
secretKeyRef:
key: AWS_DEFAULT_REGION
name: cilium-aws
optional: true
{{- if .Values.global.k8sServiceHost }}
- name: KUBERNETES_SERVICE_HOST
value: {{ .Values.global.k8sServiceHost | quote }}
{{- end }}
{{- if .Values.global.k8sServicePort }}
- name: KUBERNETES_SERVICE_PORT
value: {{ .Values.global.k8sServicePort | quote }}
{{- end }}
{{- if .Values.global.azure.subscriptionID }}
- name: AZURE_SUBSCRIPTION_ID
value: {{ .Values.global.azure.subscriptionID }}
{{- end }}
{{- if .Values.global.azure.tenantID }}
- name: AZURE_TENANT_ID
value: {{ .Values.global.azure.tenantID }}
{{- end }}
{{- if .Values.global.azure.resourceGroup }}
- name: AZURE_RESOURCE_GROUP
value: {{ .Values.global.azure.resourceGroup }}
{{- end }}
{{- if .Values.global.azure.clientID }}
- name: AZURE_CLIENT_ID
value: {{ .Values.global.azure.clientID }}
{{- end }}
{{- if .Values.global.azure.clientSecret }}
- name: AZURE_CLIENT_SECRET
value: {{ .Values.global.azure.clientSecret }}
{{- end }}
{{- if contains "/" .Values.image }}
image: "{{ .Values.image }}"
{{- else }}
{{- if .Values.global.eni }}
image: "{{ .Values.global.registry }}/{{ .Values.image }}-aws:{{ .Values.global.tag }}"
{{- else if .Values.global.azure.enabled }}
image: "{{ .Values.global.registry }}/{{ .Values.image }}-azure:{{ .Values.global.tag }}"
{{- else if .Values.global.ipam.operator }}
image: "{{ .Values.global.registry }}/{{ .Values.image }}-generic:{{ .Values.global.tag }}"
{{- else }}
image: "{{ .Values.global.registry }}/{{ .Values.image }}:{{ .Values.global.tag }}"
{{- end }}
{{- end }}
imagePullPolicy: {{ .Values.global.pullPolicy }}
name: cilium-operator
{{- if .Values.global.prometheus.enabled }}
ports:
- containerPort: {{ .Values.global.operatorPrometheus.port }}
hostPort: {{ .Values.global.operatorPrometheus.port }}
name: prometheus
protocol: TCP
{{- end }}
livenessProbe:
httpGet:
{{- if .Values.global.ipv4.enabled }}
host: '127.0.0.1'
{{- else }}
host: '[::1]'
{{- end }}
path: /healthz
port: 9234
scheme: HTTP
initialDelaySeconds: 60
periodSeconds: 10
timeoutSeconds: 3
volumeMounts:
- mountPath: /tmp/cilium/config-map
name: cilium-config-path
readOnly: true
{{- if .Values.global.etcd.enabled }}
- mountPath: /var/lib/etcd-config
name: etcd-config-path
readOnly: true
{{- if or .Values.global.etcd.ssl .Values.global.etcd.managed }}
- mountPath: /var/lib/etcd-secrets
name: etcd-secrets
readOnly: true
{{- end }}
{{- end }}
{{- if .Values.global.kubeConfigPath }}
- mountPath: {{ .Values.global.kubeConfigPath }}
name: kube-config
readOnly: true
{{- end }}
{{- if .Values.resources }}
resources:
{{- toYaml .Values.resources | trim | nindent 10 }}
{{- end }}
hostNetwork: true
{{- if .Values.global.etcd.managed }}
# In managed etcd mode, Cilium must be able to resolve the DNS name of
# the etcd service
dnsPolicy: ClusterFirstWithHostNet
{{- end }}
restartPolicy: Always
{{- if or (and (eq .Release.Namespace "kube-system") (gt .Capabilities.KubeVersion.Minor "10")) (ge .Capabilities.KubeVersion.Minor "17") (gt .Capabilities.KubeVersion.Major "1")}}
priorityClassName: system-cluster-critical
{{- end }}
serviceAccount: cilium-operator
serviceAccountName: cilium-operator
volumes:
# To read the configuration from the config map
- configMap:
name: cilium-config
name: cilium-config-path
{{- if .Values.global.etcd.enabled }}
# To read the etcd config stored in config maps
- configMap:
defaultMode: 420
items:
- key: etcd-config
path: etcd.config
name: cilium-config
name: etcd-config-path
{{- if or .Values.global.etcd.ssl .Values.global.etcd.managed }}
# To read the k8s etcd secrets in case the user might want to use TLS
- name: etcd-secrets
secret:
defaultMode: 420
optional: true
secretName: cilium-etcd-secrets
{{- end }}
{{- end }}
{{- if .Values.global.kubeConfigPath }}
- hostPath:
path: {{ .Values.global.kubeConfigPath }}
type: FileOrCreate
name: kube-config
{{- end }}