Add cilium chart

This commit is contained in:
Jonny Ervine
2024-07-15 18:18:16 +08:00
parent 9b2e417702
commit 221e0d5590
159 changed files with 37242 additions and 0 deletions
@@ -0,0 +1,79 @@
{{- if .Values.etcd.managed }}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: cilium-etcd-operator
{{- with .Values.etcd.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
app.kubernetes.io/part-of: cilium
rules:
- apiGroups:
- etcd.database.coreos.com
resources:
- etcdclusters
verbs:
- get
- delete
- create
- update
- apiGroups:
- apiextensions.k8s.io
resources:
- customresourcedefinitions
verbs:
- delete
- get
- create
- apiGroups:
- ""
resources:
- deployments
verbs:
- delete
- create
- get
- update
- apiGroups:
- ""
resources:
- pods
verbs:
- list
- get
- delete
- apiGroups:
- apps
resources:
- deployments
verbs:
- delete
- create
- get
- update
- apiGroups:
- ""
resources:
- componentstatuses
verbs:
- get
- apiGroups:
- extensions
resources:
- deployments
verbs:
- delete
- create
- get
- update
- apiGroups:
- ""
resources:
- secrets
verbs:
- get
- create
- delete
{{- end }}
@@ -0,0 +1,20 @@
{{- if and .Values.etcd.managed .Values.serviceAccounts.etcd.create }}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: cilium-etcd-operator
{{- with .Values.etcd.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
app.kubernetes.io/part-of: cilium
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cilium-etcd-operator
subjects:
- kind: ServiceAccount
name: {{ .Values.serviceAccounts.etcd.name | quote }}
namespace: {{ .Release.Namespace }}
{{- end }}
@@ -0,0 +1,128 @@
{{- 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 }}
@@ -0,0 +1,16 @@
{{- if and .Values.etcd.managed .Values.serviceAccounts.etcd.create }}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ .Values.serviceAccounts.etcd.name | quote }}
namespace: {{ .Release.Namespace }}
{{- if or .Values.serviceAccounts.etcd.annotations .Values.etcd.annotations }}
annotations:
{{- with .Values.etcd.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.serviceAccounts.etcd.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
{{- end }}
@@ -0,0 +1,60 @@
{{- if .Values.etcd.managed }}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: etcd-operator
{{- with .Values.etcd.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
app.kubernetes.io/part-of: cilium
rules:
- apiGroups:
- etcd.database.coreos.com
resources:
- etcdclusters
- etcdbackups
- etcdrestores
verbs:
- '*'
- apiGroups:
- apiextensions.k8s.io
resources:
- customresourcedefinitions
verbs:
- '*'
- apiGroups:
- ""
resources:
- pods
- services
- endpoints
- persistentvolumeclaims
- events
- deployments
verbs:
- '*'
- apiGroups:
- apps
resources:
- deployments
verbs:
- '*'
- apiGroups:
- extensions
resources:
- deployments
verbs:
- create
- get
- list
- patch
- update
- apiGroups:
- ""
resources:
- secrets
verbs:
- get
{{- end }}
@@ -0,0 +1,20 @@
{{- if .Values.etcd.managed }}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: etcd-operator
{{- with .Values.etcd.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
app.kubernetes.io/part-of: cilium
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: etcd-operator
subjects:
- kind: ServiceAccount
name: cilium-etcd-sa
namespace: {{ .Release.Namespace }}
{{- end }}
@@ -0,0 +1,16 @@
{{- if .Values.etcd.managed }}
apiVersion: v1
kind: ServiceAccount
metadata:
name: cilium-etcd-sa
namespace: {{ .Release.Namespace }}
{{- if or .Values.serviceAccounts.etcd.annotations .Values.etcd.annotations }}
annotations:
{{- with .Values.etcd.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.serviceAccounts.etcd.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
{{- end }}
@@ -0,0 +1,28 @@
{{- if and .Values.etcd.managed .Values.etcd.podDisruptionBudget.enabled }}
{{- $component := .Values.etcd.podDisruptionBudget }}
apiVersion: {{ include "podDisruptionBudget.apiVersion" . }}
kind: PodDisruptionBudget
metadata:
name: cilium-etcd-operator
namespace: {{ .Release.Namespace }}
{{- with .Values.etcd.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
io.cilium/app: etcd-operator
name: cilium-etcd-operator
app.kubernetes.io/name: cilium-etcd-operator
app.kubernetes.io/part-of: cilium
spec:
{{- with $component.maxUnavailable }}
maxUnavailable: {{ . }}
{{- end }}
{{- with $component.minAvailable }}
minAvailable: {{ . }}
{{- end }}
selector:
matchLabels:
io.cilium/app: etcd-operator
name: cilium-etcd-operator
{{- end }}