From 7e65148cf0e6a172d07e4938883a6e01da870227 Mon Sep 17 00:00:00 2001 From: Tiran Meltser Date: Thu, 7 Apr 2022 19:54:19 +0300 Subject: [PATCH 01/25] Add customization support for nodeSelector and tolerations --- linux/sample-helm-chart/templates/deployment.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/linux/sample-helm-chart/templates/deployment.yaml b/linux/sample-helm-chart/templates/deployment.yaml index 0e2827e9..09abb745 100644 --- a/linux/sample-helm-chart/templates/deployment.yaml +++ b/linux/sample-helm-chart/templates/deployment.yaml @@ -18,6 +18,13 @@ spec: labels: {{- include "mssql-latest.selectorLabels" . | nindent 8 }} spec: + nodeSelector: + kubernetes.io/os: linux + tolerations: + - key: "cattle.io/os" + operator: "Equal" + value: "linux" + effect: "NoSchedule" hostname: {{ .Values.hostname}} securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} From a1e66a7869f7a6d9bfcf9241528d210d75e6ee73 Mon Sep 17 00:00:00 2001 From: Tiran Meltser Date: Thu, 7 Apr 2022 20:12:53 +0300 Subject: [PATCH 02/25] Update additional values items --- linux/sample-helm-chart/templates/deployment.yaml | 13 ++++++------- linux/sample-helm-chart/values.yaml | 4 ++++ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/linux/sample-helm-chart/templates/deployment.yaml b/linux/sample-helm-chart/templates/deployment.yaml index 09abb745..fb3954c9 100644 --- a/linux/sample-helm-chart/templates/deployment.yaml +++ b/linux/sample-helm-chart/templates/deployment.yaml @@ -18,13 +18,12 @@ spec: labels: {{- include "mssql-latest.selectorLabels" . | nindent 8 }} spec: - nodeSelector: - kubernetes.io/os: linux - tolerations: - - key: "cattle.io/os" - operator: "Equal" - value: "linux" - effect: "NoSchedule" + {{- if .Values.nodeSelector }} + nodeSelector: {{- include "common.tplvalues.render" (dict "value" .Values.nodeSelector "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.tolerations }} + tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.tolerations "context" $) | nindent 8 }} + {{- end }} hostname: {{ .Values.hostname}} securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} diff --git a/linux/sample-helm-chart/values.yaml b/linux/sample-helm-chart/values.yaml index 2bbae807..5a05b04a 100644 --- a/linux/sample-helm-chart/values.yaml +++ b/linux/sample-helm-chart/values.yaml @@ -10,6 +10,10 @@ image: # Overrides the image tag whose default is the chart appVersion. tag: "2019-latest" +nodeSelector: {} + +tolerations: [] + ACCEPT_EULA: value: "y" MSSQL_PID: From 668e5a27d9ef0431b3e0c9e7a714106401856df1 Mon Sep 17 00:00:00 2001 From: Tiran Meltser Date: Thu, 7 Apr 2022 20:19:02 +0300 Subject: [PATCH 03/25] Update a bug in the deployment --- linux/sample-helm-chart/templates/deployment.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/linux/sample-helm-chart/templates/deployment.yaml b/linux/sample-helm-chart/templates/deployment.yaml index fb3954c9..ffe05886 100644 --- a/linux/sample-helm-chart/templates/deployment.yaml +++ b/linux/sample-helm-chart/templates/deployment.yaml @@ -19,10 +19,12 @@ spec: {{- include "mssql-latest.selectorLabels" . | nindent 8 }} spec: {{- if .Values.nodeSelector }} - nodeSelector: {{- include "common.tplvalues.render" (dict "value" .Values.nodeSelector "context" $) | nindent 8 }} + nodeSelector: +{{ toYaml .Values.nodeSelector | indent 8 }} {{- end }} {{- if .Values.tolerations }} - tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.tolerations "context" $) | nindent 8 }} + tolerations: +{{ toYaml .Values.tolerations | indent 6 }} {{- end }} hostname: {{ .Values.hostname}} securityContext: From b695f4042ac66f83a4fc856e350dea117c1a9466 Mon Sep 17 00:00:00 2001 From: Tiran Meltser Date: Thu, 7 Apr 2022 20:27:07 +0300 Subject: [PATCH 04/25] Adjust indentation --- linux/sample-helm-chart/templates/deployment.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/linux/sample-helm-chart/templates/deployment.yaml b/linux/sample-helm-chart/templates/deployment.yaml index ffe05886..1adb4bfd 100644 --- a/linux/sample-helm-chart/templates/deployment.yaml +++ b/linux/sample-helm-chart/templates/deployment.yaml @@ -20,11 +20,11 @@ spec: spec: {{- if .Values.nodeSelector }} nodeSelector: -{{ toYaml .Values.nodeSelector | indent 8 }} + {{ - toYaml .Values.nodeSelector | nindent 8 }} {{- end }} {{- if .Values.tolerations }} tolerations: -{{ toYaml .Values.tolerations | indent 6 }} + {{ - toYaml .Values.tolerations | indent 6 }} {{- end }} hostname: {{ .Values.hostname}} securityContext: From 5bb8c6dda1bcdc7cfc3169a1cc0d27bb6ab7f994 Mon Sep 17 00:00:00 2001 From: Tiran Meltser Date: Thu, 7 Apr 2022 20:28:51 +0300 Subject: [PATCH 05/25] Update a bug --- linux/sample-helm-chart/templates/deployment.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux/sample-helm-chart/templates/deployment.yaml b/linux/sample-helm-chart/templates/deployment.yaml index 1adb4bfd..3c700ada 100644 --- a/linux/sample-helm-chart/templates/deployment.yaml +++ b/linux/sample-helm-chart/templates/deployment.yaml @@ -24,7 +24,7 @@ spec: {{- end }} {{- if .Values.tolerations }} tolerations: - {{ - toYaml .Values.tolerations | indent 6 }} + {{ - toYaml .Values.tolerations | nindent 6 }} {{- end }} hostname: {{ .Values.hostname}} securityContext: From dfdc9b8119c30d500f2e6d41170b37884d956832 Mon Sep 17 00:00:00 2001 From: Tiran Meltser Date: Thu, 7 Apr 2022 20:32:09 +0300 Subject: [PATCH 06/25] Revert to original --- linux/sample-helm-chart/templates/deployment.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/linux/sample-helm-chart/templates/deployment.yaml b/linux/sample-helm-chart/templates/deployment.yaml index 3c700ada..ffe05886 100644 --- a/linux/sample-helm-chart/templates/deployment.yaml +++ b/linux/sample-helm-chart/templates/deployment.yaml @@ -20,11 +20,11 @@ spec: spec: {{- if .Values.nodeSelector }} nodeSelector: - {{ - toYaml .Values.nodeSelector | nindent 8 }} +{{ toYaml .Values.nodeSelector | indent 8 }} {{- end }} {{- if .Values.tolerations }} tolerations: - {{ - toYaml .Values.tolerations | nindent 6 }} +{{ toYaml .Values.tolerations | indent 6 }} {{- end }} hostname: {{ .Values.hostname}} securityContext: From 230994054cd492a85cd4cfde2481eeb359f5dd0e Mon Sep 17 00:00:00 2001 From: Tiran Meltser Date: Fri, 8 Apr 2022 02:58:51 +0300 Subject: [PATCH 07/25] Add support for service annotations --- linux/sample-helm-chart/templates/service.yaml | 4 ++++ linux/sample-helm-chart/values.yaml | 1 + 2 files changed, 5 insertions(+) diff --git a/linux/sample-helm-chart/templates/service.yaml b/linux/sample-helm-chart/templates/service.yaml index a24f844b..65fb0aac 100644 --- a/linux/sample-helm-chart/templates/service.yaml +++ b/linux/sample-helm-chart/templates/service.yaml @@ -4,6 +4,10 @@ metadata: name: {{ include "mssql-latest.fullname" . }} labels: {{- include "mssql-latest.labels" . | nindent 4 }} + {{- with .Values.service.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} spec: type: {{ .Values.service.type }} ports: diff --git a/linux/sample-helm-chart/values.yaml b/linux/sample-helm-chart/values.yaml index 5a05b04a..9d9b8165 100644 --- a/linux/sample-helm-chart/values.yaml +++ b/linux/sample-helm-chart/values.yaml @@ -34,6 +34,7 @@ podSecurityContext: service: type: LoadBalancer port: 1433 + annotations: {} pvc: StorageClass: "azure-disk" From c590f5427731b082e16b744b08781d87f08083ce Mon Sep 17 00:00:00 2001 From: Tiran Meltser Date: Fri, 8 Apr 2022 12:04:16 +0300 Subject: [PATCH 08/25] Align chart all over --- .../Chart.yaml | 0 .../readme.md | 2 +- .../templates/_helpers.tpl | 0 .../templates/deployment.yaml | 38 +++--- .../templates/mssqlconfig.yaml | 48 ++++---- .../templates/pvc.yaml | 111 ++++++++---------- .../templates/secret.yaml | 16 +-- .../templates/service.yaml | 0 .../values.yaml | 18 +-- .../templates/sc.yaml | 8 -- .../.helmignore | 0 .../Chart.yaml | 0 .../readme.md | 0 .../services/Ag_endpoint.yaml | 70 +++++------ .../services/ex_service.yaml | 0 .../templates/_helpers.tpl | 0 .../templates/mssqlconfig.yaml | 38 +++--- .../templates/service.yaml | 0 .../templates/statefulset.yaml} | 0 .../values.yaml | 0 20 files changed, 167 insertions(+), 182 deletions(-) rename linux/{sample-helm-chart => sample-helm-chart-deployment}/Chart.yaml (100%) rename linux/{sample-helm-chart => sample-helm-chart-deployment}/readme.md (99%) rename linux/{sample-helm-chart => sample-helm-chart-deployment}/templates/_helpers.tpl (100%) rename linux/{sample-helm-chart => sample-helm-chart-deployment}/templates/deployment.yaml (75%) rename linux/{sample-helm-chart => sample-helm-chart-deployment}/templates/mssqlconfig.yaml (62%) rename linux/{sample-helm-chart => sample-helm-chart-deployment}/templates/pvc.yaml (55%) rename linux/{sample-helm-chart => sample-helm-chart-deployment}/templates/secret.yaml (96%) rename linux/{sample-helm-chart => sample-helm-chart-deployment}/templates/service.yaml (100%) rename linux/{sample-helm-chart => sample-helm-chart-deployment}/values.yaml (74%) delete mode 100644 linux/sample-helm-chart-statefulset-deployment/templates/sc.yaml rename linux/{sample-helm-chart-statefulset-deployment => sample-helm-chart-statefulset}/.helmignore (100%) rename linux/{sample-helm-chart-statefulset-deployment => sample-helm-chart-statefulset}/Chart.yaml (100%) rename linux/{sample-helm-chart-statefulset-deployment => sample-helm-chart-statefulset}/readme.md (100%) rename linux/{sample-helm-chart-statefulset-deployment => sample-helm-chart-statefulset}/services/Ag_endpoint.yaml (94%) rename linux/{sample-helm-chart-statefulset-deployment => sample-helm-chart-statefulset}/services/ex_service.yaml (100%) rename linux/{sample-helm-chart-statefulset-deployment => sample-helm-chart-statefulset}/templates/_helpers.tpl (100%) rename linux/{sample-helm-chart-statefulset-deployment => sample-helm-chart-statefulset}/templates/mssqlconfig.yaml (93%) rename linux/{sample-helm-chart-statefulset-deployment => sample-helm-chart-statefulset}/templates/service.yaml (100%) rename linux/{sample-helm-chart-statefulset-deployment/templates/deployment.yaml => sample-helm-chart-statefulset/templates/statefulset.yaml} (100%) rename linux/{sample-helm-chart-statefulset-deployment => sample-helm-chart-statefulset}/values.yaml (100%) diff --git a/linux/sample-helm-chart/Chart.yaml b/linux/sample-helm-chart-deployment/Chart.yaml similarity index 100% rename from linux/sample-helm-chart/Chart.yaml rename to linux/sample-helm-chart-deployment/Chart.yaml diff --git a/linux/sample-helm-chart/readme.md b/linux/sample-helm-chart-deployment/readme.md similarity index 99% rename from linux/sample-helm-chart/readme.md rename to linux/sample-helm-chart-deployment/readme.md index aba6bd36..d96a614a 100644 --- a/linux/sample-helm-chart/readme.md +++ b/linux/sample-helm-chart-deployment/readme.md @@ -27,7 +27,7 @@ On the client machine where you have the Helm tools installed, download the char | Values.MSSQL_PID.value | Set the SQL Server edition or product key. please refer environment variable for more details | Developer | | Values.MSSQL_AGENT_ENABLED.value | Enable SQL Server Agent. For example, 'true' is enabled and 'false' is disabled. By default, agent is disabled. please refer environment variable for more details. | TRUE | | Values.hostname | The name that you would like to see when you run the select @@servername for the SQL instance running inside the container. | mssqllatest | -| Values.sa_password | Configure the SA user password. | StrongPass1! | +| Values.sa_password | Configure the SA user password. | Toughpass1! | | Values.containers.ports.containerPort | Port on which the SQL Server is listening inside the container. | 1433 | | Values.podSecurityContext.fsgroup | Security context at the pod level. | 10001 | | Values.service.type | The type of the service to be created within the kubernetes cluster. | LoadBalancer | diff --git a/linux/sample-helm-chart/templates/_helpers.tpl b/linux/sample-helm-chart-deployment/templates/_helpers.tpl similarity index 100% rename from linux/sample-helm-chart/templates/_helpers.tpl rename to linux/sample-helm-chart-deployment/templates/_helpers.tpl diff --git a/linux/sample-helm-chart/templates/deployment.yaml b/linux/sample-helm-chart-deployment/templates/deployment.yaml similarity index 75% rename from linux/sample-helm-chart/templates/deployment.yaml rename to linux/sample-helm-chart-deployment/templates/deployment.yaml index ffe05886..4b9a860b 100644 --- a/linux/sample-helm-chart/templates/deployment.yaml +++ b/linux/sample-helm-chart-deployment/templates/deployment.yaml @@ -48,33 +48,33 @@ spec: value: "{{ .Values.MSSQL_AGENT_ENABLED.value}}" - name: SA_PASSWORD valueFrom: - secretKeyRef: - name: mssql-secret - key: {{ template "mssql.sapassword" . }} + secretKeyRef: + name: mssql-secret + key: {{ template "mssql.sapassword" . }} volumeMounts: - - name: mssqldb - mountPath: /var/opt/mssql - - name: mssqluserdb - mountPath: /var/opt/mssql/userdata + - name: mssqldata + mountPath: /var/opt/mssql/data/db - name: mssqllog - mountPath: /var/opt/mssql/userlog - - name: mssqltemp - mountPath: /var/opt/mssql/tempdb + mountPath: /var/opt/mssql/data/log + - name: mssqldump + mountPath: /var/opt/mssql/data/dump + - name: mssqlbackup + mountPath: /var/opt/mssql/data/bckup - name: mssql-config-volume mountPath: /var/opt/config volumes: - - name: mssqldb + - name: mssqldata persistentVolumeClaim: - claimName: mssql-data - - name: mssqluserdb - persistentVolumeClaim: - claimName: mssql-userdb + claimName: mssql-data - name: mssqllog persistentVolumeClaim: - claimName: mssql-log - - name: mssqltemp + claimName: mssql-log + - name: mssqldump + persistentVolumeClaim: + claimName: mssql-dump + - name: mssqlbackup persistentVolumeClaim: - claimName: mssql-temp + claimName: mssql-backup - name: mssql-config-volume configMap: - name: mssql-config \ No newline at end of file + name: mssql-config diff --git a/linux/sample-helm-chart/templates/mssqlconfig.yaml b/linux/sample-helm-chart-deployment/templates/mssqlconfig.yaml similarity index 62% rename from linux/sample-helm-chart/templates/mssqlconfig.yaml rename to linux/sample-helm-chart-deployment/templates/mssqlconfig.yaml index d1e11cc3..82351ff9 100644 --- a/linux/sample-helm-chart/templates/mssqlconfig.yaml +++ b/linux/sample-helm-chart-deployment/templates/mssqlconfig.yaml @@ -1,23 +1,25 @@ -kind: ConfigMap -apiVersion: v1 -metadata: - name: mssql-config -data: - mssql.conf: | - [EULA] - accepteula = Y - accepteulaml = Y - - [coredump] - captureminiandfull = true - coredumptype = full - - [hadr] - hadrenabled = 1 - - [language] - lcid = 1033 - - [filelocation] - defaultdatadir = /var/opt/mssql/userdata - defaultlogdir = /var/opt/mssql/userlog \ No newline at end of file +kind: ConfigMap +apiVersion: v1 +metadata: + name: mssql-config +data: + mssql.conf: | + [EULA] + accepteula = Y + accepteulaml = Y + + [coredump] + captureminiandfull = true + coredumptype = full + + [hadr] + hadrenabled = 1 + + [language] + lcid = 1033 + + [filelocation] + defaultdatadir = /var/opt/mssql/data/db + defaultlogdir = /var/opt/mssql/data/log + defaultdumpdir = /var/opt/mssql/data/dump + defaultbackupdir = /var/opt/mssql/data/backup diff --git a/linux/sample-helm-chart/templates/pvc.yaml b/linux/sample-helm-chart-deployment/templates/pvc.yaml similarity index 55% rename from linux/sample-helm-chart/templates/pvc.yaml rename to linux/sample-helm-chart-deployment/templates/pvc.yaml index 411d21ac..bd337234 100644 --- a/linux/sample-helm-chart/templates/pvc.yaml +++ b/linux/sample-helm-chart-deployment/templates/pvc.yaml @@ -1,60 +1,51 @@ -kind: StorageClass -apiVersion: storage.k8s.io/v1 -metadata: - name: azure-disk -provisioner: kubernetes.io/azure-disk -parameters: - storageaccounttype: Standard_LRS - kind: Managed ---- -kind: PersistentVolumeClaim -apiVersion: v1 -metadata: - name: mssql-data - annotations: - volume.beta.kubernetes.io/storage-class: {{ .Values.pvc.StorageClass | quote }} -spec: - accessModes: - - {{ .Values.pvc.mssqldataaccessMode | quote}} - resources: - requests: - storage: {{ .Values.pvc.mssqldbsize}} ---- -kind: PersistentVolumeClaim -apiVersion: v1 -metadata: - name: mssql-userdb - annotations: - volume.beta.kubernetes.io/storage-class: {{ .Values.pvc.StorageClass}} -spec: - accessModes: - - {{ .Values.pvc.userdbaccessMode | quote}} - resources: - requests: - storage: {{ .Values.pvc.userdbsize}} ---- -kind: PersistentVolumeClaim -apiVersion: v1 -metadata: - name: mssql-log - annotations: - volume.beta.kubernetes.io/storage-class: {{ .Values.pvc.StorageClass}} -spec: - accessModes: - - {{ .Values.pvc.userlogaccessMode | quote}} - resources: - requests: - storage: {{ .Values.pvc.userlogsize}} ---- -kind: PersistentVolumeClaim -apiVersion: v1 -metadata: - name: mssql-temp - annotations: - volume.beta.kubernetes.io/storage-class: {{ .Values.pvc.StorageClass}} -spec: - accessModes: - - {{ .Values.pvc.tempdbaccessMode | quote}} - resources: - requests: - storage: {{ .Values.pvc.tempsize}} \ No newline at end of file +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: mssql-data + annotations: + volume.beta.kubernetes.io/storage-class: {{ .Values.pvc.StorageClass | quote }} +spec: + accessModes: + - {{ .Values.pvc.dataaccessMode | quote}} + resources: + requests: + storage: {{ .Values.pvc.datasize}} +--- +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: mssql-log + annotations: + volume.beta.kubernetes.io/storage-class: {{ .Values.pvc.StorageClass}} +spec: + accessModes: + - {{ .Values.pvc.logaccessMode | quote}} + resources: + requests: + storage: {{ .Values.pvc.logsize}} +--- +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: mssql-dump + annotations: + volume.beta.kubernetes.io/storage-class: {{ .Values.pvc.StorageClass}} +spec: + accessModes: + - {{ .Values.pvc.dumpaccessMode | quote}} + resources: + requests: + storage: {{ .Values.pvc.dumpsize}} +--- +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: mssql-backup + annotations: + volume.beta.kubernetes.io/storage-class: {{ .Values.pvc.StorageClass}} +spec: + accessModes: + - {{ .Values.pvc.backupaccessMode | quote}} + resources: + requests: + storage: {{ .Values.pvc.backupsize}} diff --git a/linux/sample-helm-chart/templates/secret.yaml b/linux/sample-helm-chart-deployment/templates/secret.yaml similarity index 96% rename from linux/sample-helm-chart/templates/secret.yaml rename to linux/sample-helm-chart-deployment/templates/secret.yaml index be2ffc50..71b20a8b 100644 --- a/linux/sample-helm-chart/templates/secret.yaml +++ b/linux/sample-helm-chart-deployment/templates/secret.yaml @@ -1,9 +1,9 @@ -apiVersion: v1 -kind: Secret -metadata: - name: mssql-secret - labels: - {{- include "mssql-latest.labels" . | nindent 4 }} -type: Opaque -data: +apiVersion: v1 +kind: Secret +metadata: + name: mssql-secret + labels: + {{- include "mssql-latest.labels" . | nindent 4 }} +type: Opaque +data: sa_password : {{ .Values.sa_password | b64enc | quote}} \ No newline at end of file diff --git a/linux/sample-helm-chart/templates/service.yaml b/linux/sample-helm-chart-deployment/templates/service.yaml similarity index 100% rename from linux/sample-helm-chart/templates/service.yaml rename to linux/sample-helm-chart-deployment/templates/service.yaml diff --git a/linux/sample-helm-chart/values.yaml b/linux/sample-helm-chart-deployment/values.yaml similarity index 74% rename from linux/sample-helm-chart/values.yaml rename to linux/sample-helm-chart-deployment/values.yaml index 9d9b8165..f6c68e1e 100644 --- a/linux/sample-helm-chart/values.yaml +++ b/linux/sample-helm-chart-deployment/values.yaml @@ -37,14 +37,14 @@ service: annotations: {} pvc: - StorageClass: "azure-disk" - userdbaccessMode: ReadWriteOnce - userdbsize: 5Gi - userlogaccessMode: ReadWriteOnce - userlogsize: 5Gi - tempdbaccessMode: ReadWriteOnce - tempsize: 2Gi - mssqldataaccessMode: ReadWriteOnce - mssqldbsize: 2Gi + StorageClass: "" + dataaccessMode: ReadWriteOnce + datasize: 5Gi + logaccessMode: ReadWriteOnce + logsize: 5Gi + dumpaccessMode: ReadWriteOnce + dumpsize: 2Gi + backupaccessMode: ReadWriteOnce + backupsize: 2Gi diff --git a/linux/sample-helm-chart-statefulset-deployment/templates/sc.yaml b/linux/sample-helm-chart-statefulset-deployment/templates/sc.yaml deleted file mode 100644 index 6b75debf..00000000 --- a/linux/sample-helm-chart-statefulset-deployment/templates/sc.yaml +++ /dev/null @@ -1,8 +0,0 @@ -kind: StorageClass -apiVersion: storage.k8s.io/v1beta1 -metadata: - name: azure-disk -provisioner: kubernetes.io/azure-disk -parameters: - storageaccounttype: Standard_LRS - kind: Managed \ No newline at end of file diff --git a/linux/sample-helm-chart-statefulset-deployment/.helmignore b/linux/sample-helm-chart-statefulset/.helmignore similarity index 100% rename from linux/sample-helm-chart-statefulset-deployment/.helmignore rename to linux/sample-helm-chart-statefulset/.helmignore diff --git a/linux/sample-helm-chart-statefulset-deployment/Chart.yaml b/linux/sample-helm-chart-statefulset/Chart.yaml similarity index 100% rename from linux/sample-helm-chart-statefulset-deployment/Chart.yaml rename to linux/sample-helm-chart-statefulset/Chart.yaml diff --git a/linux/sample-helm-chart-statefulset-deployment/readme.md b/linux/sample-helm-chart-statefulset/readme.md similarity index 100% rename from linux/sample-helm-chart-statefulset-deployment/readme.md rename to linux/sample-helm-chart-statefulset/readme.md diff --git a/linux/sample-helm-chart-statefulset-deployment/services/Ag_endpoint.yaml b/linux/sample-helm-chart-statefulset/services/Ag_endpoint.yaml similarity index 94% rename from linux/sample-helm-chart-statefulset-deployment/services/Ag_endpoint.yaml rename to linux/sample-helm-chart-statefulset/services/Ag_endpoint.yaml index b999489a..26e255d5 100644 --- a/linux/sample-helm-chart-statefulset-deployment/services/Ag_endpoint.yaml +++ b/linux/sample-helm-chart-statefulset/services/Ag_endpoint.yaml @@ -1,35 +1,35 @@ -apiVersion: v1 -kind: Service -metadata: - name: mssql-mirror-0 -spec: - selector: - statefulset.kubernetes.io/pod-name: mssql-sql-statefull-deploy-0 - ports: - - protocol: TCP - port: 5022 - targetPort: 5022 ---- -apiVersion: v1 -kind: Service -metadata: - name: mssql-mirror-1 -spec: - selector: - statefulset.kubernetes.io/pod-name: mssql-sql-statefull-deploy-1 - ports: - - protocol: TCP - port: 5022 - targetPort: 5022 ---- -apiVersion: v1 -kind: Service -metadata: - name: mssql-mirror-2 -spec: - selector: - statefulset.kubernetes.io/pod-name: mssql-sql-statefull-deploy-2 - ports: - - protocol: TCP - port: 5022 - targetPort: 5022 +apiVersion: v1 +kind: Service +metadata: + name: mssql-mirror-0 +spec: + selector: + statefulset.kubernetes.io/pod-name: mssql-sql-statefull-deploy-0 + ports: + - protocol: TCP + port: 5022 + targetPort: 5022 +--- +apiVersion: v1 +kind: Service +metadata: + name: mssql-mirror-1 +spec: + selector: + statefulset.kubernetes.io/pod-name: mssql-sql-statefull-deploy-1 + ports: + - protocol: TCP + port: 5022 + targetPort: 5022 +--- +apiVersion: v1 +kind: Service +metadata: + name: mssql-mirror-2 +spec: + selector: + statefulset.kubernetes.io/pod-name: mssql-sql-statefull-deploy-2 + ports: + - protocol: TCP + port: 5022 + targetPort: 5022 diff --git a/linux/sample-helm-chart-statefulset-deployment/services/ex_service.yaml b/linux/sample-helm-chart-statefulset/services/ex_service.yaml similarity index 100% rename from linux/sample-helm-chart-statefulset-deployment/services/ex_service.yaml rename to linux/sample-helm-chart-statefulset/services/ex_service.yaml diff --git a/linux/sample-helm-chart-statefulset-deployment/templates/_helpers.tpl b/linux/sample-helm-chart-statefulset/templates/_helpers.tpl similarity index 100% rename from linux/sample-helm-chart-statefulset-deployment/templates/_helpers.tpl rename to linux/sample-helm-chart-statefulset/templates/_helpers.tpl diff --git a/linux/sample-helm-chart-statefulset-deployment/templates/mssqlconfig.yaml b/linux/sample-helm-chart-statefulset/templates/mssqlconfig.yaml similarity index 93% rename from linux/sample-helm-chart-statefulset-deployment/templates/mssqlconfig.yaml rename to linux/sample-helm-chart-statefulset/templates/mssqlconfig.yaml index cf877c3e..eea82fa3 100644 --- a/linux/sample-helm-chart-statefulset-deployment/templates/mssqlconfig.yaml +++ b/linux/sample-helm-chart-statefulset/templates/mssqlconfig.yaml @@ -1,20 +1,20 @@ -kind: ConfigMap -apiVersion: v1 -metadata: - name: mssql -data: - mssql.conf: | - [EULA] - accepteula = Y - accepteulaml = Y - - [coredump] - captureminiandfull = true - coredumptype = full - - [hadr] - hadrenabled = 1 - - [language] - lcid = 1033 +kind: ConfigMap +apiVersion: v1 +metadata: + name: mssql +data: + mssql.conf: | + [EULA] + accepteula = Y + accepteulaml = Y + + [coredump] + captureminiandfull = true + coredumptype = full + + [hadr] + hadrenabled = 1 + + [language] + lcid = 1033 \ No newline at end of file diff --git a/linux/sample-helm-chart-statefulset-deployment/templates/service.yaml b/linux/sample-helm-chart-statefulset/templates/service.yaml similarity index 100% rename from linux/sample-helm-chart-statefulset-deployment/templates/service.yaml rename to linux/sample-helm-chart-statefulset/templates/service.yaml diff --git a/linux/sample-helm-chart-statefulset-deployment/templates/deployment.yaml b/linux/sample-helm-chart-statefulset/templates/statefulset.yaml similarity index 100% rename from linux/sample-helm-chart-statefulset-deployment/templates/deployment.yaml rename to linux/sample-helm-chart-statefulset/templates/statefulset.yaml diff --git a/linux/sample-helm-chart-statefulset-deployment/values.yaml b/linux/sample-helm-chart-statefulset/values.yaml similarity index 100% rename from linux/sample-helm-chart-statefulset-deployment/values.yaml rename to linux/sample-helm-chart-statefulset/values.yaml From d658a0832f17b04298c565f1b3bc39f30fc93d8a Mon Sep 17 00:00:00 2001 From: Tiran Meltser Date: Fri, 8 Apr 2022 12:23:28 +0300 Subject: [PATCH 09/25] Fix a bug --- linux/sample-helm-chart-deployment/templates/deployment.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux/sample-helm-chart-deployment/templates/deployment.yaml b/linux/sample-helm-chart-deployment/templates/deployment.yaml index 4b9a860b..fb1dbb56 100644 --- a/linux/sample-helm-chart-deployment/templates/deployment.yaml +++ b/linux/sample-helm-chart-deployment/templates/deployment.yaml @@ -59,7 +59,7 @@ spec: - name: mssqldump mountPath: /var/opt/mssql/data/dump - name: mssqlbackup - mountPath: /var/opt/mssql/data/bckup + mountPath: /var/opt/mssql/data/basckup - name: mssql-config-volume mountPath: /var/opt/config volumes: From 6c88887a7d542ecce36282a2efe283f02c836373 Mon Sep 17 00:00:00 2001 From: Tiran Meltser Date: Fri, 8 Apr 2022 12:34:03 +0300 Subject: [PATCH 10/25] Change data file paths --- .../templates/deployment.yaml | 8 ++++---- .../templates/mssqlconfig.yaml | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/linux/sample-helm-chart-deployment/templates/deployment.yaml b/linux/sample-helm-chart-deployment/templates/deployment.yaml index fb1dbb56..3b79c2a0 100644 --- a/linux/sample-helm-chart-deployment/templates/deployment.yaml +++ b/linux/sample-helm-chart-deployment/templates/deployment.yaml @@ -53,13 +53,13 @@ spec: key: {{ template "mssql.sapassword" . }} volumeMounts: - name: mssqldata - mountPath: /var/opt/mssql/data/db + mountPath: /var/opt/mssql/db/data - name: mssqllog - mountPath: /var/opt/mssql/data/log + mountPath: /var/opt/mssql/db/log - name: mssqldump - mountPath: /var/opt/mssql/data/dump + mountPath: /var/opt/mssql/db/dump - name: mssqlbackup - mountPath: /var/opt/mssql/data/basckup + mountPath: /var/opt/mssql/db/basckup - name: mssql-config-volume mountPath: /var/opt/config volumes: diff --git a/linux/sample-helm-chart-deployment/templates/mssqlconfig.yaml b/linux/sample-helm-chart-deployment/templates/mssqlconfig.yaml index 82351ff9..5c72c8ce 100644 --- a/linux/sample-helm-chart-deployment/templates/mssqlconfig.yaml +++ b/linux/sample-helm-chart-deployment/templates/mssqlconfig.yaml @@ -19,7 +19,7 @@ data: lcid = 1033 [filelocation] - defaultdatadir = /var/opt/mssql/data/db - defaultlogdir = /var/opt/mssql/data/log - defaultdumpdir = /var/opt/mssql/data/dump - defaultbackupdir = /var/opt/mssql/data/backup + defaultdatadir = /var/opt/mssql/db/data + defaultlogdir = /var/opt/mssql/db/log + defaultdumpdir = /var/opt/mssql/db/dump + defaultbackupdir = /var/opt/mssql/db/backup From 1cfa6b78f7d78afeda1da97b72a0a33581ea296c Mon Sep 17 00:00:00 2001 From: Tiran Meltser Date: Fri, 8 Apr 2022 18:30:52 +0300 Subject: [PATCH 11/25] Add some order and alignment --- linux/sample-helm-chart-deployment/Chart.yaml | 2 +- linux/sample-helm-chart-deployment/readme.md | 14 +++---- .../templates/_helpers.tpl | 23 +++++----- .../templates/deployment.yaml | 42 +++++++++---------- .../templates/mssqlconfig.yaml | 2 +- .../templates/pvc.yaml | 8 ++-- .../templates/secret.yaml | 4 +- .../templates/service.yaml | 6 +-- .../sample-helm-chart-deployment/values.yaml | 2 +- 9 files changed, 51 insertions(+), 52 deletions(-) diff --git a/linux/sample-helm-chart-deployment/Chart.yaml b/linux/sample-helm-chart-deployment/Chart.yaml index 23eef3ff..6d5eded0 100644 --- a/linux/sample-helm-chart-deployment/Chart.yaml +++ b/linux/sample-helm-chart-deployment/Chart.yaml @@ -1,5 +1,5 @@ apiVersion: v2 -name: mssql-latest +name: mssql-server description: A Helm chart for Kubernetes # A chart can be either an 'application' or a 'library' chart. diff --git a/linux/sample-helm-chart-deployment/readme.md b/linux/sample-helm-chart-deployment/readme.md index d96a614a..063a549d 100644 --- a/linux/sample-helm-chart-deployment/readme.md +++ b/linux/sample-helm-chart-deployment/readme.md @@ -65,35 +65,35 @@ directory of the CLI to the directory where you have the chart downloaded and to ``` bash -helm install mssql-latest-deploy . --set ACCEPT_EULA.value=Y --set MSSQL_PID.value=Developer +helm install mssql-server-deploy . --set ACCEPT_EULA.value=Y --set MSSQL_PID.value=Developer ``` After a few seconds this should deploy the SQL Server containers and you can see all the artifacts using the command : ```bash -D:\helm-charts\mssql-latest\mssql-latest>kubectl get all +D:\helm-charts\mssql-server\mssql-server>kubectl get all ``` The output should look as shown below: ```bash NAME READY STATUS RESTARTS AGE -pod/mssql-latest-deploy-645c4dddd8-647zk 1/1 Running 4 23h +pod/mssql-server-deploy-645c4dddd8-647zk 1/1 Running 4 23h NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE service/kubernetes ClusterIP 10.0.0.1 443/TCP 140d -service/mssql-latest-deploy LoadBalancer 10.0.57.19 20.44.43.212 1433:30544/TCP 23h +service/mssql-server-deploy LoadBalancer 10.0.57.19 20.44.43.212 1433:30544/TCP 23h NAME READY UP-TO-DATE AVAILABLE AGE -deployment.apps/mssql-latest-deploy 1/1 1 1 23h +deployment.apps/mssql-server-deploy 1/1 1 1 23h NAME DESIRED CURRENT READY AGE -replicaset.apps/mssql-latest-deploy-645c4dddd8 1 1 1 23h +replicaset.apps/mssql-server-deploy-645c4dddd8 1 1 1 23h ``` ## Connect to SQL Server -Now you are ready to connect to the SQL Server using any of the familiar tools that you work with, like the [SSMS](https://docs.microsoft.com/en-us/sql/ssms/download-sql-server-management-studio-ssms?view=sql-server-ver15) (SQL Server Management Studio) or [SQLCMD](https://docs.microsoft.com/en-us/sql/tools/sqlcmd-utility?view=sql-server-ver15) or [ADS](https://docs.microsoft.com/en-us/sql/azure-data-studio/download-azure-data-studio?view=sql-server-ver15) (Azure Data Studio), etc. The IP address that you will use to connect is the External-IP address for the mssql-latest-deploy service which in this case is 20.44.43.212 that will be used to connect to SQL Server. +Now you are ready to connect to the SQL Server using any of the familiar tools that you work with, like the [SSMS](https://docs.microsoft.com/en-us/sql/ssms/download-sql-server-management-studio-ssms?view=sql-server-ver15) (SQL Server Management Studio) or [SQLCMD](https://docs.microsoft.com/en-us/sql/tools/sqlcmd-utility?view=sql-server-ver15) or [ADS](https://docs.microsoft.com/en-us/sql/azure-data-studio/download-azure-data-studio?view=sql-server-ver15) (Azure Data Studio), etc. The IP address that you will use to connect is the External-IP address for the mssql-server-deploy service which in this case is 20.44.43.212 that will be used to connect to SQL Server. For more details on the SQL Server deployment on AKS using manual method please refer [Deploy a SQL Server container in Kubernetes with Azure Kubernetes Services (AKS)](https://docs.microsoft.com/en-us/sql/linux/tutorial-sql-server-containers-kubernetes?view=sql-server-ver15). diff --git a/linux/sample-helm-chart-deployment/templates/_helpers.tpl b/linux/sample-helm-chart-deployment/templates/_helpers.tpl index f4b91c0c..1f9f8b63 100644 --- a/linux/sample-helm-chart-deployment/templates/_helpers.tpl +++ b/linux/sample-helm-chart-deployment/templates/_helpers.tpl @@ -1,7 +1,7 @@ {{/* Expand the name of the chart. */}} -{{- define "mssql-latest.name" -}} +{{- define "mssql-server.name" -}} {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} {{- end }} @@ -10,7 +10,7 @@ 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). If release name contains chart name it will be used as a full name. */}} -{{- define "mssql-latest.fullname" -}} +{{- define "mssql-server.fullname" -}} {{- if .Values.fullnameOverride }} {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} {{- else }} @@ -26,16 +26,16 @@ If release name contains chart name it will be used as a full name. {{/* Create chart name and version as used by the chart label. */}} -{{- define "mssql-latest.chart" -}} +{{- define "mssql-server.chart" -}} {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} {{- end }} {{/* Common labels */}} -{{- define "mssql-latest.labels" -}} -helm.sh/chart: {{ include "mssql-latest.chart" . }} -{{ include "mssql-latest.selectorLabels" . }} +{{- define "mssql-server.labels" -}} +helm.sh/chart: {{ include "mssql-server.chart" . }} +{{ include "mssql-server.selectorLabels" . }} {{- if .Chart.AppVersion }} app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} {{- end }} @@ -45,26 +45,25 @@ app.kubernetes.io/managed-by: {{ .Release.Service }} {{/* Selector labels */}} -{{- define "mssql-latest.selectorLabels" -}} -app.kubernetes.io/name: {{ include "mssql-latest.name" . }} +{{- define "mssql-server.selectorLabels" -}} +app.kubernetes.io/name: {{ include "mssql-server.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} {{- end }} {{/* Create the name of the service account to use */}} -{{- define "mssql-latest.serviceAccountName" -}} +{{- define "mssql-server.serviceAccountName" -}} {{- if .Values.serviceAccount.create }} -{{- default (include "mssql-latest.fullname" .) .Values.serviceAccount.name }} +{{- default (include "mssql-server.fullname" .) .Values.serviceAccount.name }} {{- else }} {{- default "default" .Values.serviceAccount.name }} {{- end }} {{- end }} - {{/* Create the name for the SA password secret key. */}} -{{- define "mssql.sapassword" -}} +{{- define "mssql-server.sapassword" -}} sa_password {{- end -}} diff --git a/linux/sample-helm-chart-deployment/templates/deployment.yaml b/linux/sample-helm-chart-deployment/templates/deployment.yaml index 3b79c2a0..d2211db3 100644 --- a/linux/sample-helm-chart-deployment/templates/deployment.yaml +++ b/linux/sample-helm-chart-deployment/templates/deployment.yaml @@ -1,14 +1,14 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: {{ include "mssql-latest.fullname" . }} + name: {{ include "mssql-server.fullname" . }} labels: - {{- include "mssql-latest.labels" . | nindent 4 }} + {{- include "mssql-server.labels" . | nindent 4 }} spec: replicas: {{ .Values.replicas}} selector: matchLabels: - {{- include "mssql-latest.selectorLabels" . | nindent 6 }} + {{- include "mssql-server.selectorLabels" . | nindent 6 }} template: metadata: {{- with .Values.podAnnotations }} @@ -16,7 +16,7 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} labels: - {{- include "mssql-latest.selectorLabels" . | nindent 8 }} + {{- include "mssql-server.selectorLabels" . | nindent 8 }} spec: {{- if .Values.nodeSelector }} nodeSelector: @@ -49,32 +49,32 @@ spec: - name: SA_PASSWORD valueFrom: secretKeyRef: - name: mssql-secret - key: {{ template "mssql.sapassword" . }} + name: {{ include "mssql-server.name" . }}-secret + key: {{ template "mssql-server.sapassword" . }} volumeMounts: - - name: mssqldata + - name: {{ include "mssql-server.name" . }}data-volume mountPath: /var/opt/mssql/db/data - - name: mssqllog + - name: {{ include "mssql-server.name" . }}log-volume mountPath: /var/opt/mssql/db/log - - name: mssqldump + - name: {{ include "mssql-server.name" . }}dump-volume mountPath: /var/opt/mssql/db/dump - - name: mssqlbackup + - name: {{ include "mssql-server.name" . }}backup-volume mountPath: /var/opt/mssql/db/basckup - - name: mssql-config-volume + - name: {{ include "mssql-server.name" . }}-config-volume mountPath: /var/opt/config volumes: - - name: mssqldata + - name: {{ include "mssql-server.name" . }}data-volume persistentVolumeClaim: - claimName: mssql-data - - name: mssqllog + claimName: {{ include "mssql-server.name" . }}-data + - name: {{ include "mssql-server.name" . }}log-volume persistentVolumeClaim: - claimName: mssql-log - - name: mssqldump + claimName: {{ include "mssql-server.name" . }}-log + - name: {{ include "mssql-server.name" . }}dump-volume persistentVolumeClaim: - claimName: mssql-dump - - name: mssqlbackup + claimName: {{ include "mssql-server.name" . }}-dump + - name: {{ include "mssql-server.name" . }}-backup-volume persistentVolumeClaim: - claimName: mssql-backup - - name: mssql-config-volume + claimName: {{ include "mssql-server.name" . }}-backup + - name: {{ include "mssql-server.name" . }}-config-volume configMap: - name: mssql-config + name: {{ include "mssql-server.name" . }}-config diff --git a/linux/sample-helm-chart-deployment/templates/mssqlconfig.yaml b/linux/sample-helm-chart-deployment/templates/mssqlconfig.yaml index 5c72c8ce..5d09d7e7 100644 --- a/linux/sample-helm-chart-deployment/templates/mssqlconfig.yaml +++ b/linux/sample-helm-chart-deployment/templates/mssqlconfig.yaml @@ -1,7 +1,7 @@ kind: ConfigMap apiVersion: v1 metadata: - name: mssql-config + name: {{ include "mssql-server.name" . }}-config data: mssql.conf: | [EULA] diff --git a/linux/sample-helm-chart-deployment/templates/pvc.yaml b/linux/sample-helm-chart-deployment/templates/pvc.yaml index bd337234..2d9e3d78 100644 --- a/linux/sample-helm-chart-deployment/templates/pvc.yaml +++ b/linux/sample-helm-chart-deployment/templates/pvc.yaml @@ -1,7 +1,7 @@ kind: PersistentVolumeClaim apiVersion: v1 metadata: - name: mssql-data + name: {{ include "mssql-server.name" . }}-data annotations: volume.beta.kubernetes.io/storage-class: {{ .Values.pvc.StorageClass | quote }} spec: @@ -14,7 +14,7 @@ spec: kind: PersistentVolumeClaim apiVersion: v1 metadata: - name: mssql-log + name: {{ include "mssql-server.name" . }}-log annotations: volume.beta.kubernetes.io/storage-class: {{ .Values.pvc.StorageClass}} spec: @@ -27,7 +27,7 @@ spec: kind: PersistentVolumeClaim apiVersion: v1 metadata: - name: mssql-dump + name: {{ include "mssql-server.name" . }}-dump annotations: volume.beta.kubernetes.io/storage-class: {{ .Values.pvc.StorageClass}} spec: @@ -40,7 +40,7 @@ spec: kind: PersistentVolumeClaim apiVersion: v1 metadata: - name: mssql-backup + name: {{ include "mssql-server.name" . }}-backup annotations: volume.beta.kubernetes.io/storage-class: {{ .Values.pvc.StorageClass}} spec: diff --git a/linux/sample-helm-chart-deployment/templates/secret.yaml b/linux/sample-helm-chart-deployment/templates/secret.yaml index 71b20a8b..6c8dc35e 100644 --- a/linux/sample-helm-chart-deployment/templates/secret.yaml +++ b/linux/sample-helm-chart-deployment/templates/secret.yaml @@ -1,9 +1,9 @@ apiVersion: v1 kind: Secret metadata: - name: mssql-secret + name: {{ include "mssql-server.name" . }}-secret labels: - {{- include "mssql-latest.labels" . | nindent 4 }} + {{- include "mssql-server.labels" . | nindent 4 }} type: Opaque data: sa_password : {{ .Values.sa_password | b64enc | quote}} \ No newline at end of file diff --git a/linux/sample-helm-chart-deployment/templates/service.yaml b/linux/sample-helm-chart-deployment/templates/service.yaml index 65fb0aac..d3b34e59 100644 --- a/linux/sample-helm-chart-deployment/templates/service.yaml +++ b/linux/sample-helm-chart-deployment/templates/service.yaml @@ -1,9 +1,9 @@ apiVersion: v1 kind: Service metadata: - name: {{ include "mssql-latest.fullname" . }} + name: {{ include "mssql-server.fullname" . }} labels: - {{- include "mssql-latest.labels" . | nindent 4 }} + {{- include "mssql-server.labels" . | nindent 4 }} {{- with .Values.service.annotations }} annotations: {{- toYaml . | nindent 4 }} @@ -15,4 +15,4 @@ spec: targetPort: {{ .Values.service.port }} protocol: TCP selector: - {{- include "mssql-latest.selectorLabels" . | nindent 4 }} \ No newline at end of file + {{- include "mssql-server.selectorLabels" . | nindent 4 }} \ No newline at end of file diff --git a/linux/sample-helm-chart-deployment/values.yaml b/linux/sample-helm-chart-deployment/values.yaml index f6c68e1e..cba01860 100644 --- a/linux/sample-helm-chart-deployment/values.yaml +++ b/linux/sample-helm-chart-deployment/values.yaml @@ -1,4 +1,4 @@ -# Default values for mssql-latest. +# Default values for mssql-server. # This is a YAML-formatted file. # Declare variables to be passed into your templates. From ada69d56dd773a1e276c6276f76750bd3c88d468 Mon Sep 17 00:00:00 2001 From: Tiran Meltser Date: Fri, 8 Apr 2022 18:37:47 +0300 Subject: [PATCH 12/25] Move from fullname to name --- .../templates/deployment.yaml | 16 ++++++++-------- .../templates/service.yaml | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/linux/sample-helm-chart-deployment/templates/deployment.yaml b/linux/sample-helm-chart-deployment/templates/deployment.yaml index d2211db3..82205720 100644 --- a/linux/sample-helm-chart-deployment/templates/deployment.yaml +++ b/linux/sample-helm-chart-deployment/templates/deployment.yaml @@ -1,7 +1,7 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: {{ include "mssql-server.fullname" . }} + name: {{ include "mssql-server.name" . }} labels: {{- include "mssql-server.labels" . | nindent 4 }} spec: @@ -52,24 +52,24 @@ spec: name: {{ include "mssql-server.name" . }}-secret key: {{ template "mssql-server.sapassword" . }} volumeMounts: - - name: {{ include "mssql-server.name" . }}data-volume + - name: {{ include "mssql-server.name" . }}-data-volume mountPath: /var/opt/mssql/db/data - - name: {{ include "mssql-server.name" . }}log-volume + - name: {{ include "mssql-server.name" . }}-log-volume mountPath: /var/opt/mssql/db/log - - name: {{ include "mssql-server.name" . }}dump-volume + - name: {{ include "mssql-server.name" . }}-dump-volume mountPath: /var/opt/mssql/db/dump - - name: {{ include "mssql-server.name" . }}backup-volume + - name: {{ include "mssql-server.name" . }}-backup-volume mountPath: /var/opt/mssql/db/basckup - name: {{ include "mssql-server.name" . }}-config-volume mountPath: /var/opt/config volumes: - - name: {{ include "mssql-server.name" . }}data-volume + - name: {{ include "mssql-server.name" . }}-data-volume persistentVolumeClaim: claimName: {{ include "mssql-server.name" . }}-data - - name: {{ include "mssql-server.name" . }}log-volume + - name: {{ include "mssql-server.name" . }}-log-volume persistentVolumeClaim: claimName: {{ include "mssql-server.name" . }}-log - - name: {{ include "mssql-server.name" . }}dump-volume + - name: {{ include "mssql-server.name" . }}-dump-volume persistentVolumeClaim: claimName: {{ include "mssql-server.name" . }}-dump - name: {{ include "mssql-server.name" . }}-backup-volume diff --git a/linux/sample-helm-chart-deployment/templates/service.yaml b/linux/sample-helm-chart-deployment/templates/service.yaml index d3b34e59..31b00d86 100644 --- a/linux/sample-helm-chart-deployment/templates/service.yaml +++ b/linux/sample-helm-chart-deployment/templates/service.yaml @@ -1,7 +1,7 @@ apiVersion: v1 kind: Service metadata: - name: {{ include "mssql-server.fullname" . }} + name: {{ include "mssql-server.name" . }} labels: {{- include "mssql-server.labels" . | nindent 4 }} {{- with .Values.service.annotations }} From 27be7bd771f634faedcb6e40bf487a5a1bf5bc56 Mon Sep 17 00:00:00 2001 From: tiran-meltser Date: Tue, 17 Jan 2023 14:43:03 +0200 Subject: [PATCH 13/25] Enhance support in statefulset chart --- .../templates/secret.yaml | 9 +++++++++ .../templates/statefulset.yaml | 15 ++++++++++++--- linux/sample-helm-chart-statefulset/values.yaml | 13 ++++++++++++- 3 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 linux/sample-helm-chart-statefulset/templates/secret.yaml diff --git a/linux/sample-helm-chart-statefulset/templates/secret.yaml b/linux/sample-helm-chart-statefulset/templates/secret.yaml new file mode 100644 index 00000000..9502628e --- /dev/null +++ b/linux/sample-helm-chart-statefulset/templates/secret.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "sql-statefull-deploy.name" . }}-secret + labels: + {{- include "sql-statefull-deploy.labels" . | nindent 4 }} +type: Opaque +data: + sa_password : {{ .Values.sa_password | b64enc | quote}} \ No newline at end of file diff --git a/linux/sample-helm-chart-statefulset/templates/statefulset.yaml b/linux/sample-helm-chart-statefulset/templates/statefulset.yaml index 136d5424..7a0756d8 100644 --- a/linux/sample-helm-chart-statefulset/templates/statefulset.yaml +++ b/linux/sample-helm-chart-statefulset/templates/statefulset.yaml @@ -19,6 +19,14 @@ spec: labels: {{- include "sql-statefull-deploy.selectorLabels" . | nindent 8 }} spec: + {{- if .Values.nodeSelector }} + nodeSelector: +{{ toYaml .Values.nodeSelector | indent 8 }} + {{- end }} + {{- if .Values.tolerations }} + tolerations: +{{ toYaml .Values.tolerations | indent 6 }} + {{- end }} securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} containers: @@ -41,7 +49,7 @@ spec: - name: SA_PASSWORD valueFrom: secretKeyRef: - name: mssql + name: {{ include "sql-statefull-deploy.name" . }}-secret key: SA_PASSWORD volumeMounts: - name: mssql @@ -57,7 +65,8 @@ spec: name: mssql spec: accessModes: - - ReadWriteOnce + - {{ .Values.pvc.accessMode }} + storageClassName: {{ .Values.pvc.storageClass }} resources: requests: - storage: 8Gi \ No newline at end of file + storage: {{ .Values.pvc.size }} \ No newline at end of file diff --git a/linux/sample-helm-chart-statefulset/values.yaml b/linux/sample-helm-chart-statefulset/values.yaml index 709ad6cd..da51d9e4 100644 --- a/linux/sample-helm-chart-statefulset/values.yaml +++ b/linux/sample-helm-chart-statefulset/values.yaml @@ -10,6 +10,10 @@ image: # Overrides the image tag whose default is the chart appVersion. tag: "2019-latest" +nodeSelector: {} + +tolerations: [] + ACCEPT_EULA: value: "y" MSSQL_PID: @@ -17,6 +21,8 @@ MSSQL_PID: MSSQL_AGENT_ENABLED: value: "false" +sa_password: "Toughpass1!" + containers: ports: containerPort: 1433 @@ -27,4 +33,9 @@ podSecurityContext: fsGroup: 10001 service: - port: 1433 \ No newline at end of file + port: 1433 + +pvc: + storageClass: "" + accessMode: ReadWriteOnce + size: 8Gi From 0f3e69a23257bd319316858cb28aedea75fb0a2d Mon Sep 17 00:00:00 2001 From: tiran-meltser Date: Tue, 17 Jan 2023 15:02:20 +0200 Subject: [PATCH 14/25] Add enable flag on external services --- linux/sample-helm-chart-statefulset/services/ex_service.yaml | 2 ++ linux/sample-helm-chart-statefulset/values.yaml | 3 +++ 2 files changed, 5 insertions(+) diff --git a/linux/sample-helm-chart-statefulset/services/ex_service.yaml b/linux/sample-helm-chart-statefulset/services/ex_service.yaml index 0aa72219..e8997edf 100644 --- a/linux/sample-helm-chart-statefulset/services/ex_service.yaml +++ b/linux/sample-helm-chart-statefulset/services/ex_service.yaml @@ -1,3 +1,4 @@ +{{- if .Values.externalService.enabled }} apiVersion: v1 kind: Service metadata: @@ -39,3 +40,4 @@ spec: - protocol: TCP port: 1433 targetPort: 1433 +{{- end }} diff --git a/linux/sample-helm-chart-statefulset/values.yaml b/linux/sample-helm-chart-statefulset/values.yaml index da51d9e4..5d2cbbc2 100644 --- a/linux/sample-helm-chart-statefulset/values.yaml +++ b/linux/sample-helm-chart-statefulset/values.yaml @@ -35,6 +35,9 @@ podSecurityContext: service: port: 1433 +externalService: + enabled: true + pvc: storageClass: "" accessMode: ReadWriteOnce From 7f4ab1d0a486cf8441479ab0e60d607665a28f20 Mon Sep 17 00:00:00 2001 From: tiran-meltser Date: Tue, 17 Jan 2023 15:13:43 +0200 Subject: [PATCH 15/25] Update main service definition --- .../services/{Ag_endpoint.yaml => _Ag_endpoint.yaml} | 0 linux/sample-helm-chart-statefulset/templates/service.yaml | 4 ++++ linux/sample-helm-chart-statefulset/values.yaml | 1 + 3 files changed, 5 insertions(+) rename linux/sample-helm-chart-statefulset/services/{Ag_endpoint.yaml => _Ag_endpoint.yaml} (100%) diff --git a/linux/sample-helm-chart-statefulset/services/Ag_endpoint.yaml b/linux/sample-helm-chart-statefulset/services/_Ag_endpoint.yaml similarity index 100% rename from linux/sample-helm-chart-statefulset/services/Ag_endpoint.yaml rename to linux/sample-helm-chart-statefulset/services/_Ag_endpoint.yaml diff --git a/linux/sample-helm-chart-statefulset/templates/service.yaml b/linux/sample-helm-chart-statefulset/templates/service.yaml index 58459151..3e3bc7b3 100644 --- a/linux/sample-helm-chart-statefulset/templates/service.yaml +++ b/linux/sample-helm-chart-statefulset/templates/service.yaml @@ -4,6 +4,10 @@ metadata: name: {{ include "sql-statefull-deploy.fullname" . }} labels: {{- include "sql-statefull-deploy.labels" . | nindent 4 }} + {{- with .Values.service.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} spec: clusterIP: None ports: diff --git a/linux/sample-helm-chart-statefulset/values.yaml b/linux/sample-helm-chart-statefulset/values.yaml index 5d2cbbc2..dbbed97e 100644 --- a/linux/sample-helm-chart-statefulset/values.yaml +++ b/linux/sample-helm-chart-statefulset/values.yaml @@ -34,6 +34,7 @@ podSecurityContext: service: port: 1433 + annotations: {} externalService: enabled: true From 7585aeb055369280e2e8d9eb720f49a8f407343f Mon Sep 17 00:00:00 2001 From: tiran-meltser Date: Tue, 17 Jan 2023 15:21:04 +0200 Subject: [PATCH 16/25] Update key name in secret --- linux/sample-helm-chart-statefulset/templates/secret.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux/sample-helm-chart-statefulset/templates/secret.yaml b/linux/sample-helm-chart-statefulset/templates/secret.yaml index 9502628e..f4c6feea 100644 --- a/linux/sample-helm-chart-statefulset/templates/secret.yaml +++ b/linux/sample-helm-chart-statefulset/templates/secret.yaml @@ -6,4 +6,4 @@ metadata: {{- include "sql-statefull-deploy.labels" . | nindent 4 }} type: Opaque data: - sa_password : {{ .Values.sa_password | b64enc | quote}} \ No newline at end of file + SA_PASSWORD : {{ .Values.sa_password | b64enc | quote}} \ No newline at end of file From fc2d30a4644398e1bb76d30d37527d07ba2e172a Mon Sep 17 00:00:00 2001 From: tiran-meltser Date: Tue, 17 Jan 2023 15:33:58 +0200 Subject: [PATCH 17/25] Add support for name override --- linux/sample-helm-chart-deployment/values.yaml | 3 +++ linux/sample-helm-chart-statefulset/values.yaml | 3 +++ 2 files changed, 6 insertions(+) diff --git a/linux/sample-helm-chart-deployment/values.yaml b/linux/sample-helm-chart-deployment/values.yaml index cba01860..a322a637 100644 --- a/linux/sample-helm-chart-deployment/values.yaml +++ b/linux/sample-helm-chart-deployment/values.yaml @@ -4,6 +4,9 @@ replicas: 1 +nameOverride: '' +fullnameOverride: '' + image: repository: mcr.microsoft.com/mssql/server pullPolicy: IfNotPresent diff --git a/linux/sample-helm-chart-statefulset/values.yaml b/linux/sample-helm-chart-statefulset/values.yaml index dbbed97e..a374b387 100644 --- a/linux/sample-helm-chart-statefulset/values.yaml +++ b/linux/sample-helm-chart-statefulset/values.yaml @@ -4,6 +4,9 @@ replicas: 3 +nameOverride: '' +fullnameOverride: '' + image: repository: mcr.microsoft.com/mssql/server pullPolicy: IfNotPresent From 7af705951cb6156a00e10ee602a92e1d8d996a85 Mon Sep 17 00:00:00 2001 From: tiran-meltser Date: Tue, 17 Jan 2023 16:29:56 +0200 Subject: [PATCH 18/25] Add ability to disable ag_services --- .../services/{_Ag_endpoint.yaml => Ag_endpoint.yaml} | 2 ++ linux/sample-helm-chart-statefulset/services/ex_service.yaml | 2 +- linux/sample-helm-chart-statefulset/values.yaml | 5 ++++- 3 files changed, 7 insertions(+), 2 deletions(-) rename linux/sample-helm-chart-statefulset/services/{_Ag_endpoint.yaml => Ag_endpoint.yaml} (93%) diff --git a/linux/sample-helm-chart-statefulset/services/_Ag_endpoint.yaml b/linux/sample-helm-chart-statefulset/services/Ag_endpoint.yaml similarity index 93% rename from linux/sample-helm-chart-statefulset/services/_Ag_endpoint.yaml rename to linux/sample-helm-chart-statefulset/services/Ag_endpoint.yaml index 26e255d5..db980d06 100644 --- a/linux/sample-helm-chart-statefulset/services/_Ag_endpoint.yaml +++ b/linux/sample-helm-chart-statefulset/services/Ag_endpoint.yaml @@ -1,3 +1,4 @@ +{{- if .Values.ag_service.enabled }} apiVersion: v1 kind: Service metadata: @@ -33,3 +34,4 @@ spec: - protocol: TCP port: 5022 targetPort: 5022 +{{- end }} diff --git a/linux/sample-helm-chart-statefulset/services/ex_service.yaml b/linux/sample-helm-chart-statefulset/services/ex_service.yaml index e8997edf..1400e88b 100644 --- a/linux/sample-helm-chart-statefulset/services/ex_service.yaml +++ b/linux/sample-helm-chart-statefulset/services/ex_service.yaml @@ -1,4 +1,4 @@ -{{- if .Values.externalService.enabled }} +{{- if .Values.ex_service.enabled }} apiVersion: v1 kind: Service metadata: diff --git a/linux/sample-helm-chart-statefulset/values.yaml b/linux/sample-helm-chart-statefulset/values.yaml index a374b387..cecda87a 100644 --- a/linux/sample-helm-chart-statefulset/values.yaml +++ b/linux/sample-helm-chart-statefulset/values.yaml @@ -39,7 +39,10 @@ service: port: 1433 annotations: {} -externalService: +ag_service: + enabled: true + +ex_service: enabled: true pvc: From 37dae07a2f9172e8d19568c14a4c5e5e1072daa8 Mon Sep 17 00:00:00 2001 From: tiran-meltser Date: Tue, 17 Jan 2023 17:29:29 +0200 Subject: [PATCH 19/25] Add support for dynamic mount paths --- .../templates/deployment.yaml | 8 ++++---- .../templates/mssqlconfig.yaml | 8 ++++---- linux/sample-helm-chart-deployment/values.yaml | 6 ++++-- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/linux/sample-helm-chart-deployment/templates/deployment.yaml b/linux/sample-helm-chart-deployment/templates/deployment.yaml index 82205720..5634e83c 100644 --- a/linux/sample-helm-chart-deployment/templates/deployment.yaml +++ b/linux/sample-helm-chart-deployment/templates/deployment.yaml @@ -53,13 +53,13 @@ spec: key: {{ template "mssql-server.sapassword" . }} volumeMounts: - name: {{ include "mssql-server.name" . }}-data-volume - mountPath: /var/opt/mssql/db/data + mountPath: {{ .Values.pvc.dataMountPath }} - name: {{ include "mssql-server.name" . }}-log-volume - mountPath: /var/opt/mssql/db/log + mountPath: {{ .Values.pvc.logMountPath }} - name: {{ include "mssql-server.name" . }}-dump-volume - mountPath: /var/opt/mssql/db/dump + mountPath: {{ .Values.pvc.dumpMountPath }} - name: {{ include "mssql-server.name" . }}-backup-volume - mountPath: /var/opt/mssql/db/basckup + mountPath: {{ .Values.pvc.backupMountPath }} - name: {{ include "mssql-server.name" . }}-config-volume mountPath: /var/opt/config volumes: diff --git a/linux/sample-helm-chart-deployment/templates/mssqlconfig.yaml b/linux/sample-helm-chart-deployment/templates/mssqlconfig.yaml index 5d09d7e7..267929c8 100644 --- a/linux/sample-helm-chart-deployment/templates/mssqlconfig.yaml +++ b/linux/sample-helm-chart-deployment/templates/mssqlconfig.yaml @@ -19,7 +19,7 @@ data: lcid = 1033 [filelocation] - defaultdatadir = /var/opt/mssql/db/data - defaultlogdir = /var/opt/mssql/db/log - defaultdumpdir = /var/opt/mssql/db/dump - defaultbackupdir = /var/opt/mssql/db/backup +{{- printf "defaultdatadir = %s" {{ .Values.pvc.dataMountPath }} | nindent 4 -}} +{{- printf "defaultlogdir = %s" {{ .Values.pvc.logMountPath }} | nindent 4 -}} +{{- printf "defaultdumpdir = %s" {{ .Values.pvc.dumpMountPath }} | nindent 4 -}} +{{- printf "defaultbackupdir = %s" {{ .Values.pvc.backupMountPath }} | nindent 4 -}} diff --git a/linux/sample-helm-chart-deployment/values.yaml b/linux/sample-helm-chart-deployment/values.yaml index a322a637..925e20f6 100644 --- a/linux/sample-helm-chart-deployment/values.yaml +++ b/linux/sample-helm-chart-deployment/values.yaml @@ -43,11 +43,13 @@ pvc: StorageClass: "" dataaccessMode: ReadWriteOnce datasize: 5Gi + dataMountPath: /var/opt/mssql/db/data logaccessMode: ReadWriteOnce logsize: 5Gi + logMountPath: /var/opt/mssql/db/log dumpaccessMode: ReadWriteOnce dumpsize: 2Gi + dumpMountPath: /var/opt/mssql/db/dump backupaccessMode: ReadWriteOnce backupsize: 2Gi - - + backupMountPath: /var/opt/mssql/db/backup From c8ecb8399accd6dee467d5a274170f2b8f90ad0d Mon Sep 17 00:00:00 2001 From: tiran-meltser Date: Tue, 17 Jan 2023 17:40:57 +0200 Subject: [PATCH 20/25] Fix a bug --- .../templates/mssqlconfig.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/linux/sample-helm-chart-deployment/templates/mssqlconfig.yaml b/linux/sample-helm-chart-deployment/templates/mssqlconfig.yaml index 267929c8..0c1cafad 100644 --- a/linux/sample-helm-chart-deployment/templates/mssqlconfig.yaml +++ b/linux/sample-helm-chart-deployment/templates/mssqlconfig.yaml @@ -19,7 +19,7 @@ data: lcid = 1033 [filelocation] -{{- printf "defaultdatadir = %s" {{ .Values.pvc.dataMountPath }} | nindent 4 -}} -{{- printf "defaultlogdir = %s" {{ .Values.pvc.logMountPath }} | nindent 4 -}} -{{- printf "defaultdumpdir = %s" {{ .Values.pvc.dumpMountPath }} | nindent 4 -}} -{{- printf "defaultbackupdir = %s" {{ .Values.pvc.backupMountPath }} | nindent 4 -}} +{{- printf "defaultdatadir = %s" .Values.pvc.dataMountPath | nindent 4 -}} +{{- printf "defaultlogdir = %s" .Values.pvc.logMountPath | nindent 4 -}} +{{- printf "defaultdumpdir = %s" .Values.pvc.dumpMountPath | nindent 4 -}} +{{- printf "defaultbackupdir = %s" .Values.pvc.backupMountPath | nindent 4 -}} From d00b70f93e8ec0cfa7b4e80ac858b3a48fc52531 Mon Sep 17 00:00:00 2001 From: tiran-meltser Date: Tue, 17 Jan 2023 21:22:10 +0200 Subject: [PATCH 21/25] Discard a wrong setting!!! --- .../templates/deployment.yaml | 7 ++--- .../templates/mssqlconfig.yaml | 3 ++- .../templates/pvc.yaml | 27 ++++++++++--------- .../sample-helm-chart-deployment/values.yaml | 26 +++++++++--------- 4 files changed, 33 insertions(+), 30 deletions(-) diff --git a/linux/sample-helm-chart-deployment/templates/deployment.yaml b/linux/sample-helm-chart-deployment/templates/deployment.yaml index 5634e83c..78431775 100644 --- a/linux/sample-helm-chart-deployment/templates/deployment.yaml +++ b/linux/sample-helm-chart-deployment/templates/deployment.yaml @@ -54,19 +54,19 @@ spec: volumeMounts: - name: {{ include "mssql-server.name" . }}-data-volume mountPath: {{ .Values.pvc.dataMountPath }} - - name: {{ include "mssql-server.name" . }}-log-volume +{{/* - name: {{ include "mssql-server.name" . }}-log-volume mountPath: {{ .Values.pvc.logMountPath }} - name: {{ include "mssql-server.name" . }}-dump-volume mountPath: {{ .Values.pvc.dumpMountPath }} - name: {{ include "mssql-server.name" . }}-backup-volume mountPath: {{ .Values.pvc.backupMountPath }} - name: {{ include "mssql-server.name" . }}-config-volume - mountPath: /var/opt/config + mountPath: /var/opt/config */}} volumes: - name: {{ include "mssql-server.name" . }}-data-volume persistentVolumeClaim: claimName: {{ include "mssql-server.name" . }}-data - - name: {{ include "mssql-server.name" . }}-log-volume +{{/* - name: {{ include "mssql-server.name" . }}-log-volume persistentVolumeClaim: claimName: {{ include "mssql-server.name" . }}-log - name: {{ include "mssql-server.name" . }}-dump-volume @@ -78,3 +78,4 @@ spec: - name: {{ include "mssql-server.name" . }}-config-volume configMap: name: {{ include "mssql-server.name" . }}-config +*/}} \ No newline at end of file diff --git a/linux/sample-helm-chart-deployment/templates/mssqlconfig.yaml b/linux/sample-helm-chart-deployment/templates/mssqlconfig.yaml index 0c1cafad..dd60e7b8 100644 --- a/linux/sample-helm-chart-deployment/templates/mssqlconfig.yaml +++ b/linux/sample-helm-chart-deployment/templates/mssqlconfig.yaml @@ -17,9 +17,10 @@ data: [language] lcid = 1033 - +{{/* [filelocation] {{- printf "defaultdatadir = %s" .Values.pvc.dataMountPath | nindent 4 -}} {{- printf "defaultlogdir = %s" .Values.pvc.logMountPath | nindent 4 -}} {{- printf "defaultdumpdir = %s" .Values.pvc.dumpMountPath | nindent 4 -}} {{- printf "defaultbackupdir = %s" .Values.pvc.backupMountPath | nindent 4 -}} +*/}} \ No newline at end of file diff --git a/linux/sample-helm-chart-deployment/templates/pvc.yaml b/linux/sample-helm-chart-deployment/templates/pvc.yaml index 2d9e3d78..509c5fb5 100644 --- a/linux/sample-helm-chart-deployment/templates/pvc.yaml +++ b/linux/sample-helm-chart-deployment/templates/pvc.yaml @@ -3,49 +3,50 @@ apiVersion: v1 metadata: name: {{ include "mssql-server.name" . }}-data annotations: - volume.beta.kubernetes.io/storage-class: {{ .Values.pvc.StorageClass | quote }} + volume.beta.kubernetes.io/storage-class: {{ .Values.pvc.storageClass | quote }} spec: accessModes: - - {{ .Values.pvc.dataaccessMode | quote}} + - {{ .Values.pvc.dataAccessMode | quote}} resources: requests: - storage: {{ .Values.pvc.datasize}} ---- + storage: {{ .Values.pvc.dataSize}} +{{/*--- kind: PersistentVolumeClaim apiVersion: v1 metadata: name: {{ include "mssql-server.name" . }}-log annotations: - volume.beta.kubernetes.io/storage-class: {{ .Values.pvc.StorageClass}} + volume.beta.kubernetes.io/storage-class: {{ .Values.pvc.storageClass}} spec: accessModes: - - {{ .Values.pvc.logaccessMode | quote}} + - {{ .Values.pvc.logAccessMode | quote}} resources: requests: - storage: {{ .Values.pvc.logsize}} + storage: {{ .Values.pvc.logSize}} --- kind: PersistentVolumeClaim apiVersion: v1 metadata: name: {{ include "mssql-server.name" . }}-dump annotations: - volume.beta.kubernetes.io/storage-class: {{ .Values.pvc.StorageClass}} + volume.beta.kubernetes.io/storage-class: {{ .Values.pvc.storageClass}} spec: accessModes: - - {{ .Values.pvc.dumpaccessMode | quote}} + - {{ .Values.pvc.dumpAccessMode | quote}} resources: requests: - storage: {{ .Values.pvc.dumpsize}} + storage: {{ .Values.pvc.dumpSize}} --- kind: PersistentVolumeClaim apiVersion: v1 metadata: name: {{ include "mssql-server.name" . }}-backup annotations: - volume.beta.kubernetes.io/storage-class: {{ .Values.pvc.StorageClass}} + volume.beta.kubernetes.io/storage-class: {{ .Values.pvc.storageClass}} spec: accessModes: - - {{ .Values.pvc.backupaccessMode | quote}} + - {{ .Values.pvc.backupAccessMode | quote}} resources: requests: - storage: {{ .Values.pvc.backupsize}} + storage: {{ .Values.pvc.backupSize}} +*/}} \ No newline at end of file diff --git a/linux/sample-helm-chart-deployment/values.yaml b/linux/sample-helm-chart-deployment/values.yaml index 925e20f6..c03564a3 100644 --- a/linux/sample-helm-chart-deployment/values.yaml +++ b/linux/sample-helm-chart-deployment/values.yaml @@ -40,16 +40,16 @@ service: annotations: {} pvc: - StorageClass: "" - dataaccessMode: ReadWriteOnce - datasize: 5Gi - dataMountPath: /var/opt/mssql/db/data - logaccessMode: ReadWriteOnce - logsize: 5Gi - logMountPath: /var/opt/mssql/db/log - dumpaccessMode: ReadWriteOnce - dumpsize: 2Gi - dumpMountPath: /var/opt/mssql/db/dump - backupaccessMode: ReadWriteOnce - backupsize: 2Gi - backupMountPath: /var/opt/mssql/db/backup + storageClass: "" + dataAccessMode: ReadWriteOnce + dataSize: 5Gi +# dataMountPath: /var/opt/mssql/db/data +# logAccessMode: ReadWriteOnce +# logSize: 5Gi +# logMountPath: /var/opt/mssql/db/log +# dumpAccessMode: ReadWriteOnce +# dumpSize: 2Gi +# dumpMountPath: /var/opt/mssql/db/dump +# backupAccessMode: ReadWriteOnce +# backupSize: 2Gi +# backupMountPath: /var/opt/mssql/db/backup From fa72772babe2a64e71e3b65f52bef5b8aaf98c79 Mon Sep 17 00:00:00 2001 From: tiran-meltser Date: Tue, 17 Jan 2023 21:27:14 +0200 Subject: [PATCH 22/25] Fix a bug --- linux/sample-helm-chart-deployment/templates/deployment.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/linux/sample-helm-chart-deployment/templates/deployment.yaml b/linux/sample-helm-chart-deployment/templates/deployment.yaml index 78431775..369496d8 100644 --- a/linux/sample-helm-chart-deployment/templates/deployment.yaml +++ b/linux/sample-helm-chart-deployment/templates/deployment.yaml @@ -53,8 +53,9 @@ spec: key: {{ template "mssql-server.sapassword" . }} volumeMounts: - name: {{ include "mssql-server.name" . }}-data-volume - mountPath: {{ .Values.pvc.dataMountPath }} -{{/* - name: {{ include "mssql-server.name" . }}-log-volume + mountPath: "/var/opt/mssql" +{{/* mountPath: {{ .Values.pvc.dataMountPath }} + - name: {{ include "mssql-server.name" . }}-log-volume mountPath: {{ .Values.pvc.logMountPath }} - name: {{ include "mssql-server.name" . }}-dump-volume mountPath: {{ .Values.pvc.dumpMountPath }} From 214a09839fd3d300592171f0cc419798a8f8ef91 Mon Sep 17 00:00:00 2001 From: tiran-meltser Date: Tue, 17 Jan 2023 21:36:35 +0200 Subject: [PATCH 23/25] Fix a bug --- linux/sample-helm-chart-deployment/templates/deployment.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/linux/sample-helm-chart-deployment/templates/deployment.yaml b/linux/sample-helm-chart-deployment/templates/deployment.yaml index 369496d8..a412fc5b 100644 --- a/linux/sample-helm-chart-deployment/templates/deployment.yaml +++ b/linux/sample-helm-chart-deployment/templates/deployment.yaml @@ -60,9 +60,9 @@ spec: - name: {{ include "mssql-server.name" . }}-dump-volume mountPath: {{ .Values.pvc.dumpMountPath }} - name: {{ include "mssql-server.name" . }}-backup-volume - mountPath: {{ .Values.pvc.backupMountPath }} + mountPath: {{ .Values.pvc.backupMountPath }} */}} - name: {{ include "mssql-server.name" . }}-config-volume - mountPath: /var/opt/config */}} + mountPath: /var/opt/config volumes: - name: {{ include "mssql-server.name" . }}-data-volume persistentVolumeClaim: From c4ab4217d0ec7add12181ac6f5aa70780d40e894 Mon Sep 17 00:00:00 2001 From: tiran-meltser Date: Tue, 17 Jan 2023 21:41:32 +0200 Subject: [PATCH 24/25] Fix a bug --- .../sample-helm-chart-deployment/templates/deployment.yaml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/linux/sample-helm-chart-deployment/templates/deployment.yaml b/linux/sample-helm-chart-deployment/templates/deployment.yaml index a412fc5b..9eac2dfb 100644 --- a/linux/sample-helm-chart-deployment/templates/deployment.yaml +++ b/linux/sample-helm-chart-deployment/templates/deployment.yaml @@ -67,7 +67,7 @@ spec: - name: {{ include "mssql-server.name" . }}-data-volume persistentVolumeClaim: claimName: {{ include "mssql-server.name" . }}-data -{{/* - name: {{ include "mssql-server.name" . }}-log-volume +{{/* - name: {{ include "mssql-server.name" . }}-log-volume persistentVolumeClaim: claimName: {{ include "mssql-server.name" . }}-log - name: {{ include "mssql-server.name" . }}-dump-volume @@ -75,8 +75,7 @@ spec: claimName: {{ include "mssql-server.name" . }}-dump - name: {{ include "mssql-server.name" . }}-backup-volume persistentVolumeClaim: - claimName: {{ include "mssql-server.name" . }}-backup + claimName: {{ include "mssql-server.name" . }}-backup */}} - name: {{ include "mssql-server.name" . }}-config-volume configMap: - name: {{ include "mssql-server.name" . }}-config -*/}} \ No newline at end of file + name: {{ include "mssql-server.name" . }}-config \ No newline at end of file From 17749862470e9f0b225c08317dab7482bd8f68ca Mon Sep 17 00:00:00 2001 From: tiran-meltser Date: Fri, 27 Jan 2023 17:41:13 +0200 Subject: [PATCH 25/25] Move to storageClassName (instead of annotation) --- .../templates/pvc.yaml | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/linux/sample-helm-chart-deployment/templates/pvc.yaml b/linux/sample-helm-chart-deployment/templates/pvc.yaml index 509c5fb5..f10b0a59 100644 --- a/linux/sample-helm-chart-deployment/templates/pvc.yaml +++ b/linux/sample-helm-chart-deployment/templates/pvc.yaml @@ -2,9 +2,10 @@ kind: PersistentVolumeClaim apiVersion: v1 metadata: name: {{ include "mssql-server.name" . }}-data - annotations: - volume.beta.kubernetes.io/storage-class: {{ .Values.pvc.storageClass | quote }} +# annotations: +# volume.beta.kubernetes.io/storage-class: {{ .Values.pvc.storageClass | quote }} spec: + storageClassName: {{ .Values.pvc.storageClass | quote }} accessModes: - {{ .Values.pvc.dataAccessMode | quote}} resources: @@ -15,9 +16,10 @@ kind: PersistentVolumeClaim apiVersion: v1 metadata: name: {{ include "mssql-server.name" . }}-log - annotations: - volume.beta.kubernetes.io/storage-class: {{ .Values.pvc.storageClass}} +# annotations: +# volume.beta.kubernetes.io/storage-class: {{ .Values.pvc.storageClass}} spec: + storageClassName: {{ .Values.pvc.storageClass | quote }} accessModes: - {{ .Values.pvc.logAccessMode | quote}} resources: @@ -28,9 +30,10 @@ kind: PersistentVolumeClaim apiVersion: v1 metadata: name: {{ include "mssql-server.name" . }}-dump - annotations: - volume.beta.kubernetes.io/storage-class: {{ .Values.pvc.storageClass}} +# annotations: +# volume.beta.kubernetes.io/storage-class: {{ .Values.pvc.storageClass}} spec: + storageClassName: {{ .Values.pvc.storageClass | quote }} accessModes: - {{ .Values.pvc.dumpAccessMode | quote}} resources: @@ -41,9 +44,10 @@ kind: PersistentVolumeClaim apiVersion: v1 metadata: name: {{ include "mssql-server.name" . }}-backup - annotations: - volume.beta.kubernetes.io/storage-class: {{ .Values.pvc.storageClass}} +# annotations: +# volume.beta.kubernetes.io/storage-class: {{ .Values.pvc.storageClass}} spec: + storageClassName: {{ .Values.pvc.storageClass | quote }} accessModes: - {{ .Values.pvc.backupAccessMode | quote}} resources: