Files
kubesphere/config/ks-core/templates/ks-agent.yaml
2025-03-19 12:27:57 +08:00

130 lines
5.2 KiB
YAML

{{ if eq (include "multicluster.role" .) "member" }}
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: ks-agent
version: {{ .Chart.AppVersion }}
name: ks-agent
spec:
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
type: RollingUpdate
progressDeadlineSeconds: 600
replicas: {{ .Values.agent.replicaCount }}
revisionHistoryLimit: 10
selector:
matchLabels:
app: ks-agent
tier: backend
template:
metadata:
annotations:
# force restart ks-agent after the upgrade is complete if kubesphere-config changes
checksum/config: {{ include (print $.Template.BasePath "/kubesphere-config.yaml") . | sha256sum }}
labels:
app: ks-agent
tier: backend
spec:
serviceAccountName: {{ template "ks-core.serviceAccountName" . }}
{{- if .Values.global.imagePullSecrets }}
imagePullSecrets: {{ toYaml .Values.global.imagePullSecrets | nindent 8 }}
{{- end }}
{{- if .Values.nodeSelector }}
nodeSelector: {{- include "common.tplvalues.render" ( dict "value" .Values.nodeSelector "context" $) | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.tolerations }}
tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.tolerations "context" .) | nindent 8 }}
{{- end }}
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
terminationGracePeriodSeconds: 30
containers:
- name: ks-apiserver
image: {{ template "apiserver.image" . }}
imagePullPolicy: {{ .Values.apiserver.image.pullPolicy }}
{{- if .Values.apiserver.containerPorts }}
ports: {{- include "common.tplvalues.render" (dict "value" .Values.apiserver.containerPorts "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.apiserver.command }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.apiserver.command "context" $) | nindent 12 }}
{{- end }}
env:
{{- if .Values.apiserver.extraEnvVars }}
{{- include "common.tplvalues.render" (dict "value" .Values.apiserver.extraEnvVars "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.apiserver.resources }}
resources: {{- toYaml .Values.apiserver.resources | nindent 12 }}
{{- end }}
livenessProbe:
failureThreshold: 8
httpGet:
path: /version
port: 9090
scheme: HTTP
initialDelaySeconds: 15
timeoutSeconds: 15
volumeMounts:
- mountPath: /etc/kubesphere/
name: kubesphere-config
- mountPath: /etc/localtime
name: host-time
readOnly: true
{{- if .Values.apiserver.extraVolumeMounts }}
{{- include "common.tplvalues.render" (dict "value" .Values.apiserver.extraVolumeMounts "context" $) | nindent 12 }}
{{- end }}
- name: ks-controller-manager
image: {{ template "controller.image" . }}
imagePullPolicy: {{ .Values.controller.image.pullPolicy }}
{{- if .Values.controller.containerPorts }}
ports: {{- include "common.tplvalues.render" (dict "value" .Values.controller.containerPorts "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.controller.command }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.controller.command "context" $) | nindent 12 }}
{{- end }}
env:
{{- if .Values.controller.extraEnvVars }}
{{- include "common.tplvalues.render" (dict "value" .Values.controller.extraEnvVars "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.controller.resources }}
resources: {{- toYaml .Values.controller.resources | nindent 12 }}
{{- end }}
volumeMounts:
- mountPath: /etc/kubesphere/
name: kubesphere-config
- mountPath: /tmp/k8s-webhook-server/serving-certs
name: webhook-cert
- mountPath: /etc/localtime
name: host-time
readOnly: true
{{- if .Values.controller.extraVolumeMounts }}
{{- include "common.tplvalues.render" (dict "value" .Values.controller.extraVolumeMounts "context" $) | nindent 12 }}
{{- end }}
volumes:
- name: kubesphere-config
configMap:
name: kubesphere-config
defaultMode: 420
- name: webhook-cert
secret:
defaultMode: 420
secretName: ks-controller-manager-webhook-cert
- name: host-time
hostPath:
path: /etc/localtime
type: ""
{{- if .Values.controller.extraVolumes }}
{{- include "common.tplvalues.render" (dict "value" .Values.controller.extraVolumes "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.apiserver.extraVolumes }}
{{- include "common.tplvalues.render" (dict "value" .Values.apiserver.extraVolumes "context" $) | nindent 8 }}
{{- end }}
{{ end }}