freeleaps-ops/freeleaps/helm-pkg/content/templates/deployment.yaml
2025-02-21 17:59:08 +08:00

98 lines
5.0 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
app.kubernetes.io/name: "content"
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
name: "content"
namespace: {{ .Release.Namespace | quote }}
spec:
selector:
matchLabels:
app.kubernetes.io/name: "content"
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
replicas: {{ .Values.content.replicas }}
template:
metadata:
labels:
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
app.kubernetes.io/name: "content"
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
containers:
- name: "content"
image: "{{ coalesce .Values.content.image.registry .Values.global.registry "docker.io"}}/{{ coalesce .Values.content.image.repository .Values.global.repository }}/{{ .Values.content.image.name }}:{{ .Values.content.image.tag | default "latest" }}"
imagePullPolicy: {{ .Values.content.image.imagePullPolicy | default "IfNotPresent" }}
ports:
{{- range $port := .Values.content.ports }}
- containerPort: {{ $port.containerPort }}
name: {{ $port.name }}
protocol: {{ $port.protocol }}
{{- end }}
{{- if .Values.content.resources }}
resources:
{{- toYaml .Values.content.resources | nindent 12 }}
{{- end }}
{{- if .Values.content.probes }}
{{- if and (.Values.content.probes.liveness) (eq .Values.content.probes.liveness.type "httpGet") }}
livenessProbe:
httpGet:
path: {{ .Values.content.probes.liveness.config.path }}
port: {{ .Values.content.probes.liveness.config.port }}
{{- if .Values.content.probes.liveness.config.initialDelaySeconds }}
initialDelaySeconds: {{ .Values.content.probes.liveness.config.initialDelaySeconds }}
{{- end }}
{{- if .Values.content.probes.liveness.config.periodSeconds }}
periodSeconds: {{ .Values.content.probes.liveness.config.periodSeconds }}
{{- end }}
{{- if .Values.content.probes.liveness.config.timeoutSeconds }}
timeoutSeconds: {{ .Values.content.probes.liveness.config.timeoutSeconds }}
{{- end }}
{{- if .Values.content.probes.liveness.config.successThreshold }}
successThreshold: {{ .Values.content.probes.liveness.config.successThreshold }}
{{- end }}
{{- if .Values.content.probes.liveness.config.failureThreshold }}
failureThreshold: {{ .Values.content.probes.liveness.config.failureThreshold }}
{{- end }}
{{- if .Values.content.probes.liveness.config.terminationGracePeriodSeconds }}
terminationGracePeriodSeconds: {{ .Values.content.probes.liveness.config.terminationGracePeriodSeconds }}
{{- end }}
{{- end }}
{{- if and (.Values.content.probes.readiness) (eq .Values.content.probes.readiness.type "httpGet") }}
readinessProbe:
httpGet:
path: {{ .Values.content.probes.readiness.config.path }}
port: {{ .Values.content.probes.readiness.config.port }}
{{- if .Values.content.probes.readiness.config.initialDelaySeconds }}
initialDelaySeconds: {{ .Values.content.probes.readiness.config.initialDelaySeconds }}
{{- end }}
{{- if .Values.content.probes.readiness.config.periodSeconds }}
periodSeconds: {{ .Values.content.probes.readiness.config.periodSeconds }}
{{- end }}
{{- if .Values.content.probes.readiness.config.timeoutSeconds }}
timeoutSeconds: {{ .Values.content.probes.readiness.config.timeoutSeconds }}
{{- end }}
{{- if .Values.content.probes.readiness.config.successThreshold }}
successThreshold: {{ .Values.content.probes.readiness.config.successThreshold }}
{{- end }}
{{- if .Values.content.probes.readiness.config.failureThreshold }}
failureThreshold: {{ .Values.content.probes.readiness.config.failureThreshold }}
{{- end }}:%
{{- if .Values.content.probes.readiness.config.terminationGracePeriodSeconds }}
terminationGracePeriodSeconds: {{ .Values.content.probes.readiness.config.terminationGracePeriodSeconds }}
{{- end }}
{{- end }}
{{- end}}
env:
{{- range $key, $value := .Values.content.configs }}
- name: {{ $key | snakecase | upper }}
valueFrom:
secretKeyRef:
name: content-config
key: {{ $key | snakecase | upper }}
{{- end }}