Skip to content

Commit

Permalink
feat: Helm improvements (apache#11700)
Browse files Browse the repository at this point in the history
* Adding docker build/push

* Adding build script

* Trying username

* Updating build script

* Fixing script path?

* Lising envvars

* Pulling HEAD

* Actually pushing

* Fixing build / SHA

* Logout before login

* updating docker login

* Fixing docker login

* Trying stdin pwd

* Adding check for forks

* Fixing tagging

* Fixing refspec

* Updating Dockerfile-dev

* Adding license to script

* Fixing Cypress tests

* Adding Helm hooks and force reload option

* Adding worker pod

* Removing head SHA checkout in docker.yml
  • Loading branch information
craig-rueda authored and auxten committed Nov 20, 2020
1 parent 5eb0654 commit 79f94f0
Show file tree
Hide file tree
Showing 5 changed files with 115 additions and 4 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}

- shell: bash
env:
Expand Down
87 changes: 87 additions & 0 deletions helm/superset/templates/deployment-worker.yaml
Original file line number Diff line number Diff line change
@@ -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 . }}
5 changes: 5 additions & 0 deletions helm/superset/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
3 changes: 3 additions & 0 deletions helm/superset/templates/init-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
22 changes: 20 additions & 2 deletions helm/superset/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 79f94f0

Please sign in to comment.