Skip to content

Instantly share code, notes, and snippets.

@orangewolf
Created September 1, 2020 18:03
Show Gist options
  • Save orangewolf/4436c9f31177e89f129d636d31911a3a to your computer and use it in GitHub Desktop.
Save orangewolf/4436c9f31177e89f129d636d31911a3a to your computer and use it in GitHub Desktop.
apiVersion: batch/v1
kind: Job
metadata:
name: {{ template "app.setup.name" . }}
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
annotations:
# This is what defines this resource as a hook. Without this line, the
# job is considered part of the release.
"helm.sh/hook": pre-install,pre-upgrade
"helm.sh/hook-weight": "-5"
"helm.sh/hook-delete-policy": before-hook-creation
spec:
backoffLimit: 4
template:
metadata:
labels:
app: {{ template "app.name" . }}
release: {{ .Release.Name }}
spec:
restartPolicy: Never
{{- if .Values.rails.imagePullSecrets }}
imagePullSecrets:
{{ toYaml .Values.rails.imagePullSecrets }}
{{- end }}
volumes:
- name: shared
persistentVolumeClaim:
claimName: {{ template "app.rails-env.name" . }}-shared
containers:
- name: setup
image: {{ .Values.rails.image.repository }}:{{ .Values.rails.image.tag }}
volumeMounts:
- mountPath: /app/public/assets
name: shared
subPath: assets
- mountPath: /app/public/packs
name: shared
subPath: packs
- mountPath: /app/public/system
name: shared
subPath: system
command: ["/bin/bash"]
args:
- "-l"
- "-c"
- "./chart/bin/solr-setup && RAILS_ENV=production bundle exec rails db:create db:migrate db:seed && echo SETUP COMPLETE"
envFrom:
- configMapRef:
name: {{ template "app.rails-env.name" . }}
- secretRef:
name: {{ template "app.rails-env.name" . }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment