feat: Helm improvements (#11700)

* 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
This commit is contained in:
Craig Rueda 2020-11-13 15:17:52 -08:00 committed by GitHub
parent 218f58edb7
commit 68693c7c0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 115 additions and 4 deletions

View File

@ -9,8 +9,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- shell: bash
env:

View File

@ -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 . }}

View File

@ -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 }}

View File

@ -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:

View File

@ -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