Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arcbox 3.0 - Update k3s cluster name #2660

Merged
merged 5 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions azure_jumpstart_arcbox/artifacts/DataOpsLogonScript.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ $aksArcClusterName = ($Env:aksArcClusterName).toLower()
$aksdrArcClusterName = ($Env:aksdrArcClusterName).toLower()

$clusters = @(
[pscustomobject]@{clusterName = $Env:k3sArcDataClusterName; dataController = "$k3sArcDataClusterName-dc" ; customLocation = "$k3sArcDataClusterName-cl" ; storageClassName = 'longhorn' ; licenseType = 'LicenseIncluded' ; context = 'k3s' ; kubeConfig = "C:\Users\$Env:adminUsername\.kube\config-datasvc-k3s" }
[pscustomobject]@{clusterName = $Env:k3sArcDataClusterName; dataController = "$k3sArcDataClusterName-dc" ; customLocation = "$k3sArcDataClusterName-cl" ; storageClassName = 'longhorn' ; licenseType = 'LicenseIncluded' ; context = 'k3s' ; kubeConfig = "C:\Users\$Env:adminUsername\.kube\config-k3s-datasvc" }
[pscustomobject]@{clusterName = $Env:aksArcClusterName ; dataController = "$aksArcClusterName-dc" ; customLocation = "$aksArcClusterName-cl" ; storageClassName = 'managed-premium' ; licenseType = 'LicenseIncluded' ; context = 'aks' ; kubeConfig = "C:\Users\$Env:adminUsername\.kube\config-aks" }
[pscustomobject]@{clusterName = $Env:aksdrArcClusterName ; dataController = "$aksdrArcClusterName-dc" ; customLocation = "$aksdrArcClusterName-cl" ; storageClassName = 'managed-premium' ; licenseType = 'DisasterRecovery' ; context = 'aks-dr'; kubeConfig = "C:\Users\$Env:adminUsername\.kube\config-aksdr" }
)
Expand Down Expand Up @@ -107,7 +107,7 @@ Write-Host "`n"
# Downloading k3s Kubernetes cluster kubeconfig file
Write-Header "Downloading k3s Kubeconfig"
$sourceFile = "https://$Env:stagingStorageAccountName.blob.core.windows.net/$($Env:k3sArcDataClusterName.ToLower())/config"
azcopy cp --check-md5 FailIfDifferentOrMissing $sourceFile "C:\Users\$Env:adminUsername\.kube\config-datasvc-k3s"
azcopy cp --check-md5 FailIfDifferentOrMissing $sourceFile "C:\Users\$Env:adminUsername\.kube\config-k3s-datasvc"
azcopy cp --check-md5 FailIfDifferentOrMissing $sourceFile "C:\Users\$Env:adminUsername\.kube\config"

$addsDomainNetBiosName = $Env:addsDomainName.Split(".")[0]
Expand All @@ -132,7 +132,7 @@ az aks get-credentials --resource-group $Env:resourceGroup --name $Env:aksdrArcC

kubectx aks="$Env:aksArcClusterName-admin"
kubectx aks-dr="$Env:aksdrArcClusterName-admin"
kubectx k3s="$namingPrefix-datasvc-k3s"
kubectx k3s="$namingPrefix-k3s-datasvc"

Start-Sleep -Seconds 10

Expand Down Expand Up @@ -333,7 +333,7 @@ Stop-Transcript
# - Deploying data services on k3s cluster
################################################

wt --% --maximized new-tab pwsh.exe -NoExit -Command Show-K8sPodStatus -kubeconfig "C:\Users\$Env:adminUsername\.kube\config-datasvc-k3s" -clusterName 'k3s Cluster'; split-pane -p "PowerShell" pwsh.exe -NoExit -Command Show-K8sPodStatus -kubeconfig "C:\Users\$Env:USERNAME\.kube\config-aks" -clusterName 'AKS Cluster'; split-pane -H pwsh.exe -NoExit -Command Show-K8sPodStatus -kubeconfig "C:\Users\$Env:USERNAME\.kube\config-aksdr" -clusterName 'AKS-DR Cluster'
wt --% --maximized new-tab pwsh.exe -NoExit -Command Show-K8sPodStatus -kubeconfig "C:\Users\$Env:adminUsername\.kube\config-k3s-datasvc" -clusterName 'k3s Cluster'; split-pane -p "PowerShell" pwsh.exe -NoExit -Command Show-K8sPodStatus -kubeconfig "C:\Users\$Env:USERNAME\.kube\config-aks" -clusterName 'AKS Cluster'; split-pane -H pwsh.exe -NoExit -Command Show-K8sPodStatus -kubeconfig "C:\Users\$Env:USERNAME\.kube\config-aksdr" -clusterName 'AKS-DR Cluster'

Write-Header "Deploying Azure Arc Data Controllers on Kubernetes cluster"
$clusters | Foreach-Object -ThrottleLimit 5 -Parallel {
Expand Down
2 changes: 1 addition & 1 deletion azure_jumpstart_arcbox/artifacts/DeployAPIM.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ az config set extension.use_dynamic_install=yes_without_prompt
################################################
# Retrive SQL Managed Instances
################################################
kubectx arcbox-datasvc-k3s
kubectx arcbox-k3s-datasvc
kubectl get nodes

# Retrieving SQL MI connection endpoints
Expand Down
2 changes: 1 addition & 1 deletion azure_jumpstart_arcbox/artifacts/DeploySQLMIADAuth.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ else {

$sqlInstances = @(

[pscustomobject]@{instanceName = 'k3s-sql'; dataController = "$k3sArcDataClusterName-dc"; customLocation = "$k3sArcDataClusterName-cl" ; storageClassName = 'longhorn' ; licenseType = 'LicenseIncluded' ; context = 'k3s' ; kubeConfig = "C:\Users\$Env:adminUsername\.kube\config-datasvc-k3s" }
[pscustomobject]@{instanceName = 'k3s-sql'; dataController = "$k3sArcDataClusterName-dc"; customLocation = "$k3sArcDataClusterName-cl" ; storageClassName = 'longhorn' ; licenseType = 'LicenseIncluded' ; context = 'k3s' ; kubeConfig = "C:\Users\$Env:adminUsername\.kube\config-k3s-datasvc" }

[pscustomobject]@{instanceName = 'aks-sql'; dataController = "$aksArcClusterName-dc" ; customLocation = "$aksArcClusterName-cl" ; storageClassName = 'managed-premium' ; licenseType = 'LicenseIncluded' ; context = 'aks'; kubeConfig = "C:\Users\$Env:adminUsername\.kube\config-aks" }

Expand Down
20 changes: 10 additions & 10 deletions azure_jumpstart_arcbox/artifacts/DevOpsLogonScript.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ $certdns = "arcbox.devops.com"
$appClonedRepo = "https://github.com/$Env:githubUser/azure-arc-jumpstart-apps"

$clusters = @(
[pscustomobject]@{clusterName = $Env:k3sArcDataClusterName; context = "$namingPrefix-datasvc-k3s" ; kubeConfig = "C:\Users\$Env:adminUsername\.kube\config" }
[pscustomobject]@{clusterName = $Env:k3sArcDataClusterName; context = "$namingPrefix-k3s-datasvc" ; kubeConfig = "C:\Users\$Env:adminUsername\.kube\config" }

[pscustomobject]@{clusterName = $Env:k3sArcClusterName; context = "$namingPrefix-k3s" ; kubeConfig = "C:\Users\$Env:adminUsername\.kube\config-k3s" }
)
Expand All @@ -37,7 +37,7 @@ if(-not $($cliDir.Parent.Attributes.HasFlag([System.IO.FileAttributes]::Hidden))

$Env:AZURE_CONFIG_DIR = $cliDir.FullName

$Env:k3sArcDataClusterName=(Get-AzResource -ResourceGroupName $Env:resourceGroup -ResourceType microsoft.kubernetes/connectedclusters).Name | Select-String "$namingPrefix-DataSvc-K3s" | Where-Object { $_ -ne "" }
$Env:k3sArcDataClusterName=(Get-AzResource -ResourceGroupName $Env:resourceGroup -ResourceType microsoft.kubernetes/connectedclusters).Name | Select-String "$namingPrefix-K3s-Data" | Where-Object { $_ -ne "" }
$Env:k3sArcDataClusterName=$Env:k3sArcDataClusterName -replace "`n",""

$Env:k3sArcClusterName=(Get-AzResource -ResourceGroupName $Env:resourceGroup -ResourceType microsoft.kubernetes/connectedclusters).Name | Select-String "$namingPrefix-K3s" | Where-Object { $_ -ne "" }
Expand All @@ -48,13 +48,13 @@ Write-Header "Az CLI Login"
az login --identity
az account set -s $env:subscriptionId

# Downloading ArcBox-DataSvc-K3s Kubernetes cluster kubeconfig file
Write-Header "Downloading $namingPrefix-DataSvc-K3s K8s Kubeconfig"
# Downloading ArcBox-K3s-DataSvc Kubernetes cluster kubeconfig file
Write-Header "Downloading $namingPrefix-K3s-DataSvc K8s Kubeconfig"
$sourceFile = "https://$Env:stagingStorageAccountName.blob.core.windows.net/$($Env:k3sArcDataClusterName.ToLower())/config"
azcopy cp --check-md5 FailIfDifferentOrMissing $sourceFile "C:\Users\$Env:USERNAME\.kube\config"

# Downloading ArcBox-DataSvc-K3s log file
Write-Header "Downloading $namingPrefix-DataSvc-K3s Install Logs"
# Downloading ArcBox-K3s-DataSvc log file
Write-Header "Downloading $namingPrefix-K3s-DataSvc Install Logs"
$sourceFile = "https://$Env:stagingStorageAccountName.blob.core.windows.net/$($Env:k3sArcDataClusterName.ToLower())/*"
$sourceFile = $sourceFile + "?" + $sas
azcopy cp --check-md5 FailIfDifferentOrMissing $sourceFile "$Env:ArcBoxLogsDir\" --include-pattern "*.log"
Expand All @@ -71,8 +71,8 @@ $sourceFile = "https://$Env:stagingStorageAccountName.blob.core.windows.net/$($E
$sourceFile = $sourceFile + "?" + $sas
azcopy cp --check-md5 FailIfDifferentOrMissing $sourceFile "$Env:ArcBoxLogsDir\" --include-pattern "*.log"

# # Merging kubeconfig files from ArcBox-DataSvc-K3s and ArcBox-K3s
# Write-Header "Merging ArcBox-DataSvc-K3s & ArcBox-K3s Kubeconfigs"
# # Merging kubeconfig files from ArcBox-K3s-DataSvc and ArcBox-K3s
# Write-Header "Merging ArcBox-K3s-DataSvc & ArcBox-K3s Kubeconfigs"
# Copy-Item -Path "C:\Users\$Env:USERNAME\.kube\config" -Destination "C:\Users\$Env:USERNAME\.kube\config.backup"
# $Env:KUBECONFIG="C:\Users\$Env:USERNAME\.kube\config;C:\Users\$Env:USERNAME\.kube\config-k3s"
# kubectl config view --raw > C:\users\$Env:USERNAME\.kube\config_tmp
Expand Down Expand Up @@ -263,9 +263,9 @@ $kubeVipDaemonset | kubectl apply -f -
Write-Host "`n"
}

# Switch Kubernetes context to ArcBox-DataSvc-K3s cluster
# Switch Kubernetes context to ArcBox-K3s-DataSvc cluster
foreach ($cluster in $clusters) {
if ($cluster.context -like '*-datasvc-k3s') {
if ($cluster.context -like '*-k3s-datasvc') {
$Env:KUBECONFIG=$cluster.kubeConfig
kubectx
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ $certdns = "arcbox.devops.com"

Start-Transcript -Path $Env:ArcBoxLogsDir\ResetBookstore.log

# Switch kubectl context to arcbox-datasvc-k3s
# Switch kubectl context to arcbox-k3s-datasvc
$Env:KUBECONFIG="C:\Users\$Env:adminUsername\.kube\config"
kubectx

Expand Down
2 changes: 1 addition & 1 deletion azure_jumpstart_arcbox/bicep/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ param namingPrefix string = 'ArcBox'
var templateBaseUrl = 'https://raw.githubusercontent.com/${githubAccount}/azure_arc/${githubBranch}/azure_jumpstart_arcbox/'
var aksArcDataClusterName = '${namingPrefix}-AKS-Data-${guid}'
var aksDrArcDataClusterName = '${namingPrefix}-AKS-DR-Data-${guid}'
var k3sArcDataClusterName = '${namingPrefix}-DataSvc-K3s-${guid}'
var k3sArcDataClusterName = '${namingPrefix}-K3s-Data-${guid}'
var k3sArcClusterName = '${namingPrefix}-K3s-${guid}'
var k3sClusterNodesCount = 3 // Number of nodes to deploy in the K3s cluster

Expand Down