Skip to content

ci: restart konnectivity agents before deploy (AKS experiment 1) #622

ci: restart konnectivity agents before deploy (AKS experiment 1)

ci: restart konnectivity agents before deploy (AKS experiment 1) #622

Workflow file for this run

# Copyright 2025 Defense Unicorns
# SPDX-License-Identifier: AGPL-3.0-or-later OR LicenseRef-Defense-Unicorns-Commercial
name: AKS Test
on:
schedule:
- cron: "0 0 * * 0" # Every Sunday Midnight (UTC) / Saturday 5pm MT
workflow_call: {}
pull_request:
branches:
- main
- "release/**"
paths:
- ".github/workflows/test-aks.yaml"
- ".github/bundles/aks/**"
- ".github/test-infra/azure/**"
- "tasks/iac.yaml"
workflow_dispatch:
inputs:
flavor:
description: "Flavor to test (upstream, registry1, unicorn, or all)"
type: choice
options:
- all
- upstream
- registry1
- unicorn
default: all
permissions:
id-token: write
contents: read
packages: read
jobs:
test-aks-install:
concurrency:
group: aks-${{ matrix.flavor }}-${{ github.ref }}
cancel-in-progress: true
strategy:
fail-fast: false
matrix:
flavor: ${{ (github.event_name == 'workflow_dispatch' && inputs.flavor != 'all') && fromJson(format('["{0}"]', inputs.flavor)) || fromJson('["upstream", "registry1", "unicorn"]') }}
runs-on: ubuntu-latest
name: test-aks
permissions:
id-token: write
contents: read
packages: read
pull-requests: write # Allows writing to pull requests (needed for renovate-readiness)
env:
SHA: ${{ github.sha }}
UDS_REGION: centralus
UDS_RESOURCE_GROUP_NAME: ${{ secrets.AZURE_RESOURCE_GROUP }}
UDS_STORAGE_ACCOUNT_NAME: ${{ secrets.AZURE_STORAGE_ACCOUNT_NAME }}
UDS_CONTAINER_NAME: ${{ secrets.AZURE_STORAGE_CONTAINER_NAME }}
steps:
- name: Set ENV
run: |
echo "UDS_CLUSTER_NAME=uds-ci-${{ matrix.flavor }}-${SHA:0:7}" >> $GITHUB_ENV
echo "UDS_STATE_KEY="uds-core/${SHA:0:7}-nightly-aks-core-${{ matrix.flavor }}.tfstate >> $GITHUB_ENV
echo "TF_VAR_location=${UDS_REGION}" >> $GITHUB_ENV
echo "TF_VAR_cluster_name=uds-ci-${{ matrix.flavor }}-${SHA:0:7}" >> $GITHUB_ENV
echo "TF_VAR_resource_group_name=uds-ci-${{ matrix.flavor }}" >> $GITHUB_ENV
echo "ARM_SUBSCRIPTION_ID=${{ secrets.AZURE_SUBSCRIPTION_ID }}" >> $GITHUB_ENV
echo "ARM_CLIENT_ID=${{ secrets.AZURE_CLIENT_ID }}" >> $GITHUB_ENV
echo "ARM_TENANT_ID=${{ secrets.AZURE_TENANT_ID }}" >> $GITHUB_ENV
echo "ARM_USE_OIDC=true" >> $GITHUB_ENV
echo "ARM_STORAGE_USE_AZUREAD=true" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Check renovate readiness
if: startsWith(github.event.pull_request.head.ref, 'renovate/') # Only call for Renovate PRs
uses: ./.github/actions/renovate-readiness
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Azure login
uses: azure/login@532459ea530d8321f2fb9bb10d1e0bcf23869a43 # v3
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Environment setup
uses: ./.github/actions/setup
with:
registry1Username: ${{ secrets.IRON_BANK_ROBOT_USERNAME }}
registry1Password: ${{ secrets.IRON_BANK_ROBOT_PASSWORD }}
ghToken: ${{ secrets.GITHUB_TOKEN }}
rapidfortUsername: ${{ secrets.RAPIDFORT_USERNAME }}
rapidfortPassword: ${{ secrets.RAPIDFORT_PASSWORD }}
- name: Setup Tofu
uses: opentofu/setup-opentofu@fc711fa910b93cba0f3fbecaafc9f42fd0c411cb # v2.0.0
with:
# renovate: datasource=github-tags depName=opentofu/opentofu extractVersion=^v?(?<version>.*)$
tofu_version: 1.11.5
tofu_wrapper: false
- name: Create UDS Core Package
run: ZARF_ARCHITECTURE=amd64 uds run -f tasks/create.yaml standard-package --no-progress --with create_options="--skip-sbom" --set FLAVOR=${{ matrix.flavor }}
- name: Create Core Bundle
run: uds create .github/bundles/aks --confirm
- name: Create IAC
run: uds run -f tasks/iac.yaml apply-tofu --no-progress --set K8S_DISTRO=aks --set CLOUD=azure
- name: Configure Cluster DNS
run: uds run -f tasks/utils.yaml aks-coredns-setup --no-progress
- name: Wait for cluster ready
run: uds run -f tasks/iac.yaml cluster-ready --no-progress
- name: Restart konnectivity agents
run: uds run -f tasks/iac.yaml aks-konnectivity-restart --no-progress
- name: Deploy Core Bundle
env:
UDS_CONFIG: .github/bundles/aks/uds-config.yaml
run: uds deploy .github/bundles/aks/uds-bundle-uds-core-aks-nightly-*.tar.zst --confirm
timeout-minutes: 40
- name: Test UDS Core
run: uds run -f tasks/test.yaml uds-core-non-k3d --set EXCLUDED_PACKAGES="metrics-server"
- name: Debug Output
if: ${{ always() }}
uses: ./.github/actions/debug-output
- name: Save logs
if: always()
uses: ./.github/actions/save-logs
with:
suffix: -aks-${{ matrix.flavor }}
distro: "aks"
- name: Remove UDS Core
if: always()
run: set +e; for i in $(seq 0 2); do uds remove .github/bundles/aks/uds-bundle-uds-core-aks-nightly-*.tar.zst --confirm; if [ $? -eq 0 ]; then break; fi; done
timeout-minutes: 10
continue-on-error: true
- name: Remove IAC
if: always()
run: uds run -f tasks/iac.yaml destroy-iac --no-progress --set K8S_DISTRO=aks --set CLOUD=azure
- name: Send Slack notification
if: failure() && github.event_name == 'schedule'
uses: ./.github/actions/slack-alert
with:
webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }}
channel: ${{ vars.SLACK_ALERT_CHANNEL }}