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

PR - remove OSM refs, add istio install, and label namespaces for Istio #2646

Merged
merged 2 commits into from
Aug 7, 2024
Merged
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
54 changes: 10 additions & 44 deletions azure_jumpstart_arcbox/artifacts/DevOpsLogonScript.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ $Env:ArcBoxIconDir = "C:\ArcBox\Icons"
$Env:ArcBoxTestsDir = "$Env:ArcBoxDir\Tests"
$namingPrefix = ($Env:namingPrefix).toLower()

$osmReleaseVersion = "1.1.1-1"
$osmCLIReleaseVersion = "v1.2.3"
$osmMeshName = "osm"
$ingressNamespace = "ingress-nginx"
$Env:AZCOPY_AUTO_LOGIN_TYPE = "MSI"

Expand Down Expand Up @@ -84,12 +81,6 @@ azcopy cp --check-md5 FailIfDifferentOrMissing $sourceFile "$Env:ArcBoxLogsDir\
# $Env:KUBECONFIG="C:\users\$Env:USERNAME\.kube\config"
# kubectx

# Download OSM binaries
Write-Header "Downloading OSM Binaries"
Invoke-WebRequest -Uri "https://github.com/openservicemesh/osm/releases/download/$osmCLIReleaseVersion/osm-$osmCLIReleaseVersion-windows-amd64.zip" -Outfile "$Env:TempDir\osm-$osmCLIReleaseVersion-windows-amd64.zip"
Expand-Archive "$Env:TempDir\osm-$osmCLIReleaseVersion-windows-amd64.zip" -DestinationPath $Env:TempDir
Copy-Item "$Env:TempDir\windows-amd64\osm.exe" -Destination $Env:ToolsDir

Write-Header "Adding Tools Folder to PATH"
[System.Environment]::SetEnvironmentVariable('PATH', $Env:PATH + ";$Env:ToolsDir" ,[System.EnvironmentVariableTarget]::Machine)
$Env:PATH += ";$Env:ToolsDir"
Expand All @@ -107,6 +98,9 @@ foreach ($cluster in $clusters) {

$nicName = $cluster.clusterName + "-NIC"
$k3sVIP = az network nic ip-config list --resource-group $Env:resourceGroup --nic-name $nicName --query "[?primary == ``true``].privateIPAddress" -otsv

Write-Header "Installing istio on K3s cluster"
istioctl install --skip-confirmation

# Apply kube-vip RBAC manifests https://kube-vip.io/manifests/rbac.yaml
$kubeVipRBAC = @"
Expand Down Expand Up @@ -272,34 +266,19 @@ $kubeVipDaemonset | kubectl apply -f -
# kubectl apply -f "$Env:ArcBoxDir\longhorn.yaml"
# Start-Sleep -Seconds 30

# "Create OSM Kubernetes extension instance"
Write-Header "Creating OSM K8s Extension Instance"
$Env:KUBECONFIG=$clusters[0].kubeConfig
kubectx
az k8s-extension create `
--name $osmMeshName `
--extension-type Microsoft.openservicemesh `
--scope cluster `
--cluster-name $Env:k3sArcDataClusterName `
--resource-group $Env:resourceGroup `
--cluster-type connectedClusters `
--version $osmReleaseVersion `
--auto-upgrade-minor-version 'false'


# Create Kubernetes Namespaces
Write-Header "Creating K8s Namespaces"
foreach ($namespace in @('bookstore', 'bookbuyer', 'bookwarehouse', 'hello-arc', 'ingress-nginx')) {
kubectl create namespace $namespace
}

# Add the bookstore namespaces to the OSM control plane
Write-Header "Adding Bookstore Namespaces to OSM"
osm namespace add bookstore bookbuyer bookwarehouse
# Label Bookstore Namespaces for Istio injection
Write-Header "Labeling K8s Namespaces for Istio Injection"
foreach ($namespace in @('bookstore', 'bookbuyer', 'bookwarehouse')) {
kubectl label namespace $namespace istio-injection=enabled
}

# To be able to discover the endpoints of this service, we need OSM controller to monitor the corresponding namespace.
# However, Nginx must NOT be injected with an Envoy sidecar to function properly.
osm namespace add "$ingressNamespace" --mesh-name "$osmMeshName" --disable-sidecar-injection

#############################
# - Apply GitOps Configs
Expand Down Expand Up @@ -328,7 +307,7 @@ az k8s-configuration flux create `
--name config-bookstore `
--cluster-type connectedClusters `
--url $appClonedRepo `
--branch main --sync-interval 3s `
--branch arcbox_3.0 --sync-interval 3s `
--kustomization name=bookstore path=./bookstore/yaml

# Create GitOps config for Bookstore RBAC
Expand All @@ -341,22 +320,9 @@ az k8s-configuration flux create `
--scope namespace `
--namespace bookstore `
--url $appClonedRepo `
--branch main --sync-interval 3s `
--branch main--sync-interval 3s `
--kustomization name=bookstore path=./bookstore/rbac-sample

# Create GitOps config for Bookstore Traffic Split
Write-Host "Creating GitOps config for Bookstore Traffic Split"
az k8s-configuration flux create `
--cluster-name $Env:k3sArcDataClusterName `
--resource-group $Env:resourceGroup `
--name config-bookstore-osm `
--cluster-type connectedClusters `
--scope namespace `
--namespace bookstore `
--url $appClonedRepo `
--branch main --sync-interval 3s `
--kustomization name=bookstore path=./bookstore/osm-sample

# Create GitOps config for Hello-Arc application
Write-Host "Creating GitOps config for Hello-Arc application"
az k8s-configuration flux create `
Expand Down