91 lines
2.4 KiB
YAML
91 lines
2.4 KiB
YAML
{{- range $name, $app := .Values.apps }}
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: {{ $name }}
|
|
namespace: {{ include "planpal.namespace" $ }}
|
|
annotations:
|
|
argocd.argoproj.io/sync-wave: "1"
|
|
spec:
|
|
selector:
|
|
matchLabels: { app: {{ $name }} }
|
|
template:
|
|
metadata:
|
|
labels: { app: {{ $name }} }
|
|
spec:
|
|
{{- if eq $app.image "backend" }}
|
|
serviceAccountName: {{ $.Values.serviceAccount.name }}
|
|
{{- end }}
|
|
containers:
|
|
- name: {{ $name }}
|
|
image: {{ include "planpal.image" (dict "Values" $.Values "which" $app.image) }}
|
|
imagePullPolicy: {{ $.Values.image.pullPolicy }}
|
|
{{- with $app.command }}
|
|
command: {{ toJson . }}
|
|
{{- end }}
|
|
ports:
|
|
{{- range $app.ports }}
|
|
- {{ toJson . }}
|
|
{{- end }}
|
|
envFrom:
|
|
{{- range $app.envFrom }}
|
|
- secretRef: { name: {{ . }} }
|
|
{{- end }}
|
|
{{- if $app.probePath }}
|
|
readinessProbe:
|
|
httpGet: { path: {{ $app.probePath }}, port: {{ $app.probePort }} }
|
|
initialDelaySeconds: 5
|
|
periodSeconds: 10
|
|
livenessProbe:
|
|
httpGet: { path: {{ $app.probePath }}, port: {{ $app.probePort }} }
|
|
initialDelaySeconds: 15
|
|
periodSeconds: 10
|
|
{{- end }}
|
|
resources: {{ toJson $app.resources }}
|
|
---
|
|
{{- if $app.service }}
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: {{ $name }}
|
|
namespace: {{ include "planpal.namespace" $ }}
|
|
{{- with $app.service.annotations }}
|
|
annotations: {{ toJson . }}
|
|
{{- end }}
|
|
spec:
|
|
selector: { app: {{ $name }} }
|
|
ports:
|
|
- name: http
|
|
port: {{ $app.service.port }}
|
|
targetPort: {{ $app.service.targetPort }}
|
|
---
|
|
{{- end }}
|
|
{{- with $app.hpa }}
|
|
apiVersion: autoscaling/v2
|
|
kind: HorizontalPodAutoscaler
|
|
metadata:
|
|
name: {{ $name }}
|
|
namespace: {{ include "planpal.namespace" $ }}
|
|
spec:
|
|
scaleTargetRef: { apiVersion: apps/v1, kind: Deployment, name: {{ $name }} }
|
|
minReplicas: {{ .min }}
|
|
maxReplicas: {{ .max }}
|
|
metrics:
|
|
- type: Resource
|
|
resource: { name: cpu, target: { type: Utilization, averageUtilization: {{ .cpu }} } }
|
|
---
|
|
{{- end }}
|
|
{{- with $app.pdb }}
|
|
apiVersion: policy/v1
|
|
kind: PodDisruptionBudget
|
|
metadata:
|
|
name: {{ $name }}
|
|
namespace: {{ include "planpal.namespace" $ }}
|
|
spec:
|
|
maxUnavailable: {{ .maxUnavailable }}
|
|
selector:
|
|
matchLabels: { app: {{ $name }} }
|
|
---
|
|
{{- end }}
|
|
{{- end }}
|