diff --git a/charts/backend/Chart.yaml b/charts/backend/Chart.yaml index a00eb55..22d4302 100644 --- a/charts/backend/Chart.yaml +++ b/charts/backend/Chart.yaml @@ -2,5 +2,5 @@ apiVersion: v2 name: backend description: Helm chart scaffolding for Backend applications. type: application -version: 3.6.1 +version: 3.6.2 appVersion: 1.3.0 diff --git a/charts/backend/templates/cronjob.yaml b/charts/backend/templates/cronjob.yaml index e2f51ff..4610e4e 100644 --- a/charts/backend/templates/cronjob.yaml +++ b/charts/backend/templates/cronjob.yaml @@ -60,9 +60,7 @@ spec: {{- if .Values.cronjob.config.command }} command: - {{- range $v := .Values.cronjob.config.command }} - - "{{ $v }}" - {{- end }} + {{- toYaml .Values.cronjob.config.command | nindent 14 }} {{- end }} {{- if .Values.cronjob.config.args }} diff --git a/charts/backend/templates/extra-list.yaml b/charts/backend/templates/extra-list.yaml new file mode 100644 index 0000000..c982f21 --- /dev/null +++ b/charts/backend/templates/extra-list.yaml @@ -0,0 +1,3 @@ +{{- if .Values.extraDeploy.enabled -}} +{{- tpl .Values.extraDeploy.yaml . | nindent 0 }} +{{- end }} diff --git a/charts/backend/values.yaml b/charts/backend/values.yaml index bffa252..9fcb049 100644 --- a/charts/backend/values.yaml +++ b/charts/backend/values.yaml @@ -267,7 +267,6 @@ blackfire: ; blackfire.agent_socket=tcp://blackfire:8307 - externalsecrets: enabled: true envpath: /tmp @@ -278,6 +277,21 @@ externalsecrets: - DB_HOST - DB_USERNAME +extraDeploy: + enabled: false + yaml: | + apiVersion: v1 + kind: Pod + metadata: + name: nginx + spec: + containers: + - name: nginx + image: nginx:1.14.2 + ports: + - containerPort: 80 + + cronjob: enabled: false schedule: "* * * * *" diff --git a/charts/frontend/Chart.yaml b/charts/frontend/Chart.yaml index e22a3f6..cc0d646 100644 --- a/charts/frontend/Chart.yaml +++ b/charts/frontend/Chart.yaml @@ -2,5 +2,5 @@ apiVersion: v2 name: frontend description: A frontend Helm chart for Kubernetes type: application -version: 2.1.4 +version: 3.6.2 appVersion: "0.3.10" diff --git a/charts/frontend/templates/configmap-cronjob.yaml b/charts/frontend/templates/configmap-cronjob.yaml new file mode 100644 index 0000000..c5a6560 --- /dev/null +++ b/charts/frontend/templates/configmap-cronjob.yaml @@ -0,0 +1,17 @@ +{{- if .Values.cronjob.configMaps }} +{{- range $v := .Values.cronjob.configMaps }} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ $v.name }} +binaryData: + {{- range $f := $v.files }} + {{- if $f.contentsB64 }} + {{ $f.key }}: "{{ $f.contentsB64 }}" + {{- else }} + {{ $f.key }}: "{{ ($.Files.Get $f.contentsFile) | b64enc }}" + {{- end }} + {{- end }} +--- +{{- end }} +{{- end }} diff --git a/charts/frontend/templates/cronjob.yaml b/charts/frontend/templates/cronjob.yaml new file mode 100644 index 0000000..4610e4e --- /dev/null +++ b/charts/frontend/templates/cronjob.yaml @@ -0,0 +1,99 @@ +{{- if .Values.cronjob.enabled }} +apiVersion: batch/v1 +kind: CronJob +metadata: + name: {{ include "laravel.fullname" . }} +spec: + schedule: "{{ .Values.cronjob.schedule }}" + concurrencyPolicy: "{{ .Values.cronjob.concurrencyPolicy }}" + failedJobsHistoryLimit: {{ .Values.cronjob.failedJobsHistoryLimit }} + successfulJobsHistoryLimit: {{ .Values.cronjob.successfulJobsHistoryLimit }} + + jobTemplate: + spec: + template: + metadata: + labels: + app: {{ include "laravel.fullname" . }} + annotations: + {{- if .Values.cronjob.configMaps }} + {{- range $v := .Values.cronjob.configMaps }} + {{- range $f := $v.files }} + {{- if $f.contentsB64 }} + checksum/{{ $v.name }}-{{ $f.key }}: "{{ $f.contentsB64 | sha256sum }}" + {{- else }} + checksum/{{ $v.name }}-{{ $f.key }}: "{{ ($.Files.Get $f.contentsFile) | b64enc | sha256sum }}" + {{- end }} + {{- end }} + {{- end }} + {{- end }} + spec: + {{- if .Values.cronjob.cloudserviceaccount.deploy }} + serviceAccountName: {{ .Values.cronjob.cloudserviceaccount.name }} + {{- end }} + automountServiceAccountToken: true + + {{- if not .Values.cronjob.image.isRepositoryPublic }} + imagePullSecrets: + - name: {{ .Values.cronjob.dockerconfigjson.name }} + {{- end }} + + restartPolicy: "{{ .Values.cronjob.restartPolicy }}" + + {{- if .Values.cronjob.configMaps }} + volumes: + {{- range $v := .Values.cronjob.configMaps }} + - configMap: + name: {{ $v.name }} + optional: false + name: {{ $v.name }} + {{- end }} + {{- end }} + {{- with .Values.cronjob.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + containers: + - name: "{{ include "laravel.fullname" . }}" + image: "{{ .Values.cronjob.image.repository }}:{{ .Values.cronjob.image.tag }}" + imagePullPolicy: {{ default "IfNotPresent" .Values.cronjob.image.pullPolicy }} + + {{- if .Values.cronjob.config.command }} + command: + {{- toYaml .Values.cronjob.config.command | nindent 14 }} + {{- end }} + + {{- if .Values.cronjob.config.args }} + args: + {{- range $v := .Values.cronjob.config.args }} + - "{{ $v }}" + {{- end }} + {{- end }} + + {{- if .Values.cronjob.config.env }} + env: + {{- range $k, $v := .Values.cronjob.config.env }} + - name: "{{ $k }}" + value: "{{ $v }}" + {{- end }} + {{- end }} + + {{- if .Values.cronjob.config.secrets }} + envFrom: + - secretRef: + name: {{ .Release.Name }}-cronjob-secret + {{- end }} + + {{- if .Values.cronjob.configMaps }} + volumeMounts: + {{- range $v := .Values.cronjob.configMaps }} + - mountPath: "{{ $v.mountPath }}" + {{- if $v.mountPropagation }} + mountPropagation: {{ $v.mountPropagation }} + {{- else }} + mountPropagation: None + {{- end }} + name: {{ $v.name }} + {{- end }} + {{- end }} +{{- end }} diff --git a/charts/frontend/templates/extra-list.yaml b/charts/frontend/templates/extra-list.yaml new file mode 100644 index 0000000..c982f21 --- /dev/null +++ b/charts/frontend/templates/extra-list.yaml @@ -0,0 +1,3 @@ +{{- if .Values.extraDeploy.enabled -}} +{{- tpl .Values.extraDeploy.yaml . | nindent 0 }} +{{- end }} diff --git a/charts/frontend/templates/secret-cronjob.yaml b/charts/frontend/templates/secret-cronjob.yaml new file mode 100644 index 0000000..398a557 --- /dev/null +++ b/charts/frontend/templates/secret-cronjob.yaml @@ -0,0 +1,12 @@ +{{- if .Values.cronjob.config.secrets }} +apiVersion: v1 +kind: Secret +metadata: + namespace: {{ .Release.Namespace }} + name: {{ .Release.Name }}-cronjob-secret +type: Opaque +data: + {{- range $k, $v := .Values.cronjob.config.secrets }} + {{ $k }}: "{{ $v | b64enc }}" + {{- end }} +{{- end }} diff --git a/charts/frontend/values.yaml b/charts/frontend/values.yaml index 6b2bd15..49ad29a 100644 --- a/charts/frontend/values.yaml +++ b/charts/frontend/values.yaml @@ -132,3 +132,83 @@ secretenv: env: dev product: application + +extraDeploy: + enabled: false + yaml: | + apiVersion: v1 + kind: Pod + metadata: + name: nginx + spec: + containers: + - name: nginx + image: nginx:1.14.2 + ports: + - containerPort: 80 + + +cronjob: + enabled: false + schedule: "* * * * *" + concurrencyPolicy: "Forbid" + restartPolicy: "Never" + failedJobsHistoryLimit: 10 + successfulJobsHistoryLimit: 1 + nodeSelector: {} + image: + repository: "busybox" + tag: "latest" + # -- Whether the repository is public + isRepositoryPublic: true + # -- The image pullPolicy to use + pullPolicy: "IfNotPresent" + + config: + command: [] + # - "/bin/sh" + args: [] + # - "-c" + # - "echo 'Environment $(hello_env)! Secret $(username).'" + + # -- Map of environment variables to use within the job + env: {} + # hello_env: "world" + + # -- Map of secrets that will be exposed as environment variables within the job + secrets: {} + # username: "password" + + # -- List of config maps to mount to the deployment + configMaps: [] + # - name: "volume-1" + # mountPath: "/etc/config" # Must be unique + # mountPropagation: None # If unset will default to 'None' + # files: [] + # - key: "file.cfg" # Key must be unique for each file + # contentsB64: "" # The file contents which have already been base-64 encoded + # contentsFile: "" # The path to a local file (note: contentsB64 will take precedence if not-empty) + + dockerconfigjson: + # -- Name of the secret to use for the private repository + name: "snowplow-cron-job-dockerhub" + # -- Username for the private repository + username: "" + # -- Password for the private repository + password: "" + # -- Repository server URL + server: "https://index.docker.io/v1/" + # -- Email address for user of the private repository + email: "" + + cloudserviceaccount: + # -- Whether to create a service-account + deploy: false + # -- Name of the service-account to create + name: "snowplow-cron-job-service-account" + aws: + # -- IAM Role ARN to bind to the k8s service account + roleARN: "" + gcp: + # -- Service Account email to bind to the k8s service account + serviceAccount: ""