From 77353cdf0d7db6c90bab0ed5a5a98debc00e6f8e Mon Sep 17 00:00:00 2001 From: thomasliddledba Date: Fri, 5 Jan 2018 17:01:09 -0500 Subject: [PATCH 01/15] Create SQL Server 2017 Linux HELM Chart --- incubator/mssql-linux/Chart.yaml | 8 ++ incubator/mssql-linux/README.md | 103 ++++++++++++++++++ incubator/mssql-linux/templates/NOTES.txt | 23 ++++ incubator/mssql-linux/templates/_helpers.tpl | 16 +++ .../mssql-linux/templates/deployment.yaml | 52 +++++++++ incubator/mssql-linux/templates/ingress.yaml | 32 ++++++ incubator/mssql-linux/templates/secret.yaml | 7 ++ incubator/mssql-linux/templates/service.yaml | 19 ++++ incubator/mssql-linux/values.yaml | 32 ++++++ 9 files changed, 292 insertions(+) create mode 100644 incubator/mssql-linux/Chart.yaml create mode 100644 incubator/mssql-linux/README.md create mode 100644 incubator/mssql-linux/templates/NOTES.txt create mode 100644 incubator/mssql-linux/templates/_helpers.tpl create mode 100644 incubator/mssql-linux/templates/deployment.yaml create mode 100644 incubator/mssql-linux/templates/ingress.yaml create mode 100644 incubator/mssql-linux/templates/secret.yaml create mode 100644 incubator/mssql-linux/templates/service.yaml create mode 100644 incubator/mssql-linux/values.yaml diff --git a/incubator/mssql-linux/Chart.yaml b/incubator/mssql-linux/Chart.yaml new file mode 100644 index 000000000000..e281015a5702 --- /dev/null +++ b/incubator/mssql-linux/Chart.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +description: SQL Server 2017 Linux Helm Chart for Kubernetes +name: mssql-linux +version: 0.1.2 +icon: https://img-prod-cms-rt-microsoft-com.akamaized.net/cms/api/am/imageFileData/RE1I4Dx +maintainers: +- name: thomasliddledba + email: tliddle30@gmail.com diff --git a/incubator/mssql-linux/README.md b/incubator/mssql-linux/README.md new file mode 100644 index 000000000000..3b6ac7ad1e66 --- /dev/null +++ b/incubator/mssql-linux/README.md @@ -0,0 +1,103 @@ +# HELM Chart for Microsoft SQL Server 2017 on Linux + +## Prerequisites + * This chart requires Docker Engine 1.8+ in any of their supported platforms. + * At least 2GB of RAM (3.25 GB prior to 2017-CU2). Make sure to assign enough memory to the Docker VM if you're running on Docker for Mac or Windows. + * Requires the following environment flags + - ACCEPT_EULA=Y + - Update the template/secret.yaml with your Base64 SA Password + - MSSQL_PID= (default: Express) + - A strong system administrator (SA) password: At least 8 characters including uppercase, lowercase letters, base-10 digits and/or non-alphanumeric symbols. + +## Chart Components + * Creates a SQL Server 2017 deployment (default edition: Express) + * Creates a Kubernetes Service on specified port (default: 1433) + * Creates a Secert to hold SA_PASSWORD + + ## Installing the Chart +You can install the chart with the release name `mymssql` as below. + +```console +$ helm repo add incubator http://storage.googleapis.com/kubernetes-charts-incubator +$ helm install --name mymssql incubator/mssql +``` + +If you do not specify a name, helm will select a name for you. + +### Installed Components +You can use `kubectl get` to view all of the installed components. + +```console{%raw} +$ kubectl get all -l app=mssql +NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE +deploy/mymssql-mssql 1 1 1 1 9m + +NAME DESIRED CURRENT READY AGE +rs/mymssql-mssql-8688756468 1 1 1 9m + +NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE +deploy/mymssql-mssql 1 1 1 1 9m + +NAME DESIRED CURRENT READY AGE +rs/mymssql-mssql-8688756468 1 1 1 9m + +NAME READY STATUS RESTARTS AGE +po/mymssql-mssql-8688756468-x758g 1/1 Running 0 9m + +NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE +svc/mymssql-mssql ClusterIP 10.104.152.61 1433/TCP 9m + +``` + +## Connecting to SQL Server Instance +1. Run the following command +```console +$ +``` + +## Values +The configuration parameters in this section control the resources requested and utilized by the ZooKeeper ensemble. + +| Parameter | Description | Default | +| --------- | ----------- | ------- | +| ACCEPT_EULA | EULA that needs to be accepted. It will need to be changed. | N | +| edition | The edition of SQL Server to install | Express | +| image | | | +| repository | The docker hub repo for SQL Server | microsoft/mssql-server-linux | +| tag | The tag for the image | latest | +| pullPolicy | The pull policy for the deployment | IfNotPresent | +| service | | | +| name | Service Name | mssqlsrvr | +| type | Service Type | ClusterIP | +| externalPort | External Port | 1433 | +| internalPort | Internal Port | 1433 | +| livenessprobe | | | +| initialDelaySeconds | Tells the kubelet that it should wait XX second(s) before performing the first probe | 15 | +| periodSeconds | Field specifies that the kubelet should perform a liveness probe every XX seconds(s) | 20 | +| readinessprobe | | | +| initialDelaySeconds | Tells the kubelet that it should wait XX second(s) before performing the first probe | 5 | +| periodSeconds | Field specifies that the kubelet should perform a liveness probe every XX second(s) | 10 | + +## Resources +Typically don't recommend specifying default resources and to leave this as a conscious +choice for the user. This also increases chances charts run on environments with little +resources, such as Minikube. If you do want to specify resources, uncomment the following +lines, adjust them as necessary, and remove the curly braces after 'resources:'. + +The defaults are set for local development purposes. +```yaml +resources: #{} + limits: + cpu: 1 + memory: 2Gi + requests: + cpu: 0.5 + memory: 2Gi +``` +## SQL Server for Linux Editions + * Developer : This will run the container using the Developer Edition (this is the default if no MSSQL_PID environment variable is supplied) + * Express : This will run the container using the Express Edition + * Standard : This will run the container using the Standard Edition + * Enterprise : This will run the container using the Enterprise Edition + * EnterpriseCore : This will run the container using the Enterprise Edition Core + * : This will run the container with the edition that is associated with the PID diff --git a/incubator/mssql-linux/templates/NOTES.txt b/incubator/mssql-linux/templates/NOTES.txt new file mode 100644 index 000000000000..ed4b206e4157 --- /dev/null +++ b/incubator/mssql-linux/templates/NOTES.txt @@ -0,0 +1,23 @@ +License Terms for MSSQL Server +Please read the License Terms Carefully. The can be found End-User Licensing Agreement. + + +License Terms: https://go.microsoft.com/fwlink/?linkid=857698 +Docker Hub Resource: https://hub.docker.com/r/microsoft/mssql-server-linux + +Note - By Default the Express Edition is installed as part of this Chart. + + +1. 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) +$ kubectl run dbatoolbox --image=microsoft/mssql-tools -ti --restart=Never --rm=true -- /bin/bash +$ sqlcmd -S {{ template "mssql.fullname" . }}.{{ .Release.Namespace }} -U sa -P + +2. Connection Library Information +https://docs.microsoft.com/en-us/sql/connect/sql-connection-libraries + +3. Connecting with JDBC +https://docs.microsoft.com/en-us/sql/connect/jdbc/connecting-to-sql-server-with-the-jdbc-driver + +SQL Server Name: {{ template "mssql.fullname" . }}.{{ .Release.Namespace }} +Port: {{ .Values.service.internalPort }} diff --git a/incubator/mssql-linux/templates/_helpers.tpl b/incubator/mssql-linux/templates/_helpers.tpl new file mode 100644 index 000000000000..d0400108e3b1 --- /dev/null +++ b/incubator/mssql-linux/templates/_helpers.tpl @@ -0,0 +1,16 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "mssql.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +*/}} +{{- define "mssql.fullname" -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/incubator/mssql-linux/templates/deployment.yaml b/incubator/mssql-linux/templates/deployment.yaml new file mode 100644 index 000000000000..e9cd8c2d3873 --- /dev/null +++ b/incubator/mssql-linux/templates/deployment.yaml @@ -0,0 +1,52 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: {{ template "mssql.fullname" . }} + labels: + app: {{ template "mssql.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + replicas: {{ .Values.replicaCount }} + template: + metadata: + labels: + app: {{ template "mssql.name" . }} + release: {{ .Release.Name }} + spec: + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + env: + - name: ACCEPT_EULA + value: "{{ .Values.ACCEPT_EULA.value }}" + - name: MSSQL_PID + value: "{{ .Values.edition.value }}" + - name: SA_PASSWORD + value: "{{ .Values.sapassword }}" + #TODO - Issue - When using Secret for SA Password the environment variable has additional characters. + #Keeping the secrets.yaml, however, using variable in values.yaml for now. + #valueFrom: + #secretKeyRef: + #name: {{ template "mssql.fullname" . }}-secret + #key: password + ports: + - containerPort: {{ .Values.service.internalPort }} + livenessProbe: + tcpSocket: + port: {{ .Values.service.internalPort }} + initialDelaySeconds: {{ .Values.livenessprobe.initialDelaySeconds }} + periodSeconds: {{ .Values.livenessprobe.periodSeconds }} + readinessProbe: + tcpSocket: + port: {{ .Values.service.internalPort }} + initialDelaySeconds: {{ .Values.readinessprobe.initialDelaySeconds }} + periodSeconds: {{ .Values.readinessprobe.periodSeconds }} + resources: +{{ toYaml .Values.resources | indent 12 }} + {{- if .Values.nodeSelector }} + nodeSelector: +{{ toYaml .Values.nodeSelector | indent 8 }} + {{- end }} diff --git a/incubator/mssql-linux/templates/ingress.yaml b/incubator/mssql-linux/templates/ingress.yaml new file mode 100644 index 000000000000..11e90f0761d7 --- /dev/null +++ b/incubator/mssql-linux/templates/ingress.yaml @@ -0,0 +1,32 @@ +{{- if .Values.ingress.enabled -}} +{{- $serviceName := include "mssql.fullname" . -}} +{{- $servicePort := .Values.service.externalPort -}} +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: {{ template "mssql.fullname" . }} + labels: + app: {{ template "mssql.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} + annotations: + {{- range $key, $value := .Values.ingress.annotations }} + {{ $key }}: {{ $value | quote }} + {{- end }} +spec: + rules: + {{- range $host := .Values.ingress.hosts }} + - host: {{ $host }} + http: + paths: + - path: / + backend: + serviceName: {{ $serviceName }} + servicePort: {{ $servicePort }} + {{- end -}} + {{- if .Values.ingress.tls }} + tls: +{{ toYaml .Values.ingress.tls | indent 4 }} + {{- end -}} +{{- end -}} diff --git a/incubator/mssql-linux/templates/secret.yaml b/incubator/mssql-linux/templates/secret.yaml new file mode 100644 index 000000000000..10d0a06f227f --- /dev/null +++ b/incubator/mssql-linux/templates/secret.yaml @@ -0,0 +1,7 @@ +apiVersion: v1 +kind: Secret +metadata: + name: {{ template "mssql.fullname" . }}-secret +# type: Opaque +data: + password: TXlTdHJvbmdQYXNzd29yZDExMjM/Cg== \ No newline at end of file diff --git a/incubator/mssql-linux/templates/service.yaml b/incubator/mssql-linux/templates/service.yaml new file mode 100644 index 000000000000..fd8372566d58 --- /dev/null +++ b/incubator/mssql-linux/templates/service.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ template "mssql.fullname" . }} + labels: + app: {{ template "mssql.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.externalPort }} + targetPort: {{ .Values.service.internalPort }} + protocol: TCP + name: {{ .Values.service.name }} + selector: + app: {{ template "mssql.name" . }} + release: {{ .Release.Name }} diff --git a/incubator/mssql-linux/values.yaml b/incubator/mssql-linux/values.yaml new file mode 100644 index 000000000000..cc331b14be27 --- /dev/null +++ b/incubator/mssql-linux/values.yaml @@ -0,0 +1,32 @@ +ACCEPT_EULA: + value: Y +edition: + value: Express +sapassword: MyPassword123456? +replicaCount: 1 +image: + repository: microsoft/mssql-server-linux + tag: latest + pullPolicy: IfNotPresent +service: + name: mssqlsrvr + type: ClusterIP + externalPort: 1433 + internalPort: 1433 +ingress: + enabled: false + hosts: + - mymssqlsrv.local +livenessprobe: + initialDelaySeconds: 15 + periodSeconds: 20 +readinessprobe: + initialDelaySeconds: 5 + periodSeconds: 10 +resources: + limits: + cpu: 1 + memory: 2Gi + requests: + cpu: 0.5 + memory: 2Gi From a9197de0b75bceeed45d31ce5b407aa433729c01 Mon Sep 17 00:00:00 2001 From: thomasliddledba Date: Fri, 5 Jan 2018 17:16:24 -0500 Subject: [PATCH 02/15] Fixed spaces for ci/circleci --- incubator/mssql-linux/values.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/incubator/mssql-linux/values.yaml b/incubator/mssql-linux/values.yaml index cc331b14be27..2ad96c541635 100644 --- a/incubator/mssql-linux/values.yaml +++ b/incubator/mssql-linux/values.yaml @@ -23,10 +23,10 @@ livenessprobe: readinessprobe: initialDelaySeconds: 5 periodSeconds: 10 -resources: - limits: - cpu: 1 - memory: 2Gi - requests: - cpu: 0.5 - memory: 2Gi +resources: {} + # limits: + # cpu: 100m + # memory: 2Gi + # requests: + # cpu: 100m + # memory: 2Gi \ No newline at end of file From cd8f11c72289a30aafbf4a31d097936b5a26436d Mon Sep 17 00:00:00 2001 From: thomasliddledba Date: Fri, 5 Jan 2018 17:18:05 -0500 Subject: [PATCH 03/15] Fixed spaces for ci/circleci #2 --- incubator/mssql-linux/values.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/incubator/mssql-linux/values.yaml b/incubator/mssql-linux/values.yaml index 2ad96c541635..5e1005c11b52 100644 --- a/incubator/mssql-linux/values.yaml +++ b/incubator/mssql-linux/values.yaml @@ -29,4 +29,5 @@ resources: {} # memory: 2Gi # requests: # cpu: 100m - # memory: 2Gi \ No newline at end of file + # memory: 2Gi + \ No newline at end of file From 6dff973362f694dfc79740c2771bad6fcf68dcaf Mon Sep 17 00:00:00 2001 From: thomasliddledba Date: Fri, 5 Jan 2018 17:19:27 -0500 Subject: [PATCH 04/15] Fixed spaces for ci/circleci #3 --- incubator/mssql-linux/values.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/incubator/mssql-linux/values.yaml b/incubator/mssql-linux/values.yaml index 5e1005c11b52..2ff2aab1c87e 100644 --- a/incubator/mssql-linux/values.yaml +++ b/incubator/mssql-linux/values.yaml @@ -30,4 +30,3 @@ resources: {} # requests: # cpu: 100m # memory: 2Gi - \ No newline at end of file From 8d2b2905f0fff5313c6d600b4d03f9526bb515aa Mon Sep 17 00:00:00 2001 From: thomasliddledba Date: Sat, 6 Jan 2018 07:25:50 -0500 Subject: [PATCH 05/15] Added secret yaml to deployment for SA Password --- incubator/mssql-linux/Chart.yaml | 2 +- incubator/mssql-linux/README.md | 11 +++++++++++ incubator/mssql-linux/templates/deployment.yaml | 11 ++++------- incubator/mssql-linux/templates/secret.yaml | 2 +- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/incubator/mssql-linux/Chart.yaml b/incubator/mssql-linux/Chart.yaml index e281015a5702..e0adc39cf631 100644 --- a/incubator/mssql-linux/Chart.yaml +++ b/incubator/mssql-linux/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v1 description: SQL Server 2017 Linux Helm Chart for Kubernetes name: mssql-linux -version: 0.1.2 +version: 0.1.4 icon: https://img-prod-cms-rt-microsoft-com.akamaized.net/cms/api/am/imageFileData/RE1I4Dx maintainers: - name: thomasliddledba diff --git a/incubator/mssql-linux/README.md b/incubator/mssql-linux/README.md index 3b6ac7ad1e66..7bf0baf759c6 100644 --- a/incubator/mssql-linux/README.md +++ b/incubator/mssql-linux/README.md @@ -101,3 +101,14 @@ resources: #{} * Enterprise : This will run the container using the Enterprise Edition * EnterpriseCore : This will run the container using the Enterprise Edition Core * : This will run the container with the edition that is associated with the PID + +## Creating Secrets for SA Password +It is important to change the BASE64 text in the templates/secret.yaml file to your own password. By default, the password is `MySaPassword123`. The instructions below are how to change the password via terminal window. +1. Open a terminal session/window +2. Type in the following +```console +$ echo -n ""| base64 +$ +``` +3. Copy the Base64 output in step 2 into the templates/secret.yaml in the `password` field +> Note - The `echo -n` in important to ensure no new lines are added at the end of the password \ No newline at end of file diff --git a/incubator/mssql-linux/templates/deployment.yaml b/incubator/mssql-linux/templates/deployment.yaml index e9cd8c2d3873..0b456e103f0b 100644 --- a/incubator/mssql-linux/templates/deployment.yaml +++ b/incubator/mssql-linux/templates/deployment.yaml @@ -25,13 +25,10 @@ spec: - name: MSSQL_PID value: "{{ .Values.edition.value }}" - name: SA_PASSWORD - value: "{{ .Values.sapassword }}" - #TODO - Issue - When using Secret for SA Password the environment variable has additional characters. - #Keeping the secrets.yaml, however, using variable in values.yaml for now. - #valueFrom: - #secretKeyRef: - #name: {{ template "mssql.fullname" . }}-secret - #key: password + valueFrom: + secretKeyRef: + name: {{ template "mssql.fullname" . }}-secret + key: password ports: - containerPort: {{ .Values.service.internalPort }} livenessProbe: diff --git a/incubator/mssql-linux/templates/secret.yaml b/incubator/mssql-linux/templates/secret.yaml index 10d0a06f227f..37a0274c3af2 100644 --- a/incubator/mssql-linux/templates/secret.yaml +++ b/incubator/mssql-linux/templates/secret.yaml @@ -4,4 +4,4 @@ metadata: name: {{ template "mssql.fullname" . }}-secret # type: Opaque data: - password: TXlTdHJvbmdQYXNzd29yZDExMjM/Cg== \ No newline at end of file + password: TXlTYVBhc3N3b3JkMTIz From bfa7255d005a3f2743326cc282c4260ff5f3291c Mon Sep 17 00:00:00 2001 From: thomasliddledba Date: Sat, 6 Jan 2018 07:53:51 -0500 Subject: [PATCH 06/15] Updated the chart to force user to specify EULA to Y for license terms --- incubator/mssql-linux/README.md | 2 +- incubator/mssql-linux/values.yaml | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/incubator/mssql-linux/README.md b/incubator/mssql-linux/README.md index 7bf0baf759c6..779fdef76e88 100644 --- a/incubator/mssql-linux/README.md +++ b/incubator/mssql-linux/README.md @@ -4,7 +4,7 @@ * This chart requires Docker Engine 1.8+ in any of their supported platforms. * At least 2GB of RAM (3.25 GB prior to 2017-CU2). Make sure to assign enough memory to the Docker VM if you're running on Docker for Mac or Windows. * Requires the following environment flags - - ACCEPT_EULA=Y + - You must change the ACCEPT_EULA in the values.yaml file to `Y` - Update the template/secret.yaml with your Base64 SA Password - MSSQL_PID= (default: Express) - A strong system administrator (SA) password: At least 8 characters including uppercase, lowercase letters, base-10 digits and/or non-alphanumeric symbols. diff --git a/incubator/mssql-linux/values.yaml b/incubator/mssql-linux/values.yaml index 2ff2aab1c87e..a84915cf7299 100644 --- a/incubator/mssql-linux/values.yaml +++ b/incubator/mssql-linux/values.yaml @@ -1,8 +1,7 @@ ACCEPT_EULA: - value: Y + value: N edition: value: Express -sapassword: MyPassword123456? replicaCount: 1 image: repository: microsoft/mssql-server-linux From 84f1f8562b5e83e17769a647a5303a16b34e520d Mon Sep 17 00:00:00 2001 From: thomasliddledba Date: Sat, 6 Jan 2018 09:50:28 -0500 Subject: [PATCH 07/15] Updated README.md to reflect commandline option to accept EULA --- incubator/mssql-linux/README.md | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/incubator/mssql-linux/README.md b/incubator/mssql-linux/README.md index 779fdef76e88..008ef60c1a66 100644 --- a/incubator/mssql-linux/README.md +++ b/incubator/mssql-linux/README.md @@ -4,7 +4,7 @@ * This chart requires Docker Engine 1.8+ in any of their supported platforms. * At least 2GB of RAM (3.25 GB prior to 2017-CU2). Make sure to assign enough memory to the Docker VM if you're running on Docker for Mac or Windows. * Requires the following environment flags - - You must change the ACCEPT_EULA in the values.yaml file to `Y` + - You must change the ACCEPT_EULA in the values.yaml file to `Y` or include `--set ACCEPT_EULA.value=Y` in the command line of `helm install` - Update the template/secret.yaml with your Base64 SA Password - MSSQL_PID= (default: Express) - A strong system administrator (SA) password: At least 8 characters including uppercase, lowercase letters, base-10 digits and/or non-alphanumeric symbols. @@ -14,15 +14,25 @@ * Creates a Kubernetes Service on specified port (default: 1433) * Creates a Secert to hold SA_PASSWORD - ## Installing the Chart -You can install the chart with the release name `mymssql` as below. +## Installing the Chart +### Creating Secrets for SA Password +It is important to change the BASE64 text in the templates/secret.yaml file to your own password. By default, the password is `MySaPassword123`. The instructions below are how to change the password via terminal window. +1. Open a terminal session/window +2. Type in the following ```console -$ helm repo add incubator http://storage.googleapis.com/kubernetes-charts-incubator -$ helm install --name mymssql incubator/mssql +$ echo -n ""| base64 +$ ``` +3. Copy the Base64 output in step 2 into the templates/secret.yaml in the `password` field +> Note - The `echo -n` in important to ensure no new lines are added at the end of the password -If you do not specify a name, helm will select a name for you. +You can install the chart with the release name `mymssql` as below. +```console +$ helm repo add incubator http://storage.googleapis.com/kubernetes-charts-incubator +$ helm install --name mymssql incubator/mssql --set ACCEPT_EULA.value=Y +``` +> Note - If you do not specify a name, helm will select a name for you. ### Installed Components You can use `kubectl get` to view all of the installed components. @@ -52,7 +62,9 @@ svc/mymssql-mssql ClusterIP 10.104.152.61 1433/TCP 9m ## Connecting to SQL Server Instance 1. Run the following command ```console -$ +$ kubectl run dbatoolbox --image=microsoft/mssql-tools -ti --restart=Never --rm=true -- /bin/bash +$ sqlcmd -S {{ template "mssql.fullname" . }}.{{ .Release.Namespace }} -U sa +Password: ``` ## Values @@ -60,7 +72,7 @@ The configuration parameters in this section control the resources requested and | Parameter | Description | Default | | --------- | ----------- | ------- | -| ACCEPT_EULA | EULA that needs to be accepted. It will need to be changed. | N | +| ACCEPT_EULA | EULA that needs to be accepted. It will need to be changed via commandline or values.yaml. | N | | edition | The edition of SQL Server to install | Express | | image | | | | repository | The docker hub repo for SQL Server | microsoft/mssql-server-linux | From 2ea47a75c08fd2cd0bca148420cce72c20351e8a Mon Sep 17 00:00:00 2001 From: thomasliddledba Date: Thu, 11 Jan 2018 19:42:10 -0500 Subject: [PATCH 08/15] Updated README.md and secret.yaml for sa_password generation --- incubator/mssql-linux/Chart.yaml | 4 +- incubator/mssql-linux/README.md | 129 +++++++++---------- incubator/mssql-linux/templates/NOTES.txt | 1 + incubator/mssql-linux/templates/ingress.yaml | 32 ----- incubator/mssql-linux/templates/secret.yaml | 9 +- incubator/mssql-linux/values.yaml | 5 - 6 files changed, 72 insertions(+), 108 deletions(-) delete mode 100644 incubator/mssql-linux/templates/ingress.yaml diff --git a/incubator/mssql-linux/Chart.yaml b/incubator/mssql-linux/Chart.yaml index e0adc39cf631..bc63314f0f3a 100644 --- a/incubator/mssql-linux/Chart.yaml +++ b/incubator/mssql-linux/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v1 -description: SQL Server 2017 Linux Helm Chart for Kubernetes +description: SQL Server 2017 Linux Helm Chart name: mssql-linux -version: 0.1.4 +version: 0.1.5 icon: https://img-prod-cms-rt-microsoft-com.akamaized.net/cms/api/am/imageFileData/RE1I4Dx maintainers: - name: thomasliddledba diff --git a/incubator/mssql-linux/README.md b/incubator/mssql-linux/README.md index 008ef60c1a66..c14f8bb55b4c 100644 --- a/incubator/mssql-linux/README.md +++ b/incubator/mssql-linux/README.md @@ -1,13 +1,11 @@ # HELM Chart for Microsoft SQL Server 2017 on Linux ## Prerequisites - * This chart requires Docker Engine 1.8+ in any of their supported platforms. + * This chart requires Docker Engine 1.8+ in any of their supported platforms. Please see vendor requirements [here for more information](https://docs.microsoft.com/en-us/sql/linux/quickstart-install-connect-docker). * At least 2GB of RAM (3.25 GB prior to 2017-CU2). Make sure to assign enough memory to the Docker VM if you're running on Docker for Mac or Windows. - * Requires the following environment flags + * Requires the following variables - You must change the ACCEPT_EULA in the values.yaml file to `Y` or include `--set ACCEPT_EULA.value=Y` in the command line of `helm install` - - Update the template/secret.yaml with your Base64 SA Password - - MSSQL_PID= (default: Express) - - A strong system administrator (SA) password: At least 8 characters including uppercase, lowercase letters, base-10 digits and/or non-alphanumeric symbols. + - You must change the editions variable in the values.yaml file to include the edition of SQL Server or include `--set edition.value=` in the command line of `helm install`. ## Chart Components * Creates a SQL Server 2017 deployment (default edition: Express) @@ -15,90 +13,97 @@ * Creates a Secert to hold SA_PASSWORD ## Installing the Chart - -### Creating Secrets for SA Password -It is important to change the BASE64 text in the templates/secret.yaml file to your own password. By default, the password is `MySaPassword123`. The instructions below are how to change the password via terminal window. -1. Open a terminal session/window -2. Type in the following -```console -$ echo -n ""| base64 -$ -``` -3. Copy the Base64 output in step 2 into the templates/secret.yaml in the `password` field -> Note - The `echo -n` in important to ensure no new lines are added at the end of the password - You can install the chart with the release name `mymssql` as below. ```console $ helm repo add incubator http://storage.googleapis.com/kubernetes-charts-incubator -$ helm install --name mymssql incubator/mssql --set ACCEPT_EULA.value=Y +$ helm install --name mymssql incubator/mssql-linux --set ACCEPT_EULA.value=Y --set edition.value=Developer ``` > Note - If you do not specify a name, helm will select a name for you. ### Installed Components You can use `kubectl get` to view all of the installed components. -```console{%raw} -$ kubectl get all -l app=mssql -NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE -deploy/mymssql-mssql 1 1 1 1 9m +```console +$ kubectl get all -l app=mssql-linux +NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE +deploy/mymssql-mssql-linux 1 1 1 1 9m + +NAME DESIRED CURRENT READY AGE +rs/mymssql-mssql-linux-8688756468 1 1 1 9m -NAME DESIRED CURRENT READY AGE -rs/mymssql-mssql-8688756468 1 1 1 9m +NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE +deploy/mymssql-mssql-linux 1 1 1 1 9m -NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE -deploy/mymssql-mssql 1 1 1 1 9m +NAME DESIRED CURRENT READY AGE +rs/mymssql-mssql-linux-8688756468 1 1 1 9m -NAME DESIRED CURRENT READY AGE -rs/mymssql-mssql-8688756468 1 1 1 9m +NAME READY STATUS RESTARTS AGE +po/mymssql-mssql-linux-8688756468-x758g 1/1 Running 0 9m -NAME READY STATUS RESTARTS AGE -po/mymssql-mssql-8688756468-x758g 1/1 Running 0 9m +NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE +svc/mymssql-mssql-linux ClusterIP 10.104.152.61 1433/TCP 9m -NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE -svc/mymssql-mssql ClusterIP 10.104.152.61 1433/TCP 9m +``` +### SA Password Retrieval +The sa password is a randonmized in the secret.yaml file. To retrieve the password, perform the following steps once you install the helm chart. +```console +$ kubectl exec mymssql-mssql-linux-8688756468 -- env | grep SA_PASSWORD ``` ## Connecting to SQL Server Instance 1. Run the following command +This command will create a pod called `dbatoolbox` that will include the SQL Server Commandline `sqlcmd` and start at a bash prompt. ```console $ kubectl run dbatoolbox --image=microsoft/mssql-tools -ti --restart=Never --rm=true -- /bin/bash -$ sqlcmd -S {{ template "mssql.fullname" . }}.{{ .Release.Namespace }} -U sa +$ sqlcmd -S mymssql-mssql-linux -U sa Password: +$ 1> select @@VERSION; +$ 2> go +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ +Microsoft SQL Server 2017 (RTM-CU3-GDR) (KB4052987) - 14.0.3015.40 (X64) + Dec 22 2017 16:13:22 + Copyright (C) 2017 Microsoft Corporation + Express Edition (64-bit) on Linux (Ubuntu 16.04.3 LTS) + +(1 rows affected) + ``` ## Values -The configuration parameters in this section control the resources requested and utilized by the ZooKeeper ensemble. +The configuration parameters in this section control the resources requested and utilized by the SQL Server instance. | Parameter | Description | Default | | --------- | ----------- | ------- | | ACCEPT_EULA | EULA that needs to be accepted. It will need to be changed via commandline or values.yaml. | N | -| edition | The edition of SQL Server to install | Express | -| image | | | -| repository | The docker hub repo for SQL Server | microsoft/mssql-server-linux | -| tag | The tag for the image | latest | -| pullPolicy | The pull policy for the deployment | IfNotPresent | -| service | | | -| name | Service Name | mssqlsrvr | -| type | Service Type | ClusterIP | +| edition | The edition of SQL Server to install. See section [Editions](#sql-server-for-linux-editions). | Express | +| image.repository | The docker hub repo for SQL Server | microsoft/mssql-server-linux | +| image.tag | The tag for the image | latest | +| image.pullPolicy | The pull policy for the deployment | IfNotPresent | +| service.name | Service Name | mssqlsrvr | +| service.type | Service Type | ClusterIP | | externalPort | External Port | 1433 | | internalPort | Internal Port | 1433 | -| livenessprobe | | | -| initialDelaySeconds | Tells the kubelet that it should wait XX second(s) before performing the first probe | 15 | -| periodSeconds | Field specifies that the kubelet should perform a liveness probe every XX seconds(s) | 20 | -| readinessprobe | | | -| initialDelaySeconds | Tells the kubelet that it should wait XX second(s) before performing the first probe | 5 | -| periodSeconds | Field specifies that the kubelet should perform a liveness probe every XX second(s) | 10 | -## Resources -Typically don't recommend specifying default resources and to leave this as a conscious -choice for the user. This also increases chances charts run on environments with little -resources, such as Minikube. If you do want to specify resources, uncomment the following -lines, adjust them as necessary, and remove the curly braces after 'resources:'. +## Liveness and Readiness +The SQL Server instance has liveness and readiness checks specified. These parameters can be used to tune the sensitivity of the liveness and readiness checks. +### Liveness Probes +| Parameter | Description | Default | +| --------- | ----------- | ------- | +| livenessprobe.initialDelaySeconds | Tells the kubelet that it should wait XX second(s) before performing the first probe | 15 | +| livenessprobe.periodSeconds | Field specifies that the kubelet should perform a liveness probe every XX seconds(s) | 20 | + +### Readiness Probes +| Parameter | Description | Default | +| --------- | ----------- | ------- | +| readinessprobe.initialDelaySeconds | Tells the kubelet that it should wait XX second(s) before performing the first probe | 5 | +| readinessprobe.periodSeconds | Field specifies that the kubelet should perform a liveness probe every XX second(s) | 10 | -The defaults are set for local development purposes. +## Resources +You can specify the resource limits for this chart in the values.yaml file. +Example: ```yaml -resources: #{} +resources: limits: cpu: 1 memory: 2Gi @@ -107,20 +112,10 @@ resources: #{} memory: 2Gi ``` ## SQL Server for Linux Editions +Below are the supported versions of SQL Server on Linux. You can find out more information [here](https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-editions-and-components-2017). * Developer : This will run the container using the Developer Edition (this is the default if no MSSQL_PID environment variable is supplied) * Express : This will run the container using the Express Edition * Standard : This will run the container using the Standard Edition * Enterprise : This will run the container using the Enterprise Edition * EnterpriseCore : This will run the container using the Enterprise Edition Core - * : This will run the container with the edition that is associated with the PID - -## Creating Secrets for SA Password -It is important to change the BASE64 text in the templates/secret.yaml file to your own password. By default, the password is `MySaPassword123`. The instructions below are how to change the password via terminal window. -1. Open a terminal session/window -2. Type in the following -```console -$ echo -n ""| base64 -$ -``` -3. Copy the Base64 output in step 2 into the templates/secret.yaml in the `password` field -> Note - The `echo -n` in important to ensure no new lines are added at the end of the password \ No newline at end of file + * Product ID: This will run the container with the edition that is associated with the PID \ No newline at end of file diff --git a/incubator/mssql-linux/templates/NOTES.txt b/incubator/mssql-linux/templates/NOTES.txt index ed4b206e4157..a872270b40d1 100644 --- a/incubator/mssql-linux/templates/NOTES.txt +++ b/incubator/mssql-linux/templates/NOTES.txt @@ -6,6 +6,7 @@ License Terms: https://go.microsoft.com/fwlink/?linkid=857698 Docker Hub Resource: https://hub.docker.com/r/microsoft/mssql-server-linux Note - By Default the Express Edition is installed as part of this Chart. +Edition for this installation: {{ .Values.edition.value . }} 1. You can test that SQL Server is available by the service port with with the following set of command: diff --git a/incubator/mssql-linux/templates/ingress.yaml b/incubator/mssql-linux/templates/ingress.yaml deleted file mode 100644 index 11e90f0761d7..000000000000 --- a/incubator/mssql-linux/templates/ingress.yaml +++ /dev/null @@ -1,32 +0,0 @@ -{{- if .Values.ingress.enabled -}} -{{- $serviceName := include "mssql.fullname" . -}} -{{- $servicePort := .Values.service.externalPort -}} -apiVersion: extensions/v1beta1 -kind: Ingress -metadata: - name: {{ template "mssql.fullname" . }} - labels: - app: {{ template "mssql.name" . }} - chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} - annotations: - {{- range $key, $value := .Values.ingress.annotations }} - {{ $key }}: {{ $value | quote }} - {{- end }} -spec: - rules: - {{- range $host := .Values.ingress.hosts }} - - host: {{ $host }} - http: - paths: - - path: / - backend: - serviceName: {{ $serviceName }} - servicePort: {{ $servicePort }} - {{- end -}} - {{- if .Values.ingress.tls }} - tls: -{{ toYaml .Values.ingress.tls | indent 4 }} - {{- end -}} -{{- end -}} diff --git a/incubator/mssql-linux/templates/secret.yaml b/incubator/mssql-linux/templates/secret.yaml index 37a0274c3af2..6b487fab1a2e 100644 --- a/incubator/mssql-linux/templates/secret.yaml +++ b/incubator/mssql-linux/templates/secret.yaml @@ -2,6 +2,11 @@ apiVersion: v1 kind: Secret metadata: name: {{ template "mssql.fullname" . }}-secret -# type: Opaque + labels: + app: {{ template "mssql.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +type: Opaque data: - password: TXlTYVBhc3N3b3JkMTIz + password: {{ randAlphaNum 15 | b64enc | quote }} diff --git a/incubator/mssql-linux/values.yaml b/incubator/mssql-linux/values.yaml index a84915cf7299..caa73fba4dce 100644 --- a/incubator/mssql-linux/values.yaml +++ b/incubator/mssql-linux/values.yaml @@ -2,7 +2,6 @@ ACCEPT_EULA: value: N edition: value: Express -replicaCount: 1 image: repository: microsoft/mssql-server-linux tag: latest @@ -12,10 +11,6 @@ service: type: ClusterIP externalPort: 1433 internalPort: 1433 -ingress: - enabled: false - hosts: - - mymssqlsrv.local livenessprobe: initialDelaySeconds: 15 periodSeconds: 20 From dfed42aac308280e48ec01e294230e0cc59f18ec Mon Sep 17 00:00:00 2001 From: thomasliddledba Date: Thu, 11 Jan 2018 19:43:58 -0500 Subject: [PATCH 09/15] Fixed formatting error in NOTES.txt --- incubator/mssql-linux/templates/NOTES.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/incubator/mssql-linux/templates/NOTES.txt b/incubator/mssql-linux/templates/NOTES.txt index a872270b40d1..93661cf6ace1 100644 --- a/incubator/mssql-linux/templates/NOTES.txt +++ b/incubator/mssql-linux/templates/NOTES.txt @@ -6,7 +6,7 @@ License Terms: https://go.microsoft.com/fwlink/?linkid=857698 Docker Hub Resource: https://hub.docker.com/r/microsoft/mssql-server-linux Note - By Default the Express Edition is installed as part of this Chart. -Edition for this installation: {{ .Values.edition.value . }} +Edition for this installation: {{ .Values.edition.value}} 1. You can test that SQL Server is available by the service port with with the following set of command: From 3a88881e28f2335f150559062fe5bba375f9d374 Mon Sep 17 00:00:00 2001 From: thomasliddledba Date: Mon, 15 Jan 2018 07:30:34 -0500 Subject: [PATCH 10/15] Changed apiVersion in deployments.yaml to apps/v1beta2 --- incubator/mssql-linux/templates/deployment.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/incubator/mssql-linux/templates/deployment.yaml b/incubator/mssql-linux/templates/deployment.yaml index 0b456e103f0b..92b89b025560 100644 --- a/incubator/mssql-linux/templates/deployment.yaml +++ b/incubator/mssql-linux/templates/deployment.yaml @@ -1,4 +1,4 @@ -apiVersion: extensions/v1beta1 +apiVersion: apps/v1beta2 kind: Deployment metadata: name: {{ template "mssql.fullname" . }} From 48910539aa901d10632049de1cde5766e7751870 Mon Sep 17 00:00:00 2001 From: thomasliddledba Date: Wed, 17 Jan 2018 07:52:03 -0500 Subject: [PATCH 11/15] Allowed ability to override sapassword and change apiVersion in deployment.yaml --- incubator/mssql-linux/Chart.yaml | 4 +++- incubator/mssql-linux/README.md | 16 ++++++++-------- incubator/mssql-linux/templates/NOTES.txt | 7 ++++--- incubator/mssql-linux/templates/deployment.yaml | 6 +++++- incubator/mssql-linux/templates/secret.yaml | 6 +++++- incubator/mssql-linux/values.yaml | 9 ++++++--- 6 files changed, 31 insertions(+), 17 deletions(-) diff --git a/incubator/mssql-linux/Chart.yaml b/incubator/mssql-linux/Chart.yaml index bc63314f0f3a..444f0370f41d 100644 --- a/incubator/mssql-linux/Chart.yaml +++ b/incubator/mssql-linux/Chart.yaml @@ -1,8 +1,10 @@ apiVersion: v1 description: SQL Server 2017 Linux Helm Chart name: mssql-linux -version: 0.1.5 +version: 0.1.6 icon: https://img-prod-cms-rt-microsoft-com.akamaized.net/cms/api/am/imageFileData/RE1I4Dx +sources: +- https://hub.docker.com/r/microsoft/mssql-server-linux/ maintainers: - name: thomasliddledba email: tliddle30@gmail.com diff --git a/incubator/mssql-linux/README.md b/incubator/mssql-linux/README.md index c14f8bb55b4c..7623bb2639b0 100644 --- a/incubator/mssql-linux/README.md +++ b/incubator/mssql-linux/README.md @@ -4,7 +4,7 @@ * This chart requires Docker Engine 1.8+ in any of their supported platforms. Please see vendor requirements [here for more information](https://docs.microsoft.com/en-us/sql/linux/quickstart-install-connect-docker). * At least 2GB of RAM (3.25 GB prior to 2017-CU2). Make sure to assign enough memory to the Docker VM if you're running on Docker for Mac or Windows. * Requires the following variables - - You must change the ACCEPT_EULA in the values.yaml file to `Y` or include `--set ACCEPT_EULA.value=Y` in the command line of `helm install` + - You must change the ACCEPT_EULA.value in the values.yaml file to `Y` or include `--set ACCEPT_EULA.value=Y` in the command line of `helm install` to override the default value of `N`. - You must change the editions variable in the values.yaml file to include the edition of SQL Server or include `--set edition.value=` in the command line of `helm install`. ## Chart Components @@ -53,19 +53,18 @@ $ kubectl exec mymssql-mssql-linux-8688756468 -- env | grep SA_PASSWORD ## Connecting to SQL Server Instance 1. Run the following command -This command will create a pod called `dbatoolbox` that will include the SQL Server Commandline `sqlcmd` and start at a bash prompt. +This command will create a pod called `mssqlcli` that will include the SQL Server Commandline `sqlcmd` and start at a bash prompt. ```console -$ kubectl run dbatoolbox --image=microsoft/mssql-tools -ti --restart=Never --rm=true -- /bin/bash +$ kubectl run mssqlcli --image=microsoft/mssql-tools -ti --restart=Never --rm=true -- /bin/bash $ sqlcmd -S mymssql-mssql-linux -U sa Password: $ 1> select @@VERSION; $ 2> go ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +------------------------------------------------------------------------------------ Microsoft SQL Server 2017 (RTM-CU3-GDR) (KB4052987) - 14.0.3015.40 (X64) Dec 22 2017 16:13:22 Copyright (C) 2017 Microsoft Corporation - Express Edition (64-bit) on Linux (Ubuntu 16.04.3 LTS) - + Express Edition (64-bit) on Linux (Ubuntu 16.04.3 LTS) (1 rows affected) ``` @@ -75,8 +74,9 @@ The configuration parameters in this section control the resources requested and | Parameter | Description | Default | | --------- | ----------- | ------- | -| ACCEPT_EULA | EULA that needs to be accepted. It will need to be changed via commandline or values.yaml. | N | -| edition | The edition of SQL Server to install. See section [Editions](#sql-server-for-linux-editions). | Express | +| ACCEPT_EULA.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 | Overrides the randomly created password with a default password. [Please read password requirements](https://docs.microsoft.com/en-us/sql/relational-databases/security/password-policy). | Random (20-AlphNum) | | image.repository | The docker hub repo for SQL Server | microsoft/mssql-server-linux | | image.tag | The tag for the image | latest | | image.pullPolicy | The pull policy for the deployment | IfNotPresent | diff --git a/incubator/mssql-linux/templates/NOTES.txt b/incubator/mssql-linux/templates/NOTES.txt index 93661cf6ace1..956f24afe9d0 100644 --- a/incubator/mssql-linux/templates/NOTES.txt +++ b/incubator/mssql-linux/templates/NOTES.txt @@ -6,13 +6,14 @@ License Terms: https://go.microsoft.com/fwlink/?linkid=857698 Docker Hub Resource: https://hub.docker.com/r/microsoft/mssql-server-linux Note - By Default the Express Edition is installed as part of this Chart. -Edition for this installation: {{ .Values.edition.value}} +Edition for this installation: {{ .Values.edition.value }} 1. 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) -$ kubectl run dbatoolbox --image=microsoft/mssql-tools -ti --restart=Never --rm=true -- /bin/bash -$ sqlcmd -S {{ template "mssql.fullname" . }}.{{ .Release.Namespace }} -U sa -P +$ kubectl run mssqlcli --image=microsoft/mssql-tools -ti --restart=Never --rm=true -- /bin/bash +$ sqlcmd -S {{ template "mssql.fullname" . }}.{{ .Release.Namespace }},{{ .Values.service.internalPort }} -U sa +$ Password: 2. Connection Library Information https://docs.microsoft.com/en-us/sql/connect/sql-connection-libraries diff --git a/incubator/mssql-linux/templates/deployment.yaml b/incubator/mssql-linux/templates/deployment.yaml index 92b89b025560..cf864ab8e3fe 100644 --- a/incubator/mssql-linux/templates/deployment.yaml +++ b/incubator/mssql-linux/templates/deployment.yaml @@ -9,6 +9,10 @@ metadata: heritage: {{ .Release.Service }} spec: replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + app: {{ template "mssql.name" . }} + release: {{ .Release.Name }} template: metadata: labels: @@ -28,7 +32,7 @@ spec: valueFrom: secretKeyRef: name: {{ template "mssql.fullname" . }}-secret - key: password + key: sapassword ports: - containerPort: {{ .Values.service.internalPort }} livenessProbe: diff --git a/incubator/mssql-linux/templates/secret.yaml b/incubator/mssql-linux/templates/secret.yaml index 6b487fab1a2e..af5212e9a442 100644 --- a/incubator/mssql-linux/templates/secret.yaml +++ b/incubator/mssql-linux/templates/secret.yaml @@ -9,4 +9,8 @@ metadata: heritage: {{ .Release.Service }} type: Opaque data: - password: {{ randAlphaNum 15 | b64enc | quote }} + {{ if .Values.sapassword }} + sapassword: {{ .Values.sapassword | b64enc | quote }} + {{ else }} + sapassword: {{ randAlphaNum 20 | b64enc | quote }} + {{ end }} \ No newline at end of file diff --git a/incubator/mssql-linux/values.yaml b/incubator/mssql-linux/values.yaml index caa73fba4dce..7b8b145f9550 100644 --- a/incubator/mssql-linux/values.yaml +++ b/incubator/mssql-linux/values.yaml @@ -1,7 +1,9 @@ -ACCEPT_EULA: - value: N -edition: +ACCEPT_EULA: + value: "N" +edition: value: Express +# Override sapassword in templates/secret.yaml +#sapassword: "MyStrongPassword1234" image: repository: microsoft/mssql-server-linux tag: latest @@ -24,3 +26,4 @@ resources: {} # requests: # cpu: 100m # memory: 2Gi +nodeSelector: {} \ No newline at end of file From d078791d332916e680e67110d22c4f49af4ed5f9 Mon Sep 17 00:00:00 2001 From: thomasliddledba Date: Wed, 17 Jan 2018 07:58:14 -0500 Subject: [PATCH 12/15] ci/circleci fixes --- incubator/mssql-linux/values.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/incubator/mssql-linux/values.yaml b/incubator/mssql-linux/values.yaml index 7b8b145f9550..950820a6e7b5 100644 --- a/incubator/mssql-linux/values.yaml +++ b/incubator/mssql-linux/values.yaml @@ -1,9 +1,9 @@ -ACCEPT_EULA: +ACCEPT_EULA: value: "N" -edition: +edition: value: Express # Override sapassword in templates/secret.yaml -#sapassword: "MyStrongPassword1234" +# sapassword: "MyStrongPassword1234" image: repository: microsoft/mssql-server-linux tag: latest @@ -26,4 +26,4 @@ resources: {} # requests: # cpu: 100m # memory: 2Gi -nodeSelector: {} \ No newline at end of file +nodeSelector: {} From 8008cc0185f3bac1f3f3f69f945993ee78d4e798 Mon Sep 17 00:00:00 2001 From: thomasliddledba Date: Mon, 29 Jan 2018 15:21:46 -0500 Subject: [PATCH 13/15] Updated release version, README.md, and hard-coded ports --- incubator/mssql-linux/README.md | 16 +++++++--------- incubator/mssql-linux/templates/NOTES.txt | 4 ++-- incubator/mssql-linux/templates/deployment.yaml | 8 ++++---- incubator/mssql-linux/templates/service.yaml | 4 ++-- incubator/mssql-linux/values.yaml | 8 +++----- 5 files changed, 18 insertions(+), 22 deletions(-) diff --git a/incubator/mssql-linux/README.md b/incubator/mssql-linux/README.md index 7623bb2639b0..2d68179a55bb 100644 --- a/incubator/mssql-linux/README.md +++ b/incubator/mssql-linux/README.md @@ -4,7 +4,7 @@ * This chart requires Docker Engine 1.8+ in any of their supported platforms. Please see vendor requirements [here for more information](https://docs.microsoft.com/en-us/sql/linux/quickstart-install-connect-docker). * At least 2GB of RAM (3.25 GB prior to 2017-CU2). Make sure to assign enough memory to the Docker VM if you're running on Docker for Mac or Windows. * Requires the following variables - - You must change the ACCEPT_EULA.value in the values.yaml file to `Y` or include `--set ACCEPT_EULA.value=Y` in the command line of `helm install` to override the default value of `N`. + - You must change the acceptEula.value in the values.yaml file to `Y` or include `--set acceptEula.value=Y` in the command line of `helm install` to override the default value of `N`. - You must change the editions variable in the values.yaml file to include the edition of SQL Server or include `--set edition.value=` in the command line of `helm install`. ## Chart Components @@ -16,7 +16,7 @@ You can install the chart with the release name `mymssql` as below. ```console $ helm repo add incubator http://storage.googleapis.com/kubernetes-charts-incubator -$ helm install --name mymssql incubator/mssql-linux --set ACCEPT_EULA.value=Y --set edition.value=Developer +$ helm install --name mymssql incubator/mssql-linux --set acceptEula.value=Y --set edition.value=Developer ``` > Note - If you do not specify a name, helm will select a name for you. @@ -74,16 +74,14 @@ The configuration parameters in this section control the resources requested and | Parameter | Description | Default | | --------- | ----------- | ------- | -| ACCEPT_EULA.value | EULA that needs to be accepted. It will need to be changed via commandline or values.yaml. | N | +| 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 | Overrides the randomly created password with a default password. [Please read password requirements](https://docs.microsoft.com/en-us/sql/relational-databases/security/password-policy). | Random (20-AlphNum) | | image.repository | The docker hub repo for SQL Server | microsoft/mssql-server-linux | -| image.tag | The tag for the image | latest | +| image.tag | The tag for the image | 2017-CU3 | | image.pullPolicy | The pull policy for the deployment | IfNotPresent | | service.name | Service Name | mssqlsrvr | | service.type | Service Type | ClusterIP | -| externalPort | External Port | 1433 | -| internalPort | Internal Port | 1433 | ## Liveness and Readiness The SQL Server instance has liveness and readiness checks specified. These parameters can be used to tune the sensitivity of the liveness and readiness checks. @@ -100,14 +98,14 @@ The SQL Server instance has liveness and readiness checks specified. These param | readinessprobe.periodSeconds | Field specifies that the kubelet should perform a liveness probe every XX second(s) | 10 | ## Resources -You can specify the resource limits for this chart in the values.yaml file. +You can specify the resource limits for this chart in the values.yaml file. Make sure you comment out or remove the curly brackets from the values.yaml file before specifying resource limits. Example: ```yaml resources: - limits: + limits: cpu: 1 memory: 2Gi - requests: + requests: cpu: 0.5 memory: 2Gi ``` diff --git a/incubator/mssql-linux/templates/NOTES.txt b/incubator/mssql-linux/templates/NOTES.txt index 956f24afe9d0..5721bf59db1c 100644 --- a/incubator/mssql-linux/templates/NOTES.txt +++ b/incubator/mssql-linux/templates/NOTES.txt @@ -12,7 +12,7 @@ Edition for this installation: {{ .Values.edition.value }} 1. 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) $ kubectl run mssqlcli --image=microsoft/mssql-tools -ti --restart=Never --rm=true -- /bin/bash -$ sqlcmd -S {{ template "mssql.fullname" . }}.{{ .Release.Namespace }},{{ .Values.service.internalPort }} -U sa +$ sqlcmd -S {{ template "mssql.fullname" . }}.{{ .Release.Namespace }},1433 -U sa $ Password: 2. Connection Library Information @@ -22,4 +22,4 @@ https://docs.microsoft.com/en-us/sql/connect/sql-connection-libraries https://docs.microsoft.com/en-us/sql/connect/jdbc/connecting-to-sql-server-with-the-jdbc-driver SQL Server Name: {{ template "mssql.fullname" . }}.{{ .Release.Namespace }} -Port: {{ .Values.service.internalPort }} +Port: 1433 diff --git a/incubator/mssql-linux/templates/deployment.yaml b/incubator/mssql-linux/templates/deployment.yaml index cf864ab8e3fe..8c8961009069 100644 --- a/incubator/mssql-linux/templates/deployment.yaml +++ b/incubator/mssql-linux/templates/deployment.yaml @@ -25,7 +25,7 @@ spec: imagePullPolicy: {{ .Values.image.pullPolicy }} env: - name: ACCEPT_EULA - value: "{{ .Values.ACCEPT_EULA.value }}" + value: "{{ .Values.acceptEula.value | upper }}" - name: MSSQL_PID value: "{{ .Values.edition.value }}" - name: SA_PASSWORD @@ -34,15 +34,15 @@ spec: name: {{ template "mssql.fullname" . }}-secret key: sapassword ports: - - containerPort: {{ .Values.service.internalPort }} + - containerPort: 1433 livenessProbe: tcpSocket: - port: {{ .Values.service.internalPort }} + port: 1433 initialDelaySeconds: {{ .Values.livenessprobe.initialDelaySeconds }} periodSeconds: {{ .Values.livenessprobe.periodSeconds }} readinessProbe: tcpSocket: - port: {{ .Values.service.internalPort }} + port: 1433 initialDelaySeconds: {{ .Values.readinessprobe.initialDelaySeconds }} periodSeconds: {{ .Values.readinessprobe.periodSeconds }} resources: diff --git a/incubator/mssql-linux/templates/service.yaml b/incubator/mssql-linux/templates/service.yaml index fd8372566d58..68c5b35bd6ab 100644 --- a/incubator/mssql-linux/templates/service.yaml +++ b/incubator/mssql-linux/templates/service.yaml @@ -10,8 +10,8 @@ metadata: spec: type: {{ .Values.service.type }} ports: - - port: {{ .Values.service.externalPort }} - targetPort: {{ .Values.service.internalPort }} + - port: 1433 + targetPort: 1433 protocol: TCP name: {{ .Values.service.name }} selector: diff --git a/incubator/mssql-linux/values.yaml b/incubator/mssql-linux/values.yaml index 950820a6e7b5..415942104e08 100644 --- a/incubator/mssql-linux/values.yaml +++ b/incubator/mssql-linux/values.yaml @@ -1,18 +1,16 @@ -ACCEPT_EULA: - value: "N" +acceptEula: + value: "n" edition: value: Express # Override sapassword in templates/secret.yaml # sapassword: "MyStrongPassword1234" image: repository: microsoft/mssql-server-linux - tag: latest + tag: 2017-CU3 pullPolicy: IfNotPresent service: name: mssqlsrvr type: ClusterIP - externalPort: 1433 - internalPort: 1433 livenessprobe: initialDelaySeconds: 15 periodSeconds: 20 From 4afb6b837a024c1d70e28975f620c3f406799549 Mon Sep 17 00:00:00 2001 From: thomasliddledba Date: Mon, 29 Jan 2018 17:16:47 -0500 Subject: [PATCH 14/15] Added port name, configured probes, moved to stable --- {incubator => stable}/mssql-linux/Chart.yaml | 0 {incubator => stable}/mssql-linux/README.md | 4 ++-- {incubator => stable}/mssql-linux/templates/NOTES.txt | 0 {incubator => stable}/mssql-linux/templates/_helpers.tpl | 0 .../mssql-linux/templates/deployment.yaml | 7 ++++--- {incubator => stable}/mssql-linux/templates/secret.yaml | 0 {incubator => stable}/mssql-linux/templates/service.yaml | 8 ++++---- {incubator => stable}/mssql-linux/values.yaml | 1 - 8 files changed, 10 insertions(+), 10 deletions(-) rename {incubator => stable}/mssql-linux/Chart.yaml (100%) rename {incubator => stable}/mssql-linux/README.md (97%) rename {incubator => stable}/mssql-linux/templates/NOTES.txt (100%) rename {incubator => stable}/mssql-linux/templates/_helpers.tpl (100%) rename {incubator => stable}/mssql-linux/templates/deployment.yaml (94%) rename {incubator => stable}/mssql-linux/templates/secret.yaml (100%) rename {incubator => stable}/mssql-linux/templates/service.yaml (80%) rename {incubator => stable}/mssql-linux/values.yaml (96%) diff --git a/incubator/mssql-linux/Chart.yaml b/stable/mssql-linux/Chart.yaml similarity index 100% rename from incubator/mssql-linux/Chart.yaml rename to stable/mssql-linux/Chart.yaml diff --git a/incubator/mssql-linux/README.md b/stable/mssql-linux/README.md similarity index 97% rename from incubator/mssql-linux/README.md rename to stable/mssql-linux/README.md index 2d68179a55bb..d2bb544d87ce 100644 --- a/incubator/mssql-linux/README.md +++ b/stable/mssql-linux/README.md @@ -15,8 +15,8 @@ ## Installing the Chart You can install the chart with the release name `mymssql` as below. ```console -$ helm repo add incubator http://storage.googleapis.com/kubernetes-charts-incubator -$ helm install --name mymssql incubator/mssql-linux --set acceptEula.value=Y --set edition.value=Developer +$ helm repo add stable https://kubernetes-charts.storage.googleapis.com/ +$ helm install --name mymssql stable/mssql-linux --set acceptEula.value=Y --set edition.value=Developer ``` > Note - If you do not specify a name, helm will select a name for you. diff --git a/incubator/mssql-linux/templates/NOTES.txt b/stable/mssql-linux/templates/NOTES.txt similarity index 100% rename from incubator/mssql-linux/templates/NOTES.txt rename to stable/mssql-linux/templates/NOTES.txt diff --git a/incubator/mssql-linux/templates/_helpers.tpl b/stable/mssql-linux/templates/_helpers.tpl similarity index 100% rename from incubator/mssql-linux/templates/_helpers.tpl rename to stable/mssql-linux/templates/_helpers.tpl diff --git a/incubator/mssql-linux/templates/deployment.yaml b/stable/mssql-linux/templates/deployment.yaml similarity index 94% rename from incubator/mssql-linux/templates/deployment.yaml rename to stable/mssql-linux/templates/deployment.yaml index 8c8961009069..02b8f26ecd37 100644 --- a/incubator/mssql-linux/templates/deployment.yaml +++ b/stable/mssql-linux/templates/deployment.yaml @@ -34,15 +34,16 @@ spec: name: {{ template "mssql.fullname" . }}-secret key: sapassword ports: - - containerPort: 1433 + - name: db + containerPort: 1433 livenessProbe: tcpSocket: - port: 1433 + port: db initialDelaySeconds: {{ .Values.livenessprobe.initialDelaySeconds }} periodSeconds: {{ .Values.livenessprobe.periodSeconds }} readinessProbe: tcpSocket: - port: 1433 + port: db initialDelaySeconds: {{ .Values.readinessprobe.initialDelaySeconds }} periodSeconds: {{ .Values.readinessprobe.periodSeconds }} resources: diff --git a/incubator/mssql-linux/templates/secret.yaml b/stable/mssql-linux/templates/secret.yaml similarity index 100% rename from incubator/mssql-linux/templates/secret.yaml rename to stable/mssql-linux/templates/secret.yaml diff --git a/incubator/mssql-linux/templates/service.yaml b/stable/mssql-linux/templates/service.yaml similarity index 80% rename from incubator/mssql-linux/templates/service.yaml rename to stable/mssql-linux/templates/service.yaml index 68c5b35bd6ab..6add11ba47b7 100644 --- a/incubator/mssql-linux/templates/service.yaml +++ b/stable/mssql-linux/templates/service.yaml @@ -10,10 +10,10 @@ metadata: spec: type: {{ .Values.service.type }} ports: - - port: 1433 - targetPort: 1433 - protocol: TCP - name: {{ .Values.service.name }} + - name: db + port: 1433 + targetPort: db + protocol: TCP selector: app: {{ template "mssql.name" . }} release: {{ .Release.Name }} diff --git a/incubator/mssql-linux/values.yaml b/stable/mssql-linux/values.yaml similarity index 96% rename from incubator/mssql-linux/values.yaml rename to stable/mssql-linux/values.yaml index 415942104e08..f1a701167c28 100644 --- a/incubator/mssql-linux/values.yaml +++ b/stable/mssql-linux/values.yaml @@ -9,7 +9,6 @@ image: tag: 2017-CU3 pullPolicy: IfNotPresent service: - name: mssqlsrvr type: ClusterIP livenessprobe: initialDelaySeconds: 15 From 247a852cb087443f9478662f9414e273db23100b Mon Sep 17 00:00:00 2001 From: thomasliddledba Date: Tue, 30 Jan 2018 06:56:42 -0500 Subject: [PATCH 15/15] Updated README.md --- stable/mssql-linux/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/stable/mssql-linux/README.md b/stable/mssql-linux/README.md index d2bb544d87ce..751e32835dbe 100644 --- a/stable/mssql-linux/README.md +++ b/stable/mssql-linux/README.md @@ -15,7 +15,6 @@ ## Installing the Chart You can install the chart with the release name `mymssql` as below. ```console -$ helm repo add stable https://kubernetes-charts.storage.googleapis.com/ $ helm install --name mymssql stable/mssql-linux --set acceptEula.value=Y --set edition.value=Developer ``` > Note - If you do not specify a name, helm will select a name for you.