Files
dokku/plugins/scheduler-k3s/templates/chart/deployment.yaml
T
Jose Diaz-Gonzalez f5f583b12b feat: add support for specifying annotations
As the command contains a colon, it must be handled in the commands binary as opposed to subcommands.

Also include a simple bats test.
2024-02-06 13:54:53 -05:00

124 lines
4.8 KiB
YAML

{{- $processName := "PROCESS_NAME" }}
{{- $config := index .Values.processes "PROCESS_NAME" }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
app.kubernetes.io/version: {{ $.Values.global.deploment_id | quote }}
dokku.com/builder-type: {{ $.Values.global.image.type }}
dokku.com/managed: "true"
kubectl.kubernetes.io/default-container: {{ $.Values.global.app_name }}-{{ $processName }}
{{- if and $.Values.global.annotations $.Values.global.annotations.deployment }}
{{- range $k, $v := $.Values.global.annotations.deployment }}
{{ $k }}: {{ $v | quote }}
{{- end }}
{{- end }}
{{- if and $config.annotations $config.annotations.deployment }}
{{- range $k, $v := $config.annotations.deployment }}
{{ $k }}: {{ $v | quote }}
{{- end }}
{{- end }}
labels:
app.kubernetes.io/instance: {{ $.Values.global.app_name }}-{{ $processName }}
app.kubernetes.io/name: {{ $processName }}
app.kubernetes.io/part-of: {{ $.Values.global.app_name }}
name: {{ $.Values.global.app_name }}-{{ $processName }}
namespace: {{ $.Values.global.namespace }}
spec:
replicas: {{ $config.replicas }}
revisionHistoryLimit: 5
selector:
matchLabels:
app.kubernetes.io/instance: {{ $.Values.global.app_name }}-{{ $processName }}
app.kubernetes.io/name: {{ $processName }}
app.kubernetes.io/part-of: {{ $.Values.global.app_name }}
strategy: {}
template:
metadata:
annotations:
app.kubernetes.io/version: {{ $.Values.global.deploment_id | quote }}
dokku.com/builder-type: {{ $.Values.global.image.type }}
dokku.com/managed: "true"
kubectl.kubernetes.io/default-container: {{ $.Values.global.app_name }}-{{ $processName }}
{{- if and $.Values.global.annotations $.Values.global.annotations.pod }}
{{- range $k, $v := $.Values.global.annotations.pod }}
{{ $k }}: {{ $v | quote }}
{{- end }}
{{- end }}
{{- if and $config.annotations $config.annotations.pod }}
{{- range $k, $v := $config.annotations.pod }}
{{ $k }}: {{ $v | quote }}
{{- end }}
{{- end }}
labels:
app.kubernetes.io/instance: {{ $.Values.global.app_name }}-{{ $processName }}
app.kubernetes.io/name: {{ $processName }}
app.kubernetes.io/part-of: {{ $.Values.global.app_name }}
spec:
containers:
- args:
{{- range $config.args }}
- {{ . }}
{{- end }}
{{- if eq $processName "web" }}
env:
- name: PORT
value: "{{ $.Values.global.network.primary_port }}"
{{- end }}
envFrom:
- secretRef:
name: env-{{ $.Values.global.app_name }}.{{ $.Values.global.deploment_id }}
optional: true
image: {{ $.Values.global.image.name }}
imagePullPolicy: Always
name: {{ $.Values.global.app_name }}-{{ $processName }}
{{- if eq $processName "web" }}
ports:
{{- range $pdx, $port_map := $config.web.port_maps }}
- containerPort: {{ $port_map.container_port }}
name: {{ $port_map.name }}
protocol: {{ $port_map.protocol }}
{{- end }}
{{- end }}
{{- if and $config.resources (or $config.resources.limits $config.resources.requests) }}
resources:
{{- if $config.resources.limits }}
limits:
{{- if $config.resources.limits.cpu }}
cpu: {{ $config.resources.limits.cpu }}
{{- end }}
{{- if $config.resources.limits.memory }}
memory: {{ $config.resources.limits.memory }}
{{- end }}
{{- end }}
{{- if $config.resources.requests }}
requests:
{{- if $config.resources.requests.cpu }}
cpu: {{ $config.resources.requests.cpu }}
{{- end }}
{{- if $config.resources.requests.memory }}
memory: {{ $config.resources.requests.memory }}
{{- end }}
{{- end }}
{{- end }}
{{- if and $config.healthchecks $config.healthchecks.startup }}
startupProbe:
{{ $config.healthchecks.startup | toJson | indent 10 }}
{{- end }}
{{- if and $config.healthchecks $config.healthchecks.liveness }}
livenessProbe:
{{ $config.healthchecks.liveness | toJson | indent 10 }}
{{- end }}
{{- if and $config.healthchecks $config.healthchecks.readiness }}
readinessProbe:
{{ $config.healthchecks.readiness | toJson | indent 10 }}
{{- end }}
{{- if $.Values.global.image.working_dir }}
workingDir: {{ $.Values.global.image.working_dir }}
{{- end }}
{{- if $.Values.global.image.image_pull_secrets }}
imagePullSecrets: {{ $.Values.global.image.image_pull_secrets }}
{{- end }}
serviceAccountName: {{ $.Values.global.app_name }}