diff --git a/stable/mssql-linux/Chart.yaml b/stable/mssql-linux/Chart.yaml index b69b08ae47..10a6cdde46 100644 --- a/stable/mssql-linux/Chart.yaml +++ b/stable/mssql-linux/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v1 description: SQL Server 2017 Linux Helm Chart name: mssql-linux -version: 0.8.0 +version: 0.9.0 appVersion: 14.0.3023.8 home: https://hub.docker.com/r/microsoft/mssql-server-linux/ icon: https://img-prod-cms-rt-microsoft-com.akamaized.net/cms/api/am/imageFileData/RE1I4Dx diff --git a/stable/mssql-linux/README.md b/stable/mssql-linux/README.md old mode 100644 new mode 100755 index 4cd8e21a01..c144591b32 --- a/stable/mssql-linux/README.md +++ b/stable/mssql-linux/README.md @@ -53,13 +53,15 @@ svc/mymssql-mssql-linux ClusterIP 10.104.152.61 1433/TCP 9 ### SA Password Retrieval -The sa password is a randomized in the secret.yaml file. To retrieve the password, perform the following steps once you install the helm chart. +The sa password is randomized in the secret.yaml file. To retrieve the password, perform the following steps once you install the helm chart. ```console $ printf $(kubectl get secret --namespace default mymssql-mssql-linux-secret -o jsonpath="{.data.sapassword}" | base64 --decode);echo ... ``` +In case an existing secret is used, the sa password must be retrieved from that secret, of course. + ## Connecting to SQL Server Instance 1. Run the following command @@ -90,6 +92,8 @@ The configuration parameters in this section control the resources requested and | acceptEula.value | EULA that needs to be accepted. It will need to be changed via commandline or values.yaml. | `n` | | edition.value | The edition of SQL Server to install. See section [Editions](#sql-server-for-linux-editions). | `Express` | | sapassword | Password for sa login | `Random (20-AlphNum)`1 | +| existingSecret | Name of an existing secret containing the sa password | `Empty String` | +| existingSecretKey| Name of key of the password in existing secret | `sapassword` | | image.repository | The docker hub repo for SQL Server | `microsoft/mssql-server-linux` | | image.tag | The tag for the image | `2017-CU5` | | image.pullPolicy | The pull policy for the deployment | `IfNotPresent` | diff --git a/stable/mssql-linux/templates/NOTES.txt b/stable/mssql-linux/templates/NOTES.txt old mode 100644 new mode 100755 index 1d7b819efd..f959c229c4 --- a/stable/mssql-linux/templates/NOTES.txt +++ b/stable/mssql-linux/templates/NOTES.txt @@ -14,7 +14,7 @@ Note - By Default the Express Edition is installed as part of this Chart. Gain access to your SQL Server: 1. Get SA Password -$ printf $(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "mssql.fullname" . }}-secret -o jsonpath="{.data.sapassword}" | base64 --decode);echo +$ printf $(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "mssql.secret" . }} -o jsonpath="{.data.{{ template "mssql.passwordKey" . }}}" | base64 --decode);echo 2. You can test that SQL Server is available by the service port with with the following set of command: (Note: You will be prompted for the SA password, use the password generated in Step 1) $ kubectl run mssqlcli --image=microsoft/mssql-tools -ti --restart=Never --rm=true -- /bin/bash diff --git a/stable/mssql-linux/templates/_helpers.tpl b/stable/mssql-linux/templates/_helpers.tpl old mode 100644 new mode 100755 index d72a4cd936..bbd4f790aa --- a/stable/mssql-linux/templates/_helpers.tpl +++ b/stable/mssql-linux/templates/_helpers.tpl @@ -23,3 +23,26 @@ If release name contains chart name it will be used as a full name. {{- end -}} {{- end -}} {{- end -}} + +{{/* +Create the name for the SA password secret. +*/}} +{{- define "mssql.secret" -}} +{{- if .Values.existingSecret -}} + {{- .Values.existingSecret -}} +{{- else -}} + {{- include "mssql.fullname" . -}}-secret +{{- end -}} +{{- end -}} + +{{/* +Create the name for the SA password secret key. +*/}} +{{- define "mssql.passwordKey" -}} +{{- if .Values.existingSecret -}} + {{- .Values.existingSecretKey -}} +{{- else -}} + sapassword +{{- end -}} +{{- end -}} + diff --git a/stable/mssql-linux/templates/deployment.yaml b/stable/mssql-linux/templates/deployment.yaml old mode 100644 new mode 100755 index 9fdaef4136..98c2ee80c8 --- a/stable/mssql-linux/templates/deployment.yaml +++ b/stable/mssql-linux/templates/deployment.yaml @@ -52,8 +52,8 @@ spec: - name: SA_PASSWORD valueFrom: secretKeyRef: - name: {{ template "mssql.fullname" . }}-secret - key: sapassword + name: {{ template "mssql.secret" . }} + key: {{ template "mssql.passwordKey" . }} - name: MSSQL_DATA_DIR value: /mssql-data/data - name: MSSQL_LOG_DIR diff --git a/stable/mssql-linux/templates/secret.yaml b/stable/mssql-linux/templates/secret.yaml old mode 100644 new mode 100755 index af5212e9a4..3ce19892ee --- a/stable/mssql-linux/templates/secret.yaml +++ b/stable/mssql-linux/templates/secret.yaml @@ -1,3 +1,4 @@ +{{- if not .Values.existingSecret -}} apiVersion: v1 kind: Secret metadata: @@ -13,4 +14,5 @@ data: sapassword: {{ .Values.sapassword | b64enc | quote }} {{ else }} sapassword: {{ randAlphaNum 20 | b64enc | quote }} - {{ end }} \ No newline at end of file + {{ end }} +{{- end -}} diff --git a/stable/mssql-linux/values.yaml b/stable/mssql-linux/values.yaml old mode 100644 new mode 100755 index 14dd263489..d6480e99e7 --- a/stable/mssql-linux/values.yaml +++ b/stable/mssql-linux/values.yaml @@ -7,6 +7,8 @@ lcid: 1033 hadr: 0 # Override sapassword in templates/secret.yaml # sapassword: "MyStrongPassword1234" +existingSecret: "" +existingSecretKey: sapassword image: repository: microsoft/mssql-server-linux tag: 2017-CU5