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.
This commit is contained in:
Jose Diaz-Gonzalez committed 2024-02-06 13:54:53 -05:00
1 parent 8b2f37feea
commit f5f583b12b
16 files changed
+548 -14

No files matched your search

@@ -7,6 +7,16 @@ kind: Certificate
metadata:
annotations:
dokku.com/managed: "true"
{{- if and $.Values.global.annotations $.Values.global.annotations.certificate }}
{{- range $k, $v := $.Values.global.annotations.certificate }}
{{ $k }}: {{ $v | quote }}
{{- end }}
{{- end }}
{{- if and $config.annotations $config.annotations.certificate }}
{{- range $k, $v := $config.annotations.certificate }}
{{ $k }}: {{ $v | quote }}
{{- end }}
{{- end }}
labels:
app.kubernetes.io/name: {{ $.Values.global.app_name }}-{{ $processName }}
app.kubernetes.io/part-of: {{ $.Values.global.app_name }}
@@ -11,6 +11,16 @@ metadata:
dokku.com/job-suffix: {{ $config.cron.suffix }}
dokku.com/managed: "true"
kubectl.kubernetes.io/default-container: {{ $.Values.global.app_name }}-cron
{{- if and $.Values.global.annotations $.Values.global.annotations.cronjob }}
{{- range $k, $v := $.Values.global.annotations.cronjob }}
{{ $k }}: {{ $v | quote }}
{{- end }}
{{- end }}
{{- if and $config.annotations $config.annotations.cronjob }}
{{- range $k, $v := $config.annotations.cronjob }}
{{ $k }}: {{ $v | quote }}
{{- end }}
{{- end }}
labels:
app.kubernetes.io/instance: {{ $.Values.global.app_name }}-cron-{{ $config.cron.suffix }}
app.kubernetes.io/name: cron
@@ -30,6 +40,16 @@ spec:
dokku.com/job-suffix: {{ $config.cron.suffix }}
dokku.com/managed: "true"
kubectl.kubernetes.io/default-container: {{ $.Values.global.app_name }}-cron
{{- 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 }}-cron-{{ $config.cron.suffix }}
app.kubernetes.io/name: cron
@@ -9,6 +9,16 @@ metadata:
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 }}
@@ -31,6 +41,16 @@ spec:
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 }}
@@ -7,6 +7,16 @@ kind: Middleware
metadata:
annotations:
dokku.com/managed: "true"
{{- if and $.Values.global.annotations $.Values.global.annotations.traefik_middleware }}
{{- range $k, $v := $.Values.global.annotations.traefik_middleware }}
{{ $k }}: {{ $v | quote }}
{{- end }}
{{- end }}
{{- if and $config.annotations $config.annotations.traefik_middleware }}
{{- range $k, $v := $config.annotations.traefik_middleware }}
{{ $k }}: {{ $v | quote }}
{{- end }}
{{- end }}
labels:
app.kubernetes.io/instance: {{ $.Values.global.app_name }}-{{ $processName }}-redirect-to-https
app.kubernetes.io/name: {{ $processName }}
@@ -8,6 +8,16 @@ kind: IngressRoute
metadata:
annotations:
dokku.com/managed: "true"
{{- if and $.Values.global.annotations $.Values.global.annotations.traefik_ingressroute }}
{{- range $k, $v := $.Values.global.annotations.traefik_ingressroute }}
{{ $k }}: {{ $v | quote }}
{{- end }}
{{- end }}
{{- if and $config.annotations $config.annotations.traefik_ingressroute }}
{{- range $k, $v := $config.annotations.traefik_ingressroute }}
{{ $k }}: {{ $v | quote }}
{{- end }}
{{- end }}
labels:
app.kubernetes.io/instance: {{ $.Values.global.app_name }}-{{ $processName }}
app.kubernetes.io/name: {{ $processName }}
@@ -4,6 +4,11 @@ metadata:
annotations:
app.kubernetes.io/version: {{ $.Values.global.deploment_id | quote }}
dokku.com/managed: "true"
{{- if and $.Values.global.annotations $.Values.global.annotations.secret }}
{{- range $k, $v := $.Values.global.annotations.secret }}
{{ $k }}: {{ $v | quote }}
{{- end }}
{{- end }}
labels:
app.kubernetes.io/instance: env-{{ $.Values.global.app_name }}.{{ $.Values.global.deploment_id }}
app.kubernetes.io/name: env-{{ $.Values.global.app_name }}
@@ -1,6 +1,13 @@
apiVersion: v1
kind: ServiceAccount
metadata:
annotations:
dokku.com/managed: "true"
{{- if and $.Values.global.annotations $.Values.global.annotations.serviceaccount }}
{{- range $k, $v := $.Values.global.annotations.serviceaccount }}
{{ $k }}: {{ $v | quote }}
{{- end }}
{{- end }}
labels:
app.kubernetes.io/instance: service-account
app.kubernetes.io/name: service-account
@@ -6,6 +6,16 @@ kind: Service
metadata:
annotations:
dokku.com/managed: "true"
{{- if and $.Values.global.annotations $.Values.global.annotations.service }}
{{- range $k, $v := $.Values.global.annotations.service }}
{{ $k }}: {{ $v | quote }}
{{- end }}
{{- end }}
{{- if and $config.annotations $config.annotations.service }}
{{- range $k, $v := $config.annotations.service }}
{{ $k }}: {{ $v | quote }}
{{- end }}
{{- end }}
labels:
app.kubernetes.io/instance: {{ $.Values.global.app_name }}-{{ $processName }}
app.kubernetes.io/name: {{ $processName }}