-
Notifications
You must be signed in to change notification settings - Fork 259
Swiftv2 Long running cluster - test pipeline #4099
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
Open
sivakami-projects
wants to merge
45
commits into
master
Choose a base branch
from
swiftv2-pipeline-branch
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
f2fc2a0
init swiftv2 pipeline for persistent tests on aks clusters.
f395789
Set default params.
30e5c30
Update pipeline.yaml for Azure Pipelines
sivakami-projects 4237bd5
long running pipeline infra setup.
f602de5
Set depedencies for pipeline jobs.
d83a3a5
template for long running cluster.
608ba04
set template.
dd91157
set dependency for jobs.
1f81177
Change job name.
17aff93
Set job scripts.
73b21b6
set pipeline scripts with permissions.
fe19ca9
set script path.
22ce2e1
set template params.
67e07fe
Set pipeline template for long running clusters.
ce36461
test change.
ae45dac
set params.
8d0c0d1
set params in pipeline scripts.
6052887
set cx vnet name.
a385ab1
Create clusters parallely
d8a07a2
create NSG.
02b746f
Change dependency for creating nsg.
f4c8596
Update .pipelines/swiftv2-long-running/scripts/create_peerings.sh
sivakami-projects 9a3b87e
Update .pipelines/swiftv2-long-running/scripts/create_nsg.sh
sivakami-projects d1498e1
Add success/error message for each resource creation.
9032798
Remove unused argument from template.
b2610cc
Rename subnets. Changed NSG rules to prevent network connectivity bet…
b67fc7d
Private endpoints.
ef3c19f
Change pipeline template.
13b8958
Set output variables.
3786b50
private endpoint.
5891281
update private endpoint.
8943f8e
create storage account.
520647e
disallow shared key access.
183ef9b
change pipeline template.
4854452
Removed unused param.
6d11241
Link private endpoint dns to vnet a2 and vnet a3.
ba6b336
attach nsg rule to subnets.
7d07adb
Link nsg with subnet.
8627ad0
Private endpoint fix - long running pipeline.
102393a
Verify each resource creation - long running cluster test pipeline.
41edd59
verify storage account creation.
4ddd3d6
use make tragets to create aks clusters.
8690ca3
misc.
9548e51
set aks custom headers.
d2d1391
Use aks common field in swiftv2-podsubnet-cluster creation.
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| trigger: none | ||
|
|
||
| parameters: | ||
| - name: subscriptionId | ||
| displayName: "Azure Subscription ID" | ||
| type: string | ||
| default: "37deca37-c375-4a14-b90a-043849bd2bf1" | ||
|
|
||
| - name: location | ||
| displayName: "Deployment Region" | ||
| type: string | ||
| default: "centraluseuap" | ||
|
|
||
| - name: resourceGroupName | ||
| displayName: "Resource Group Name" | ||
| type: string | ||
| default: "long-run-$(Build.BuildId)" | ||
|
|
||
| - name: vmSkuDefault | ||
| displayName: "VM SKU for Default Node Pool" | ||
| type: string | ||
| default: "Standard_D2s_v3" | ||
|
|
||
| - name: vmSkuHighNIC | ||
| displayName: "VM SKU for High NIC Node Pool" | ||
| type: string | ||
| default: "Standard_D16s_v3" | ||
|
|
||
| - name: serviceConnection | ||
| displayName: "Azure Service Connection" | ||
| type: string | ||
| default: "Azure Container Networking - Standalone Test Service Connection" | ||
|
|
||
| extends: | ||
| template: template/long-running-pipeline-template.yaml | ||
| parameters: | ||
| subscriptionId: ${{ parameters.subscriptionId }} | ||
| location: ${{ parameters.location }} | ||
| resourceGroupName: ${{ parameters.resourceGroupName }} | ||
| vmSkuDefault: ${{ parameters.vmSkuDefault }} | ||
| vmSkuHighNIC: ${{ parameters.vmSkuHighNIC }} | ||
| serviceConnection: ${{ parameters.serviceConnection }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
| trap 'echo "[ERROR] Failed during Resource group or AKS cluster creation." >&2' ERR | ||
| SUBSCRIPTION_ID=$1 | ||
| LOCATION=$2 | ||
| RG=$3 | ||
| VM_SKU_DEFAULT=$4 | ||
| VM_SKU_HIGHNIC=$5 | ||
|
|
||
| CLUSTER_COUNT=2 | ||
| CLUSTER_PREFIX="aks" | ||
| DEFAULT_NODE_COUNT=1 | ||
| COMMON_TAGS="fastpathenabled=true RGOwner=LongRunningTestPipelines stampcreatorserviceinfo=true" | ||
|
|
||
| wait_for_provisioning() { # Helper for safe retry/wait for provisioning states (basic) | ||
| local rg="$1" clusterName="$2" | ||
| echo "Waiting for AKS '$clusterName' in RG '$rg' to reach Succeeded/Failed (polling)..." | ||
| while :; do | ||
| state=$(az aks show --resource-group "$rg" --name "$clusterName" --query provisioningState -o tsv 2>/dev/null || true) | ||
| if [ -z "$state" ]; then | ||
| sleep 3 | ||
| continue | ||
| fi | ||
| case "$state" in | ||
| Succeeded|Succeeded*) echo "Provisioning state: $state"; break ;; | ||
| Failed|Canceled|Rejected) echo "Provisioning finished with state: $state"; break ;; | ||
| *) printf "."; sleep 6 ;; | ||
| esac | ||
| done | ||
| } | ||
|
|
||
|
|
||
| for i in $(seq 1 "$CLUSTER_COUNT"); do | ||
| echo "==============================" | ||
| echo " Working on cluster set #$i" | ||
| echo "==============================" | ||
|
|
||
| CLUSTER_NAME="${CLUSTER_PREFIX}-${i}" | ||
| echo "Creating AKS cluster '$CLUSTER_NAME' in RG '$RG'" | ||
|
|
||
| make -C ./hack/aks azcfg AZCLI=az REGION=$LOCATION | ||
|
|
||
| make -C ./hack/aks swiftv2-podsubnet-cluster-up \ | ||
| AZCLI=az REGION=$LOCATION \ | ||
| SUB=$SUBSCRIPTION_ID \ | ||
| GROUP=$RG \ | ||
| CLUSTER=$CLUSTER_NAME \ | ||
| NODE_COUNT=$DEFAULT_NODE_COUNT \ | ||
| VM_SIZE=$VM_SKU_DEFAULT \ | ||
|
|
||
| echo " - waiting for AKS provisioning state..." | ||
| wait_for_provisioning "$RG" "$CLUSTER_NAME" | ||
|
|
||
| echo "Adding multi-tenant nodepool ' to '$CLUSTER_NAME'" | ||
| make -C ./hack/aks linux-swiftv2-nodepool-up \ | ||
| AZCLI=az REGION=$LOCATION \ | ||
| GROUP=$RG \ | ||
| VM_SIZE=$VM_SKU_HIGHNIC \ | ||
| CLUSTER=$CLUSTER_NAME \ | ||
| SUB=$SUBSCRIPTION_ID \ | ||
|
|
||
| done | ||
| echo "All done. Created $CLUSTER_COUNT cluster set(s)." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| #!/usr/bin/env bash | ||
| set -e | ||
| trap 'echo "[ERROR] Failed during NSG creation or rule setup." >&2' ERR | ||
|
|
||
| SUBSCRIPTION_ID=$1 | ||
| RG=$2 | ||
| LOCATION=$3 | ||
|
|
||
| VNET_A1="cx_vnet_a1" | ||
| SUBNET1_PREFIX="10.10.1.0/24" | ||
| SUBNET2_PREFIX="10.10.2.0/24" | ||
| NSG_NAME="${VNET_A1}-nsg" | ||
|
|
||
| verify_nsg() { | ||
| local rg="$1"; local name="$2" | ||
| echo "==> Verifying NSG: $name" | ||
| if az network nsg show -g "$rg" -n "$name" &>/dev/null; then | ||
| echo "[OK] Verified NSG $name exists." | ||
| else | ||
| echo "[ERROR] NSG $name not found!" >&2 | ||
| exit 1 | ||
| fi | ||
| } | ||
|
|
||
| verify_nsg_rule() { | ||
| local rg="$1"; local nsg="$2"; local rule="$3" | ||
| echo "==> Verifying NSG rule: $rule in $nsg" | ||
| if az network nsg rule show -g "$rg" --nsg-name "$nsg" -n "$rule" &>/dev/null; then | ||
| echo "[OK] Verified NSG rule $rule exists in $nsg." | ||
| else | ||
| echo "[ERROR] NSG rule $rule not found in $nsg!" >&2 | ||
| exit 1 | ||
| fi | ||
| } | ||
|
|
||
| verify_subnet_nsg_association() { | ||
| local rg="$1"; local vnet="$2"; local subnet="$3"; local nsg="$4" | ||
| echo "==> Verifying NSG association on subnet $subnet..." | ||
| local associated_nsg | ||
| associated_nsg=$(az network vnet subnet show -g "$rg" --vnet-name "$vnet" -n "$subnet" --query "networkSecurityGroup.id" -o tsv 2>/dev/null || echo "") | ||
| if [[ "$associated_nsg" == *"$nsg"* ]]; then | ||
| echo "[OK] Verified subnet $subnet is associated with NSG $nsg." | ||
| else | ||
| echo "[ERROR] Subnet $subnet is NOT associated with NSG $nsg!" >&2 | ||
| exit 1 | ||
| fi | ||
| } | ||
|
|
||
| # ------------------------------- | ||
| # 1. Create NSG | ||
| # ------------------------------- | ||
| echo "==> Creating Network Security Group: $NSG_NAME" | ||
| az network nsg create -g "$RG" -n "$NSG_NAME" -l "$LOCATION" --output none \ | ||
| && echo "[OK] NSG '$NSG_NAME' created." | ||
| verify_nsg "$RG" "$NSG_NAME" | ||
|
|
||
| # ------------------------------- | ||
| # 2. Create NSG Rules | ||
| # ------------------------------- | ||
| echo "==> Creating NSG rule to DENY traffic from Subnet1 ($SUBNET1_PREFIX) to Subnet2 ($SUBNET2_PREFIX)" | ||
| az network nsg rule create \ | ||
| --resource-group "$RG" \ | ||
| --nsg-name "$NSG_NAME" \ | ||
| --name deny-subnet1-to-subnet2 \ | ||
| --priority 100 \ | ||
| --source-address-prefixes "$SUBNET1_PREFIX" \ | ||
| --destination-address-prefixes "$SUBNET2_PREFIX" \ | ||
| --direction Inbound \ | ||
| --access Deny \ | ||
| --protocol "*" \ | ||
| --description "Deny all traffic from Subnet1 to Subnet2" \ | ||
| --output none \ | ||
| && echo "[OK] Deny rule from Subnet1 → Subnet2 created." | ||
|
|
||
| verify_nsg_rule "$RG" "$NSG_NAME" "deny-subnet1-to-subnet2" | ||
|
|
||
| echo "==> Creating NSG rule to DENY traffic from Subnet2 ($SUBNET2_PREFIX) to Subnet1 ($SUBNET1_PREFIX)" | ||
| az network nsg rule create \ | ||
| --resource-group "$RG" \ | ||
| --nsg-name "$NSG_NAME" \ | ||
| --name deny-subnet2-to-subnet1 \ | ||
| --priority 200 \ | ||
| --source-address-prefixes "$SUBNET2_PREFIX" \ | ||
| --destination-address-prefixes "$SUBNET1_PREFIX" \ | ||
| --direction Inbound \ | ||
| --access Deny \ | ||
| --protocol "*" \ | ||
| --description "Deny all traffic from Subnet2 to Subnet1" \ | ||
| --output none \ | ||
| && echo "[OK] Deny rule from Subnet2 → Subnet1 created." | ||
|
|
||
| verify_nsg_rule "$RG" "$NSG_NAME" "deny-subnet2-to-subnet1" | ||
|
|
||
| # ------------------------------- | ||
| # 3. Associate NSG with Subnets | ||
| # ------------------------------- | ||
| for SUBNET in s1 s2; do | ||
| echo "==> Associating NSG $NSG_NAME with subnet $SUBNET" | ||
| az network vnet subnet update \ | ||
| --name "$SUBNET" \ | ||
| --vnet-name "$VNET_A1" \ | ||
| --resource-group "$RG" \ | ||
| --network-security-group "$NSG_NAME" \ | ||
| --output none | ||
| verify_subnet_nsg_association "$RG" "$VNET_A1" "$SUBNET" "$NSG_NAME" | ||
| done | ||
|
|
||
| echo "NSG '$NSG_NAME' created successfully with bidirectional isolation between Subnet1 and Subnet2." | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| #!/usr/bin/env bash | ||
| set -e | ||
| trap 'echo "[ERROR] Failed during Private Endpoint or DNS setup." >&2' ERR | ||
|
|
||
| SUBSCRIPTION_ID=$1 | ||
| LOCATION=$2 | ||
| RG=$3 | ||
| SA1_NAME=$4 # Storage account 1 | ||
|
|
||
| VNET_A1="cx_vnet_a1" | ||
| VNET_A2="cx_vnet_a2" | ||
| VNET_A3="cx_vnet_a3" | ||
| SUBNET_PE_A1="pe" | ||
| PE_NAME="${SA1_NAME}-pe" | ||
| PRIVATE_DNS_ZONE="privatelink.blob.core.windows.net" | ||
|
|
||
| # ------------------------------- | ||
| # Function: Verify Resource Exists | ||
| # ------------------------------- | ||
| verify_dns_zone() { | ||
| local rg="$1"; local zone="$2" | ||
| echo "==> Verifying Private DNS zone: $zone" | ||
| if az network private-dns zone show -g "$rg" -n "$zone" &>/dev/null; then | ||
| echo "[OK] Verified DNS zone $zone exists." | ||
| else | ||
| echo "[ERROR] DNS zone $zone not found!" >&2 | ||
| exit 1 | ||
| fi | ||
| } | ||
|
|
||
| verify_dns_link() { | ||
| local rg="$1"; local zone="$2"; local link="$3" | ||
| echo "==> Verifying DNS link: $link for zone $zone" | ||
| if az network private-dns link vnet show -g "$rg" --zone-name "$zone" -n "$link" &>/dev/null; then | ||
| echo "[OK] Verified DNS link $link exists." | ||
| else | ||
| echo "[ERROR] DNS link $link not found!" >&2 | ||
| exit 1 | ||
| fi | ||
| } | ||
|
|
||
| verify_private_endpoint() { | ||
| local rg="$1"; local name="$2" | ||
| echo "==> Verifying Private Endpoint: $name" | ||
| if az network private-endpoint show -g "$rg" -n "$name" &>/dev/null; then | ||
| echo "[OK] Verified Private Endpoint $name exists." | ||
| else | ||
| echo "[ERROR] Private Endpoint $name not found!" >&2 | ||
| exit 1 | ||
| fi | ||
| } | ||
|
|
||
| # 1. Create Private DNS zone | ||
| echo "==> Creating Private DNS zone: $PRIVATE_DNS_ZONE" | ||
| az network private-dns zone create -g "$RG" -n "$PRIVATE_DNS_ZONE" --output none \ | ||
| && echo "[OK] DNS zone $PRIVATE_DNS_ZONE created." | ||
|
|
||
| verify_dns_zone "$RG" "$PRIVATE_DNS_ZONE" | ||
|
|
||
| # 2. Link DNS zone to VNet | ||
| for VNET in "$VNET_A1" "$VNET_A2" "$VNET_A3"; do | ||
| LINK_NAME="${VNET}-link" | ||
| echo "==> Linking DNS zone $PRIVATE_DNS_ZONE to VNet $VNET" | ||
| az network private-dns link vnet create \ | ||
| -g "$RG" -n "$LINK_NAME" \ | ||
| --zone-name "$PRIVATE_DNS_ZONE" \ | ||
| --virtual-network "$VNET" \ | ||
| --registration-enabled false \ | ||
| --output none \ | ||
| && echo "[OK] Linked DNS zone to $VNET." | ||
| verify_dns_link "$RG" "$PRIVATE_DNS_ZONE" "$LINK_NAME" | ||
| done | ||
|
|
||
| # 3. Create Private Endpoint | ||
| echo "==> Creating Private Endpoint for Storage Account: $SA1_NAME" | ||
| SA1_ID=$(az storage account show -g "$RG" -n "$SA1_NAME" --query id -o tsv) | ||
| az network private-endpoint create \ | ||
| -g "$RG" -n "$PE_NAME" -l "$LOCATION" \ | ||
| --vnet-name "$VNET_A1" --subnet "$SUBNET_PE_A1" \ | ||
| --private-connection-resource-id "$SA1_ID" \ | ||
| --group-id blob \ | ||
| --connection-name "${PE_NAME}-conn" \ | ||
| --output none \ | ||
| && echo "[OK] Private Endpoint $PE_NAME created for $SA1_NAME." | ||
| verify_private_endpoint "$RG" "$PE_NAME" | ||
|
|
||
| echo "All Private DNS and Endpoint resources created and verified successfully." |
38 changes: 38 additions & 0 deletions
38
.pipelines/swiftv2-long-running/scripts/create_peerings.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| #!/usr/bin/env bash | ||
| set -e | ||
| trap 'echo "[ERROR] Failed during VNet peering creation." >&2' ERR | ||
|
|
||
| RG=$1 | ||
| VNET_A1="cx_vnet_a1" | ||
| VNET_A2="cx_vnet_a2" | ||
| VNET_A3="cx_vnet_a3" | ||
| VNET_B1="cx_vnet_b1" | ||
|
|
||
| verify_peering() { | ||
| local rg="$1"; local vnet="$2"; local peering="$3" | ||
| echo "==> Verifying peering $peering on $vnet..." | ||
| if az network vnet peering show -g "$rg" --vnet-name "$vnet" -n "$peering" --query "peeringState" -o tsv | grep -q "Connected"; then | ||
| echo "[OK] Peering $peering on $vnet is Connected." | ||
| else | ||
| echo "[ERROR] Peering $peering on $vnet not found or not Connected!" >&2 | ||
| exit 1 | ||
| fi | ||
| } | ||
|
|
||
| peer_two_vnets() { | ||
| local rg="$1"; local v1="$2"; local v2="$3"; local name12="$4"; local name21="$5" | ||
| echo "==> Peering $v1 <-> $v2" | ||
| az network vnet peering create -g "$rg" -n "$name12" --vnet-name "$v1" --remote-vnet "$v2" --allow-vnet-access --output none \ | ||
| && echo "Created peering $name12" | ||
| az network vnet peering create -g "$rg" -n "$name21" --vnet-name "$v2" --remote-vnet "$v1" --allow-vnet-access --output none \ | ||
| && echo "Created peering $name21" | ||
|
|
||
| # Verify both peerings are active | ||
| verify_peering "$rg" "$v1" "$name12" | ||
| verify_peering "$rg" "$v2" "$name21" | ||
| } | ||
|
|
||
| peer_two_vnets "$RG" "$VNET_A1" "$VNET_A2" "A1-to-A2" "A2-to-A1" | ||
| peer_two_vnets "$RG" "$VNET_A2" "$VNET_A3" "A2-to-A3" "A3-to-A2" | ||
| peer_two_vnets "$RG" "$VNET_A1" "$VNET_A3" "A1-to-A3" "A3-to-A1" | ||
| echo "All VNet peerings created and verified successfully." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| #!/usr/bin/env bash | ||
| set -e | ||
| trap 'echo "[ERROR] Failed during Storage Account creation." >&2' ERR | ||
|
|
||
| SUBSCRIPTION_ID=$1 | ||
| LOCATION=$2 | ||
| RG=$3 | ||
|
|
||
| RAND=$(openssl rand -hex 4) | ||
| SA1="sa1${RAND}" | ||
| SA2="sa2${RAND}" | ||
|
|
||
| # Set subscription context | ||
| az account set --subscription "$SUBSCRIPTION_ID" | ||
|
|
||
| # Create storage accounts | ||
| for SA in "$SA1" "$SA2"; do | ||
| echo "==> Creating storage account $SA" | ||
| az storage account create \ | ||
| --name "$SA" \ | ||
| --resource-group "$RG" \ | ||
| --location "$LOCATION" \ | ||
| --sku Standard_LRS \ | ||
| --kind StorageV2 \ | ||
| --allow-blob-public-access false \ | ||
| --allow-shared-key-access false \ | ||
| --https-only true \ | ||
| --min-tls-version TLS1_2 \ | ||
| --query "name" -o tsv \ | ||
| && echo "Storage account $SA created successfully." | ||
| # Verify creation success | ||
| echo "==> Verifying storage account $SA exists..." | ||
| if az storage account show --name "$SA" --resource-group "$RG" &>/dev/null; then | ||
| echo "[OK] Storage account $SA verified successfully." | ||
| else | ||
| echo "[ERROR] Storage account $SA not found after creation!" >&2 | ||
| exit 1 | ||
| fi | ||
| done | ||
|
|
||
| echo "All storage accounts created and verified successfully." | ||
|
|
||
| # Set pipeline output variables | ||
| set +x | ||
| echo "##vso[task.setvariable variable=StorageAccount1;isOutput=true]$SA1" | ||
| echo "##vso[task.setvariable variable=StorageAccount2;isOutput=true]$SA2" | ||
| set -x | ||
sivakami-projects marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.