diff --git a/charts/apexkube/Chart.yaml b/charts/apexkube/Chart.yaml index 8a3cfebd..4698dc16 100644 --- a/charts/apexkube/Chart.yaml +++ b/charts/apexkube/Chart.yaml @@ -5,4 +5,4 @@ maintainers: - name: improwised name: "apexkube" type: application -version: 1.1.0 +version: 1.2.0 diff --git a/charts/apexkube/templates/job.yaml b/charts/apexkube/templates/job.yaml new file mode 100644 index 00000000..e0c21f3f --- /dev/null +++ b/charts/apexkube/templates/job.yaml @@ -0,0 +1,116 @@ +{{- range .Values.jobs }} +--- +apiVersion: batch/v1 +kind: Job +metadata: +{{- if $.Values.prefixWithReleaseName.enabled }} + name: "{{ $.Release.Name }}-{{ .name | default $.Values.jobTemplate.name }}" +{{- else}} + name: "{{ .name | default $.Values.jobTemplate.name }}" +{{- end }} + labels: + {{- include "apexkube.labels" $ | nindent 4 }} + app.kubernetes.io/component: "{{ .name | default $.Values.jobTemplate.name }}" +{{- if or (.annotations) ($.Values.jobTemplate.annotations) }} + annotations: + {{- toYaml (.annotations | default $.Values.jobTemplate.annotations) | nindent 4 }} +{{- end }} +spec: + template: + metadata: + labels: + {{- include "apexkube.labels" $ | nindent 8 }} + app.kubernetes.io/component: "{{ .name | default $.Values.jobTemplate.name }}" + spec: + {{- if .imagePullSecrets }} + imagePullSecrets: +{{ toYaml .imagePullSecrets | indent 8 }} + {{- else if $.Values.jobTemplate.imagePullSecrets }} + imagePullSecrets: +{{ toYaml $.Values.jobTemplate.imagePullSecrets | indent 8 }} + {{- else }} + {{- if $.Values.imagePullSecrets }} + imagePullSecrets: +{{ toYaml $.Values.imagePullSecrets | indent 8 }} + {{- end }} + {{- end }} + restartPolicy: Never + containers: + {{- if $.Values.prefixWithReleaseName.enabled }} + - name: "{{ $.Release.Name }}-{{ .name | default $.Values.jobTemplate.name }}" + {{- else}} + - name: "{{ .name | default $.Values.jobTemplate.name }}" + {{- end }} + {{- if .image }} + image: "{{ .image.repository }}:{{ .image.tag }}" + {{- else if $.Values.jobTemplate.image }} + image: "{{ $.Values.jobTemplate.image.repository }}:{{ $.Values.jobTemplate.image.tag }}" + {{- else }} + image: "{{ $.Values.image.repository }}:{{ $.Values.image.tag }}" + {{- end }} + env: + {{- if .env }} +{{ toYaml .env | indent 12 }} + {{- end }} + {{- if $.Values.env }} +{{ toYaml $.Values.env | indent 12 }} + {{- end }} + {{- if $.Values.jobTemplate.env }} +{{ toYaml $.Values.jobTemplate.env | indent 12 }} + {{- end }} + envFrom: + {{- if .envFrom }} +{{ toYaml .envFrom | indent 12 }} + {{- end }} + {{- if $.Values.envFrom }} +{{ toYaml $.Values.envFrom | indent 12 }} + {{- end }} + {{- if $.Values.jobTemplate.envFrom }} +{{ toYaml $.Values.jobTemplate.envFrom | indent 12 }} + {{- end }} + imagePullPolicy: {{ $.Values.image.pullPolicy }} + {{- if .command }} + {{- with .command | default $.Values.jobTemplate.command }} + command: +{{ toYaml . | indent 12 }} + {{- end }} + {{- end }} + {{- if .args }} + {{- with .args | default $.Values.jobTemplate.args }} + args: +{{ toYaml . | indent 12 }} + {{- end }} + {{- end }} + volumeMounts: + {{- if .volumeMounts }} +{{ toYaml .volumeMounts | indent 10 }} + {{- end }} + {{- if $.Values.volumeMounts }} +{{ toYaml $.Values.volumeMounts | indent 10 }} + {{- end }} + {{- if $.Values.jobTemplate.volumeMounts }} +{{ toYaml $.Values.jobTemplate.volumeMounts | indent 10 }} + {{- end }} + {{- with .securityContext | default $.Values.jobTemplate.securityContext }} + securityContext: +{{ toYaml . | indent 8 }} + {{- end }} + {{- with .affinity | default $.Values.jobTemplate.affinity }} + affinity: +{{ toYaml . | indent 8 }} + {{- end }} + {{- with .tolerations | default $.Values.jobTemplate.tolerations }} + tolerations: +{{ toYaml . | indent 8 }} + {{- end }} + volumes: + {{- if .volumes }} +{{ toYaml .volumes | indent 8 }} + {{- end }} + {{- if $.Values.volumes }} +{{ toYaml $.Values.volumes | indent 8 }} + {{- end }} + {{- if $.Values.jobTemplate.volumes }} +{{ toYaml $.Values.jobTemplate.volumes | indent 8 }} + {{- end }} +{{- end }} diff --git a/charts/apexkube/values.yaml b/charts/apexkube/values.yaml index 54cd4300..c7d8b52b 100644 --- a/charts/apexkube/values.yaml +++ b/charts/apexkube/values.yaml @@ -66,9 +66,9 @@ serviceTemplate: env: [] envFrom: [] ports: - - name: http - containerPort: 80 - protocol: TCP + - name: http + containerPort: 80 + protocol: TCP resources: {} # We usually recommend not to specify default resources and to leave this as a conscious # choice for the user. This also increases chances charts run on environments with little @@ -108,10 +108,10 @@ serviceTemplate: # className: nginx type: ClusterIP ports: - - name: http - port: 80 - targetPort: http - protocol: TCP + - name: http + port: 80 + targetPort: http + protocol: TCP annotations: {} ingress: @@ -127,7 +127,7 @@ serviceTemplate: # hosts: # - chart-example.local -# Enables Gateway API HTTPRoute as a replacement for traditional Ingress resources + # Enables Gateway API HTTPRoute as a replacement for traditional Ingress resources httpRoute: enabled: false annotations: {} @@ -151,3 +151,16 @@ serviceTemplate: # value: https services: [] + +jobTemplate: + name: job + image: + env: [] + envFrom: [] + command: + annotations: {} + volumeMounts: [] + securityContext: {} + volumes: [] + +jobs: []