mirror of
https://github.com/helm/charts.git
synced 2026-08-20 04:47:32 +00:00
[stable/mssql-linux] allow using existing secret for sa password (#16… (#16186)
* [stable/mssql-linux] allow using existing secret for sa password (#16818) Signed-off-by: Stefan Frye <frye@deitmer-it.de> * [stable/mssql-linux] bump chart version (#16818) Signed-off-by: Stefan Frye <frye@deitmer-it.de>
This commit is contained in:
committed by
Kubernetes Prow Robot
parent
9f1db2d47d
commit
dae00befd9
@@ -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
|
||||
|
||||
Regular → Executable
+5
-1
@@ -53,13 +53,15 @@ svc/mymssql-mssql-linux ClusterIP 10.104.152.61 <none> 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)`<sup>1<sup> |
|
||||
| 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` |
|
||||
|
||||
Regular → Executable
+1
-1
@@ -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
|
||||
|
||||
Regular → Executable
+23
@@ -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 -}}
|
||||
|
||||
|
||||
Regular → Executable
+2
-2
@@ -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
|
||||
|
||||
Regular → Executable
+3
-1
@@ -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 }}
|
||||
{{ end }}
|
||||
{{- end -}}
|
||||
|
||||
Regular → Executable
+2
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user