From c9e21ad9f55718b7a794a93bc9aa21d4b59ff04b Mon Sep 17 00:00:00 2001 From: Olivier Levitt Date: Mon, 19 Oct 2020 15:44:56 +0200 Subject: [PATCH] Tomcat : support other init containers --- charts/tomcat/Chart.yaml | 2 +- charts/tomcat/templates/deployment.yaml | 17 +++++++++++++---- charts/tomcat/values.yaml | 7 ++++++- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/charts/tomcat/Chart.yaml b/charts/tomcat/Chart.yaml index 4480d6e..db1f65b 100644 --- a/charts/tomcat/Chart.yaml +++ b/charts/tomcat/Chart.yaml @@ -15,7 +15,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.1.0 +version: 0.1.1 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/charts/tomcat/templates/deployment.yaml b/charts/tomcat/templates/deployment.yaml index c2ef69b..121d4cc 100644 --- a/charts/tomcat/templates/deployment.yaml +++ b/charts/tomcat/templates/deployment.yaml @@ -56,12 +56,21 @@ spec: port: {{ .Values.image.containerPort }} resources: {{- toYaml .Values.resources | nindent 12 }} - {{- if .Values.init.warUrl }} + {{- if .Values.init.enabled }} initContainers: - name: download-war - image: "curlimages/curl" - command: ["curl"] - args: ["-o","/data/ROOT.war","-L", {{ .Values.init.warUrl | quote }}] + image: {{ .Values.init.image | quote }} + command: {{- range .Values.init.command }} + - {{ . | quote }} + {{- end }} + args: {{- range .Values.init.args }} + - {{ . | quote }} + {{- end }} + env: + {{- range $key, $val := .Values.init.env }} + - name: {{ $key }} + value: {{ $val | quote }} + {{- end}} volumeMounts: - mountPath: /data name: {{$volumeName}} diff --git a/charts/tomcat/values.yaml b/charts/tomcat/values.yaml index 702658a..d83837b 100644 --- a/charts/tomcat/values.yaml +++ b/charts/tomcat/values.yaml @@ -12,7 +12,12 @@ image: containerPort: 8080 init: - warUrl: "https://tomcat.apache.org/tomcat-9.0-doc/appdev/sample/sample.war" + enabled: true + image: curlimages/curl + command: ["curl"] + args: ["-o", "/data/ROOT.war", "-L", "$WAR_URL"] + env: + WAR_URL: "https://tomcat.apache.org/tomcat-7.0-doc/appdev/sample/sample.war" imagePullSecrets: [] nameOverride: ""