From fd2d3602d48553fb90ab8fdc6b459b192abe39fb Mon Sep 17 00:00:00 2001 From: Nilesh Gule Date: Thu, 16 May 2019 22:05:45 +0800 Subject: [PATCH 1/8] Upgraded SQL Server images to CTP 2.2 --- .../Kubernetes/sample-manifest-files/operator.yaml | 2 +- .../Kubernetes/sample-manifest-files/sqlserver.yaml | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/samples/features/high availability/Kubernetes/sample-manifest-files/operator.yaml b/samples/features/high availability/Kubernetes/sample-manifest-files/operator.yaml index e7268fbf6f..92f66effa2 100644 --- a/samples/features/high availability/Kubernetes/sample-manifest-files/operator.yaml +++ b/samples/features/high availability/Kubernetes/sample-manifest-files/operator.yaml @@ -63,6 +63,6 @@ spec: - name: MSSQL_K8S_NAMESPACE valueFrom: fieldRef: {fieldPath: metadata.namespace} - image: mcr.microsoft.com/mssql/ha:2019-CTP2.1-ubuntu + image: mcr.microsoft.com/mssql/ha:2019-CTP2.2-ubuntu name: mssql-operator serviceAccount: mssql-operator diff --git a/samples/features/high availability/Kubernetes/sample-manifest-files/sqlserver.yaml b/samples/features/high availability/Kubernetes/sample-manifest-files/sqlserver.yaml index 9e3a1f6544..cfae869278 100644 --- a/samples/features/high availability/Kubernetes/sample-manifest-files/sqlserver.yaml +++ b/samples/features/high availability/Kubernetes/sample-manifest-files/sqlserver.yaml @@ -6,7 +6,7 @@ metadata: namespace: ag1 spec: acceptEula: true - agentsContainerImage: mcr.microsoft.com/mssql/ha:2019-CTP2.1-ubuntu + agentsContainerImage: mcr.microsoft.com/mssql/ha:2019-CTP2.2-ubuntu availabilityGroups: [ag1] instanceRootVolumeClaimTemplate: accessModes: [ReadWriteOnce] @@ -15,7 +15,7 @@ spec: storageClass: default saPassword: secretKeyRef: {key: sapassword, name: sql-secrets} - sqlServerContainer: {image: 'mcr.microsoft.com/mssql/server:2019-CTP2.1-ubuntu'} + sqlServerContainer: {image: 'mcr.microsoft.com/mssql/server:2019-CTP2.2-ubuntu'} --- apiVersion: v1 kind: Service @@ -34,7 +34,7 @@ metadata: namespace: ag1 spec: acceptEula: true - agentsContainerImage: mcr.microsoft.com/mssql/ha:2019-CTP2.1-ubuntu + agentsContainerImage: mcr.microsoft.com/mssql/ha:2019-CTP2.2-ubuntu availabilityGroups: [ag1] instanceRootVolumeClaimTemplate: accessModes: [ReadWriteOnce] @@ -43,7 +43,7 @@ spec: storageClass: default saPassword: secretKeyRef: {key: sapassword, name: sql-secrets} - sqlServerContainer: {image: 'mcr.microsoft.com/mssql/server:2019-CTP2.1-ubuntu'} + sqlServerContainer: {image: 'mcr.microsoft.com/mssql/server:2019-CTP2.2-ubuntu'} --- apiVersion: v1 kind: Service @@ -62,7 +62,7 @@ metadata: namespace: ag1 spec: acceptEula: true - agentsContainerImage: mcr.microsoft.com/mssql/ha:2019-CTP2.1-ubuntu + agentsContainerImage: mcr.microsoft.com/mssql/ha:2019-CTP2.2-ubuntu availabilityGroups: [ag1] instanceRootVolumeClaimTemplate: accessModes: [ReadWriteOnce] @@ -71,7 +71,7 @@ spec: storageClass: default saPassword: secretKeyRef: {key: sapassword, name: sql-secrets} - sqlServerContainer: {image: 'mcr.microsoft.com/mssql/server:2019-CTP2.1-ubuntu'} + sqlServerContainer: {image: 'mcr.microsoft.com/mssql/server:2019-CTP2.2-ubuntu'} --- apiVersion: v1 kind: Service From 20e98cdf21509af8a60bd0be0a501534291c10c9 Mon Sep 17 00:00:00 2001 From: Nilesh Gule Date: Thu, 16 May 2019 22:18:37 +0800 Subject: [PATCH 2/8] Upgraded the image tag to CTP 2.2 --- .../Kubernetes/sample-deployment-script/deploy-ag.py | 2 +- .../sample-deployment-script/templates/sqlserver.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/features/high availability/Kubernetes/sample-deployment-script/deploy-ag.py b/samples/features/high availability/Kubernetes/sample-deployment-script/deploy-ag.py index 2e9c337e09..0076307d9a 100644 --- a/samples/features/high availability/Kubernetes/sample-deployment-script/deploy-ag.py +++ b/samples/features/high availability/Kubernetes/sample-deployment-script/deploy-ag.py @@ -18,7 +18,7 @@ SqlServerYaml, AgServiceYaml, FailoverYaml) DEFAULT_K8S_AGENTS_IMAGE = ( - "mcr.microsoft.com/mssql/ha:2019-CTP2.1-ubuntu") + "mcr.microsoft.com/mssql/ha:2019-CTP2.2-ubuntu") diff --git a/samples/features/high availability/Kubernetes/sample-deployment-script/templates/sqlserver.yaml b/samples/features/high availability/Kubernetes/sample-deployment-script/templates/sqlserver.yaml index aa69033fb8..1e250aafd7 100644 --- a/samples/features/high availability/Kubernetes/sample-deployment-script/templates/sqlserver.yaml +++ b/samples/features/high availability/Kubernetes/sample-deployment-script/templates/sqlserver.yaml @@ -10,7 +10,7 @@ metadata: spec: sqlServerContainer: - image: mcr.microsoft.com/mssql/server:2019-CTP2.1-ubuntu + image: mcr.microsoft.com/mssql/server:2019-CTP2.2-ubuntu saPassword: secretKeyRef: From c7b05a66d33f45898f58f2a5933dc66c9bce267d Mon Sep 17 00:00:00 2001 From: Nilesh Gule Date: Thu, 16 May 2019 22:31:08 +0800 Subject: [PATCH 3/8] Added codealike file to gitignore --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 1d12d79395..668c0f1598 100644 --- a/.gitignore +++ b/.gitignore @@ -188,6 +188,9 @@ AppPackages/ # but keep track of directories ending in .cache !*.[Cc]ache/ +# codealike API key files +codealike.json + # Others ClientBin/ [Ss]tyle[Cc]op.* From 2041de59270502158dc487b64d35ac62e351ceed Mon Sep 17 00:00:00 2001 From: Nilesh Gule Date: Mon, 20 May 2019 11:12:45 +0800 Subject: [PATCH 4/8] Added codealike to gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 668c0f1598..0c4d04eb14 100644 --- a/.gitignore +++ b/.gitignore @@ -443,3 +443,5 @@ samples/databases/wide-world-importers/workload-drivers/order-insert/Multithread *.pem *.p12 +codealike.json + From b7867acb294b1593da9b1719b8af673b1162db28 Mon Sep 17 00:00:00 2001 From: Nilesh Gule Date: Mon, 20 May 2019 11:30:32 +0800 Subject: [PATCH 5/8] Initial version of automated powershell script --- .../deploy-ag.ps1 | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 samples/features/high availability/Kubernetes/sample-deployment-powershell-script/deploy-ag.ps1 diff --git a/samples/features/high availability/Kubernetes/sample-deployment-powershell-script/deploy-ag.ps1 b/samples/features/high availability/Kubernetes/sample-deployment-powershell-script/deploy-ag.ps1 new file mode 100644 index 0000000000..4cd85926bf --- /dev/null +++ b/samples/features/high availability/Kubernetes/sample-deployment-powershell-script/deploy-ag.ps1 @@ -0,0 +1,42 @@ +Param( + [parameter(Mandatory=$false)] + [string]$NamespaceName="ag1" +) + +Write-Host "Creating namespace" -ForegroundColor Yellow +kubectl apply --filename 00_AKS_Namespace.yml +Write-Host "Namespace $NamespaceName created successfully" -ForegroundColor Cyan + +Write-Host "Deploying SQL Server Operator" -ForegroundColor Yellow + +kubectl apply ` +--filename 00_operator.yml ` +--namespace $NamespaceName + +Write-Host "SQL Server Operator deployed successfully" -ForegroundColor Cyan + +Write-Host "Creating SA password and master key password" -ForegroundColor Yellow + +kubectl create ` +secret generic sql-secrets ` +--from-literal=sapassword="P@ssw0rd!" ` +--from-literal=masterkeypassword="P@ssw0rd!" ` +--namespace $NamespaceName + +Write-Host "Created SA password and master key password successfully" -ForegroundColor Yellow + +Write-Host "Deploying SQL Server custom resource" -ForegroundColor Yellow + +kubectl apply ` +--filename 04_sqlserver.yml ` +--namespace $NamespaceName + +Write-Host "SQL Server custom resource deployed successfully" -ForegroundColor Cyan + +Write-Host "Deploying SQL Server Availability Group" -ForegroundColor Yellow + +kubectl apply ` +--filename 05-agservices.yml ` +--namespace $NamespaceName + +Write-Host "SQL Server Availability Group deployed successfully" -ForegroundColor Cyan \ No newline at end of file From 2e3231cb5656b0086f5bb832f404dab7878eff0c Mon Sep 17 00:00:00 2001 From: Nilesh Gule Date: Mon, 20 May 2019 12:48:09 +0800 Subject: [PATCH 6/8] made the powershell script dynamic, updated CTP2.2 --- .../deploy-ag.ps1 | 13 +++++++++---- .../sample-manifest-files/rotate-creds.yaml | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/samples/features/high availability/Kubernetes/sample-deployment-powershell-script/deploy-ag.ps1 b/samples/features/high availability/Kubernetes/sample-deployment-powershell-script/deploy-ag.ps1 index 4cd85926bf..6a7a0f307c 100644 --- a/samples/features/high availability/Kubernetes/sample-deployment-powershell-script/deploy-ag.ps1 +++ b/samples/features/high availability/Kubernetes/sample-deployment-powershell-script/deploy-ag.ps1 @@ -3,14 +3,19 @@ Param( [string]$NamespaceName="ag1" ) +$currentWorkingDirectory = (Get-Location).Path | Split-Path -Parent +$manifestRootDirectory = Join-Path $currentWorkingDirectory "k8s/AKS" + +Set-Location $manifestRootDirectory + Write-Host "Creating namespace" -ForegroundColor Yellow -kubectl apply --filename 00_AKS_Namespace.yml +kubectl create namespace $NamespaceName Write-Host "Namespace $NamespaceName created successfully" -ForegroundColor Cyan Write-Host "Deploying SQL Server Operator" -ForegroundColor Yellow kubectl apply ` ---filename 00_operator.yml ` +--filename operator.yml ` --namespace $NamespaceName Write-Host "SQL Server Operator deployed successfully" -ForegroundColor Cyan @@ -28,7 +33,7 @@ Write-Host "Created SA password and master key password successfully" -Foregroun Write-Host "Deploying SQL Server custom resource" -ForegroundColor Yellow kubectl apply ` ---filename 04_sqlserver.yml ` +--filename sqlserver.yml ` --namespace $NamespaceName Write-Host "SQL Server custom resource deployed successfully" -ForegroundColor Cyan @@ -36,7 +41,7 @@ Write-Host "SQL Server custom resource deployed successfully" -ForegroundColor C Write-Host "Deploying SQL Server Availability Group" -ForegroundColor Yellow kubectl apply ` ---filename 05-agservices.yml ` +--filename agservices.yml ` --namespace $NamespaceName Write-Host "SQL Server Availability Group deployed successfully" -ForegroundColor Cyan \ No newline at end of file diff --git a/samples/features/high availability/Kubernetes/sample-manifest-files/rotate-creds.yaml b/samples/features/high availability/Kubernetes/sample-manifest-files/rotate-creds.yaml index 046c5a549f..f976efc1bd 100644 --- a/samples/features/high availability/Kubernetes/sample-manifest-files/rotate-creds.yaml +++ b/samples/features/high availability/Kubernetes/sample-manifest-files/rotate-creds.yaml @@ -64,7 +64,7 @@ spec: restartPolicy: Never containers: - name: rotate-creds - image: mcr.microsoft.com/mssql/ha:2019-CTP2.1-ubuntu + image: mcr.microsoft.com/mssql/ha:2019-CTP2.2-ubuntu command: ["/mssql-server-k8s-rotate-creds"] env: - name: MSSQL_K8S_SQL_SERVER_NAME From 921a24c5a7633f0a0e2b0497d269da666aac2db5 Mon Sep 17 00:00:00 2001 From: Nilesh Gule Date: Mon, 20 May 2019 13:10:59 +0800 Subject: [PATCH 7/8] corrected typos --- .../sample-deployment-powershell-script/deploy-ag.ps1 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/samples/features/high availability/Kubernetes/sample-deployment-powershell-script/deploy-ag.ps1 b/samples/features/high availability/Kubernetes/sample-deployment-powershell-script/deploy-ag.ps1 index 6a7a0f307c..b01a458e26 100644 --- a/samples/features/high availability/Kubernetes/sample-deployment-powershell-script/deploy-ag.ps1 +++ b/samples/features/high availability/Kubernetes/sample-deployment-powershell-script/deploy-ag.ps1 @@ -4,7 +4,7 @@ Param( ) $currentWorkingDirectory = (Get-Location).Path | Split-Path -Parent -$manifestRootDirectory = Join-Path $currentWorkingDirectory "k8s/AKS" +$manifestRootDirectory = Join-Path $currentWorkingDirectory "sample-manifest-files" Set-Location $manifestRootDirectory @@ -15,7 +15,7 @@ Write-Host "Namespace $NamespaceName created successfully" -ForegroundColor Cyan Write-Host "Deploying SQL Server Operator" -ForegroundColor Yellow kubectl apply ` ---filename operator.yml ` +--filename operator.yaml ` --namespace $NamespaceName Write-Host "SQL Server Operator deployed successfully" -ForegroundColor Cyan @@ -33,7 +33,7 @@ Write-Host "Created SA password and master key password successfully" -Foregroun Write-Host "Deploying SQL Server custom resource" -ForegroundColor Yellow kubectl apply ` ---filename sqlserver.yml ` +--filename sqlserver.yaml ` --namespace $NamespaceName Write-Host "SQL Server custom resource deployed successfully" -ForegroundColor Cyan @@ -41,7 +41,7 @@ Write-Host "SQL Server custom resource deployed successfully" -ForegroundColor C Write-Host "Deploying SQL Server Availability Group" -ForegroundColor Yellow kubectl apply ` ---filename agservices.yml ` +--filename ag-services.yaml ` --namespace $NamespaceName Write-Host "SQL Server Availability Group deployed successfully" -ForegroundColor Cyan \ No newline at end of file From 0190a30d68b421dcf7d854a04ea04ba913ae10b1 Mon Sep 17 00:00:00 2001 From: Nilesh Gule Date: Mon, 20 May 2019 13:18:12 +0800 Subject: [PATCH 8/8] Resett he working directory back to powershell --- .../sample-deployment-powershell-script/deploy-ag.ps1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/samples/features/high availability/Kubernetes/sample-deployment-powershell-script/deploy-ag.ps1 b/samples/features/high availability/Kubernetes/sample-deployment-powershell-script/deploy-ag.ps1 index b01a458e26..70b89a8f21 100644 --- a/samples/features/high availability/Kubernetes/sample-deployment-powershell-script/deploy-ag.ps1 +++ b/samples/features/high availability/Kubernetes/sample-deployment-powershell-script/deploy-ag.ps1 @@ -44,4 +44,6 @@ kubectl apply ` --filename ag-services.yaml ` --namespace $NamespaceName -Write-Host "SQL Server Availability Group deployed successfully" -ForegroundColor Cyan \ No newline at end of file +Write-Host "SQL Server Availability Group deployed successfully" -ForegroundColor Cyan + +Set-Location $currentWorkingDirectory \ No newline at end of file