diff --git a/templates/worker-deployment.yaml b/templates/worker-deployment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..56618eec2cee83eec798e7a1f6c96531188a285c --- /dev/null +++ b/templates/worker-deployment.yaml @@ -0,0 +1,82 @@ +{{- if and (not .Values.application.initializeCommand) .Values.workers -}} +apiVersion: v1 +kind: List +items: +{{- range $workerName, $workerConfig := .Values.workers }} +- apiVersion: extensions/v1beta1 + kind: Deployment + metadata: + name: {{ template "trackableappname" $ }}-{{ $workerName }} + annotations: + {{ if $.Values.gitlab.app }}app.gitlab.com/app: {{ $.Values.gitlab.app | quote }}{{ end }} + {{ if $.Values.gitlab.env }}app.gitlab.com/env: {{ $.Values.gitlab.env | quote }}{{ end }} + labels: + track: "{{ $.Values.application.track }}" + tier: worker + chart: "{{ $.Chart.Name }}-{{ $.Chart.Version | replace "+" "_" }}" + release: {{ $.Release.Name }} + heritage: {{ $.Release.Service }} + spec: + replicas: {{ $workerConfig.replicaCount }} + template: + metadata: + annotations: + checksum/application-secrets: "{{ $.Values.application.secretChecksum }}" + {{ if $.Values.gitlab.app }}app.gitlab.com/app: {{ $.Values.gitlab.app | quote }}{{ end }} + {{ if $.Values.gitlab.env }}app.gitlab.com/env: {{ $.Values.gitlab.env | quote }}{{ end }} + {{- if $.Values.podAnnotations }} + {{ toYaml $.Values.podAnnotations | indent 10 }} + {{- end }} + labels: + track: "{{ $.Values.application.track }}" + tier: worker + release: {{ $.Release.Name }} + spec: + imagePullSecrets: + {{ toYaml $.Values.image.secrets | indent 12 }} + terminationGracePeriodSeconds: {{ $workerConfig.terminationGracePeriodSeconds }} + containers: + - name: {{ $.Chart.Name }}-{{ $workerName }} + image: "{{ $.Values.image.repository }}:{{ $.Values.image.tag }}" + command: + {{- range $workerConfig.command }} + - {{ . }} + {{- end }} + imagePullPolicy: {{ $.Values.image.pullPolicy }} + {{- if $.Values.application.secretName }} + envFrom: + - secretRef: + name: {{ $.Values.application.secretName }} + {{- end }} + env: + - name: DATABASE_URL + value: {{ $.Values.application.database_url | quote }} + - name: GITLAB_ENVIRONMENT_NAME + value: {{ $.Values.gitlab.envName }} + livenessProbe: + httpGet: + path: {{ $.Values.livenessProbe.path }} + port: {{ $.Values.service.internalPort }} + scheme: {{ $.Values.livenessProbe.scheme }} + initialDelaySeconds: {{ $.Values.livenessProbe.initialDelaySeconds }} + timeoutSeconds: {{ $.Values.livenessProbe.timeoutSeconds }} + readinessProbe: + httpGet: + path: {{ $.Values.readinessProbe.path }} + port: {{ $.Values.service.internalPort }} + scheme: {{ $.Values.readinessProbe.scheme }} + initialDelaySeconds: {{ $.Values.readinessProbe.initialDelaySeconds }} + timeoutSeconds: {{ $.Values.readinessProbe.timeoutSeconds }} + {{- if $workerConfig.preStopCommand }} + lifecycle: + preStop: + exec: + command: + {{- range $workerConfig.preStopCommand }} + - {{ . }} + {{- end }} + {{- end }} + resources: + {{ toYaml $.Values.resources | indent 14 }} +{{- end -}} +{{- end -}} diff --git a/values.yaml b/values.yaml index 99c2a4410670b817fa51bc3f2ac11ee2ae858350..ea83b36b7acb2207e578f2b8eb2e03ef92780232 100644 --- a/values.yaml +++ b/values.yaml @@ -69,3 +69,18 @@ podDisruptionBudget: enabled: false # minAvailable: 1 maxUnavailable: 1 + +workers: + # worker: + # replicaCount: 1 + # terminationGracePeriodSeconds: 60 + # command: + # - /bin/herokuish + # - procfile + # - start + # - worker + # preStopCommand: + # - /bin/herokuish + # - procfile + # - start + # - stop_worker