diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 2f63da20d..765c81d6c 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -9,8 +9,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 - with: - ref: ${{ github.event.pull_request.head.sha }} - shell: bash env: diff --git a/helm/superset/templates/deployment-worker.yaml b/helm/superset/templates/deployment-worker.yaml new file mode 100644 index 000000000..47a8af651 --- /dev/null +++ b/helm/superset/templates/deployment-worker.yaml @@ -0,0 +1,87 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ template "superset.fullname" . }}-worker + labels: + app: {{ template "superset.name" . }}-worker + chart: {{ template "superset.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + app: {{ template "superset.name" . }}-worker + release: {{ .Release.Name }} + template: + metadata: + {{ if .Values.supersetWorker.forceReload }} + annotations: + # Optionally force the thing to reload + force-reload: {{ randAlphaNum 5 | quote }} + {{ end }} + labels: + app: {{ template "superset.name" . }}-worker + release: {{ .Release.Name }} + spec: + securityContext: + runAsUser: 0 # Needed in order to allow pip install to work in bootstrap + {{- if .Values.supersetWorker.initContainers }} + initContainers: + {{- tpl (toYaml .Values.supersetWorker.initContainers) . | nindent 6 }} + {{- end }} + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + command: {{ tpl (toJson .Values.supersetWorker.command) . }} + env: + - name: "SUPERSET_PORT" + value: {{ .Values.service.port | quote}} + {{ if .Values.extraEnv }} + {{- range $key, $value := .Values.extraEnv }} + - name: {{ $key | quote}} + value: {{ $value | quote }} + {{- end }} + {{- end }} + envFrom: + - secretRef: + name: {{ tpl .Values.envFromSecret . | quote }} + volumeMounts: + - name: superset-config + mountPath: {{ .Values.configMountPath | quote }} + readOnly: true + resources: +{{ toYaml .Values.resources | indent 12 }} + {{- with .Values.nodeSelector }} + nodeSelector: +{{ toYaml . | indent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: +{{ toYaml . | indent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: +{{ toYaml . | indent 8 }} + {{- end }} + volumes: + - name: superset-config + secret: + secretName: {{ tpl .Values.configFromSecret . }} diff --git a/helm/superset/templates/deployment.yaml b/helm/superset/templates/deployment.yaml index 063454619..12a71fab2 100644 --- a/helm/superset/templates/deployment.yaml +++ b/helm/superset/templates/deployment.yaml @@ -31,6 +31,11 @@ spec: release: {{ .Release.Name }} template: metadata: + {{ if .Values.supersetNode.forceReload }} + annotations: + # Optionally force the thing to reload + force-reload: {{ randAlphaNum 5 | quote }} + {{ end }} labels: app: {{ template "superset.name" . }} release: {{ .Release.Name }} diff --git a/helm/superset/templates/init-job.yaml b/helm/superset/templates/init-job.yaml index 58ab564ac..099b2ef45 100644 --- a/helm/superset/templates/init-job.yaml +++ b/helm/superset/templates/init-job.yaml @@ -19,6 +19,9 @@ apiVersion: batch/v1 kind: Job metadata: name: {{ template "superset.name" . }}-init-db + annotations: + "helm.sh/hook": post-install,post-upgrade + "helm.sh/hook-delete-policy": "before-hook-creation" spec: template: metadata: diff --git a/helm/superset/values.yaml b/helm/superset/values.yaml index b1a12766e..1c7102f18 100644 --- a/helm/superset/values.yaml +++ b/helm/superset/values.yaml @@ -44,12 +44,12 @@ extraEnv: {} configMountPath: "/app/pythonpath" image: - repository: preset/superset + repository: apache/incubator-superset tag: latest pullPolicy: IfNotPresent service: - type: NodePort + type: ClusterIP port: 8088 ingress: @@ -92,6 +92,24 @@ supersetNode: db_user: superset db_pass: superset db_name: superset + forceReload: false # If true, forces deployment to reload on each upgrade + initContainers: + - name: wait-for-postgres + image: busybox:latest + imagePullPolicy: IfNotPresent + envFrom: + - secretRef: + name: '{{ tpl .Values.envFromSecret . }}' + command: [ "/bin/sh", "-c", "until nc -zv $DB_HOST $DB_PORT -w1; do echo 'waiting for db'; sleep 1; done" ] + +## +## Superset worker configuration +supersetWorker: + command: + - "/bin/sh" + - "-c" + - ". {{ .Values.configMountPath }}/superset_bootstrap.sh; celery --app=superset.tasks.celery_app:app worker" + forceReload: false # If true, forces deployment to reload on each upgrade initContainers: - name: wait-for-postgres image: busybox:latest