charts/cilium/templates/etcd-operator/cilium-etcd-operator-deployment.yaml
2024-07-15 18:18:16 +08:00

129 lines
4.1 KiB
YAML

{{- if .Values.etcd.managed }}
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
io.cilium/app: etcd-operator
name: cilium-etcd-operator
app.kubernetes.io/name: cilium-etcd-operator
app.kubernetes.io/part-of: cilium
name: cilium-etcd-operator
namespace: {{ .Release.Namespace }}
{{- with .Values.etcd.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
replicas: 1
selector:
matchLabels:
io.cilium/app: etcd-operator
name: cilium-etcd-operator
{{- with .Values.etcd.updateStrategy }}
strategy:
{{- toYaml . | trim | nindent 4 }}
{{- end }}
template:
metadata:
{{- with .Values.etcd.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
io.cilium/app: etcd-operator
app.kubernetes.io/part-of: cilium
app.kubernetes.io/name: cilium-etcd-operator
name: cilium-etcd-operator
{{- with .Values.etcd.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- if .Values.etcd.affinity }}
affinity:
{{ toYaml .Values.etcd.affinity | indent 8 }}
{{- end }}
{{- with .Values.etcd.topologySpreadConstraints }}
topologySpreadConstraints:
{{- range $constraint := . }}
- {{ toYaml $constraint | nindent 8 | trim }}
{{- if not $constraint.labelSelector }}
labelSelector:
matchLabels:
io.cilium/app: etcd-operator
name: cilium-etcd-operator
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.imagePullSecrets }}
imagePullSecrets:
{{ toYaml .Values.imagePullSecrets | indent 8 }}
{{- end }}
{{- with .Values.etcd.podSecurityContext }}
securityContext:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- args:
{{- with .Values.etcd.extraArgs }}
{{- toYaml . | trim | nindent 8 }}
{{- end }}
#- --etcd-node-selector=disktype=ssd,cputype=high
command:
- /usr/bin/cilium-etcd-operator
env:
- name: CILIUM_ETCD_OPERATOR_CLUSTER_DOMAIN
value: "{{ .Values.etcd.clusterDomain }}"
- name: CILIUM_ETCD_OPERATOR_ETCD_CLUSTER_SIZE
value: "{{ .Values.etcd.clusterSize }}"
- name: CILIUM_ETCD_OPERATOR_NAMESPACE
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
- name: CILIUM_ETCD_OPERATOR_POD_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.name
- name: CILIUM_ETCD_OPERATOR_POD_UID
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.uid
- name: CILIUM_ETCD_META_ETCD_AUTO_COMPACTION_MODE
value: "revision"
- name: CILIUM_ETCD_META_ETCD_AUTO_COMPACTION_RETENTION
value: "25000"
image: {{ include "cilium.image" .Values.etcd.image | quote }}
imagePullPolicy: {{ .Values.etcd.image.pullPolicy }}
name: cilium-etcd-operator
terminationMessagePolicy: FallbackToLogsOnError
{{- with .Values.etcd.securityContext }}
securityContext:
{{- toYaml . | trim | nindent 8 }}
{{- end }}
{{- with .Values.etcd.extraVolumeMounts }}
volumeMounts:
{{- toYaml . | nindent 8 }}
{{- end }}
dnsPolicy: ClusterFirst
hostNetwork: true
priorityClassName: {{ include "cilium.priorityClass" (list $ .Values.clustermesh.apiserver.priorityClassName "system-cluster-critical") }}
restartPolicy: Always
serviceAccount: {{ .Values.serviceAccounts.etcd.name | quote }}
serviceAccountName: {{ .Values.serviceAccounts.etcd.name | quote }}
automountServiceAccountToken: {{ .Values.serviceAccounts.etcd.automount }}
{{- with .Values.etcd.nodeSelector }}
nodeSelector:
{{- toYaml . | trim | nindent 8 }}
{{- end }}
{{- with .Values.etcd.tolerations }}
tolerations:
{{- toYaml . | trim | nindent 6 }}
{{- end }}
{{- with .Values.etcd.extraVolumes }}
volumes:
{{- toYaml . | nindent 6 }}
{{- end }}
{{- end }}