diff --git a/CHANGELOG.md b/CHANGELOG.md index 565758ed00..70988a7e6d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased ### Added +- Provide more options for Helm chart ([#1485](https://github.com/scm-manager/scm-manager/pull/1485)) - Option to create a permanent link to a source file ([#1489](https://github.com/scm-manager/scm-manager/pull/1489)) - add markdown codeblock renderer extension point ([#1492](https://github.com/scm-manager/scm-manager/pull/1492)) diff --git a/scm-packaging/helm/pom.xml b/scm-packaging/helm/pom.xml index 13a581a1c9..7700db7091 100644 --- a/scm-packaging/helm/pom.xml +++ b/scm-packaging/helm/pom.xml @@ -146,7 +146,7 @@ com.kiwigrid helm-maven-plugin - 5.4 + 5.6 true ${project.basedir}/target/chart @@ -164,6 +164,8 @@ ${helm.repository} ARTIFACTORY + + false diff --git a/scm-packaging/helm/src/main/chart/templates/deployment.yaml b/scm-packaging/helm/src/main/chart/templates/deployment.yaml index 4172100f31..c3d97577b0 100644 --- a/scm-packaging/helm/src/main/chart/templates/deployment.yaml +++ b/scm-packaging/helm/src/main/chart/templates/deployment.yaml @@ -68,6 +68,10 @@ spec: - name: {{ .Chart.Name }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- if .Values.lifecycleHooks }} + lifecycle: +{{ tpl .Values.lifecycleHooks . | indent 12 }} + {{- end }} ports: - name: http containerPort: 8080 @@ -89,6 +93,17 @@ spec: mountPath: /var/lib/scm - name: config mountPath: /opt/scm-server/conf + {{- with .Values.extraVolumeMounts }} + {{- tpl . $ | nindent 12 }} + {{- end }} + env: + {{- with .Values.extraEnv }} + {{- tpl . $ | nindent 12 }} + {{- end }} + envFrom: + {{- with .Values.extraEnvFrom }} + {{- tpl . $ | nindent 12 }} + {{- end }} volumes: - name: data {{- if .Values.persistence.enabled }} @@ -105,6 +120,9 @@ spec: configMap: name: {{ include "scm-manager.fullname" . }}-scripts {{- end }} + {{- with .Values.extraVolumes }} + {{- tpl . $ | nindent 8 }} + {{- end }} {{- with .Values.nodeSelector }} nodeSelector: {{ toYaml . | indent 8 }} diff --git a/scm-packaging/helm/src/main/chart/templates/scripts.yaml b/scm-packaging/helm/src/main/chart/templates/scripts.yaml index f66eaca5fb..d2d54b7346 100644 --- a/scm-packaging/helm/src/main/chart/templates/scripts.yaml +++ b/scm-packaging/helm/src/main/chart/templates/scripts.yaml @@ -38,8 +38,8 @@ data: 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 + # install plugin {{ tpl $plugin.name $ }} + wget -O /data/plugins/{{ tpl $plugin.name $ }}.smp {{ tpl $plugin.url $ }} + chown 1000:1000 /data/plugins/{{ tpl $plugin.name $ }}.smp {{ end }} {{ end }} diff --git a/scm-packaging/helm/src/main/chart/templates/service.yaml b/scm-packaging/helm/src/main/chart/templates/service.yaml index 23fdf15a2a..1f9f46a8f7 100644 --- a/scm-packaging/helm/src/main/chart/templates/service.yaml +++ b/scm-packaging/helm/src/main/chart/templates/service.yaml @@ -38,6 +38,9 @@ spec: targetPort: 8080 protocol: TCP name: http + {{- if (not (empty .Values.service.nodePort)) }} + nodePort: {{ .Values.service.nodePort }} + {{- end }} selector: app: {{ include "scm-manager.name" . }} release: {{ .Release.Name }} diff --git a/scm-packaging/helm/src/main/chart/values.yaml b/scm-packaging/helm/src/main/chart/values.yaml index e6145cc79a..8f8252dbfb 100644 --- a/scm-packaging/helm/src/main/chart/values.yaml +++ b/scm-packaging/helm/src/main/chart/values.yaml @@ -44,6 +44,8 @@ service: type: LoadBalancer # service.port -- k8s service port port: 80 + # service.nodePort -- k8s service node port + #nodePort: ingress: # ingress.enabled -- Enables ingress @@ -117,3 +119,44 @@ tolerations: [] # affinity -- Affinity settings affinity: {} + +# lifecycleHooks for the container to automate configuration before or after startup, +# i.e. to create users or repos through REST API calls +lifecycleHooks: | +# postStart: +# exec: +# command: ["/bin/bash", "-c", "echo lifecycleHook"] +# Other option: Insert scrip file via "helm install --set-file=postStartHookScript=${pwd()}/postStartHook.sh" +# lifecycleHooks: |- +# postStart: +# exec: +# command: +# - "/bin/bash" +# - "-c" +# - > +# {{ tpl (required ".Values.postStartHookScript required!" .Values.postStartHookScript) . | indent 8 }} + +# extraEnv -- Additional environment variables, parsed through tpl function +extraEnv: | +# - name: TZ +# value: "{{.Values.timezone}}" + +# extraEnvFrom -- Additional environment variables mapped from Secret or ConfigMap, parsed through tpl function +extraEnvFrom: | +# - secretRef: +# name: "{{.Values.mail.credentials}}" + +# extraVolumes -- Add additional volumes, parsed through tpl function +extraVolumes: | +# - name: bucket-service-account +# secret: +# secretName: "{{.Values.bucket.secretName}}" +# items: +# - key: service_account.json +# path: service_account.json + +# extraVolumeMounts -- Add additional volumes mounts, parsed through tpl function +extraVolumeMounts: | +# - name: bucket-service-account +# mountPath: "{{.Values.bucket.mountPath}}" +# readOnly: true