added init container to install plugins

This commit is contained in:
Sebastian Sdorra
2018-11-26 16:55:29 +01:00
parent 248d5ce3d8
commit 7c754d5ee4
3 changed files with 41 additions and 0 deletions

View File

@@ -29,6 +29,17 @@ spec:
volumeMounts:
- name: data
mountPath: /data
{{- if .Values.plugins }}
- name: install-plugins
image: alpine:3.8
imagePullPolicy: IfNotPresent
command: ['sh', '/scripts/install-plugins.sh']
volumeMounts:
- name: data
mountPath: /data
- name: scripts
mountPath: /scripts
{{- end }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
@@ -63,6 +74,11 @@ spec:
- name: config
configMap:
name: {{ include "scm-manager.fullname" . }}
{{- if .Values.plugins }}
- name: scripts
configMap:
name: {{ include "scm-manager.fullname" . }}-scripts
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 8 }}

View File

@@ -0,0 +1,21 @@
{{- if .Values.plugins }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "scm-manager.fullname" . }}-scripts
labels:
app: {{ include "scm-manager.name" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
data:
install-plugins.sh: |
#!/bin/sh
mkdir -p /data/plugins
chown 1000:1000 /data/plugins
{{ range $i, $plugin := .Values.plugins }}
# install plugin {{ $plugin.name }}
wget -O /data/plugins/{{ $plugin.name }}.smp {{ $plugin.url }}
chown 1000:1000 /data/plugins/{{ $plugin.name }}.smp
{{ end }}
{{- end }}

View File

@@ -10,6 +10,10 @@ image:
tag: latest
pullPolicy: Always
# plugins:
# - name: scm-review-plugin
# url: https://oss.cloudogu.com/jenkins/job/scm-manager/job/scm-manager-bitbucket/job/scm-review-plugin/job/develop/lastSuccessfulBuild/artifact/target/scm-review-plugin-2.0.0-SNAPSHOT.smp
nameOverride: ""
fullnameOverride: ""