Skip to content

Commit ffd1c98

Browse files
Copilotj143
andauthored
Add simple AKS deployment and verification workflow
Agent-Logs-Url: https://github.com/j143/basic-docker-engine/sessions/d8915ba8-c732-47bd-bfb1-a2e12067f631 Co-authored-by: j143 <53068787+j143@users.noreply.github.com>
1 parent 91706e0 commit ffd1c98

2 files changed

Lines changed: 174 additions & 0 deletions

File tree

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
name: Deploy and Verify on Azure AKS
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
resource_group:
7+
description: Azure resource group containing AKS
8+
required: true
9+
type: string
10+
aks_cluster:
11+
description: AKS cluster name
12+
required: true
13+
type: string
14+
15+
permissions:
16+
id-token: write
17+
contents: read
18+
19+
jobs:
20+
deploy-and-verify:
21+
runs-on: ubuntu-latest
22+
timeout-minutes: 20
23+
env:
24+
NAMESPACE: capsule-test-${{ github.run_id }}
25+
26+
steps:
27+
- name: Checkout code
28+
uses: actions/checkout@v4
29+
30+
- name: Set up Go
31+
uses: actions/setup-go@v5
32+
with:
33+
go-version: '^1.24'
34+
cache: true
35+
36+
- name: Build binary
37+
run: |
38+
go build -v -o basic-docker .
39+
chmod +x basic-docker
40+
sudo mv basic-docker /usr/local/bin/
41+
which basic-docker
42+
43+
- name: Azure login
44+
uses: azure/login@v2
45+
with:
46+
client-id: ${{ secrets.AZURE_CLIENT_ID }}
47+
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
48+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
49+
50+
- name: Set AKS context
51+
run: |
52+
az aks get-credentials \
53+
--resource-group "${{ inputs.resource_group }}" \
54+
--name "${{ inputs.aks_cluster }}" \
55+
--overwrite-existing
56+
kubectl cluster-info
57+
kubectl get nodes
58+
59+
- name: Create test resources in AKS
60+
run: |
61+
kubectl create namespace "$NAMESPACE"
62+
kubectl apply -f k8s/crd-resourcecapsule.yaml
63+
kubectl wait --for=condition=established --timeout=60s crd/resourcecapsules.capsules.docker.io
64+
65+
cat <<EOF | kubectl apply -f - -n "$NAMESPACE"
66+
apiVersion: v1
67+
kind: ConfigMap
68+
metadata:
69+
name: test-config-1.0
70+
labels:
71+
capsule.docker.io/name: test-config
72+
capsule.docker.io/version: "1.0"
73+
data:
74+
config.yml: |
75+
testKey: testValue
76+
environment: azure-aks
77+
EOF
78+
79+
cat <<EOF | kubectl apply -f - -n "$NAMESPACE"
80+
apiVersion: capsules.docker.io/v1
81+
kind: ResourceCapsule
82+
metadata:
83+
name: test-crd-capsule
84+
spec:
85+
data:
86+
config.yaml: |
87+
testKey: testValue
88+
environment: azure-aks
89+
version: "1.0"
90+
capsuleType: configmap
91+
rollback:
92+
enabled: true
93+
EOF
94+
95+
cat <<EOF | kubectl apply -f - -n "$NAMESPACE"
96+
apiVersion: apps/v1
97+
kind: Deployment
98+
metadata:
99+
name: test-app
100+
spec:
101+
replicas: 1
102+
selector:
103+
matchLabels:
104+
app: test-app
105+
template:
106+
metadata:
107+
labels:
108+
app: test-app
109+
spec:
110+
containers:
111+
- name: nginx
112+
image: nginx:alpine
113+
ports:
114+
- containerPort: 80
115+
EOF
116+
117+
kubectl wait --for=condition=Available deployment/test-app -n "$NAMESPACE" --timeout=120s
118+
119+
- name: Verify ResourceCapsule concepts
120+
run: |
121+
kubectl get resourcecapsule test-crd-capsule -n "$NAMESPACE" -o yaml
122+
kubectl get configmap test-config-1.0 -n "$NAMESPACE" -o yaml
123+
124+
- name: Verify capsule create command
125+
run: |
126+
mkdir -p /tmp/capsules
127+
echo "test-config data from aks" > /tmp/capsules/test-config
128+
basic-docker k8s-capsule create test-config 1.0 /tmp/capsules/test-config
129+
130+
- name: Verify volume behavior with existing tests
131+
run: |
132+
go test -v -run TestAttachCapsuleToDeployment
133+
134+
- name: Verify CRD behavior with existing tests
135+
run: |
136+
go test -v -run TestResourceCapsule
137+
138+
- name: Show AKS state on failure
139+
if: failure()
140+
run: |
141+
kubectl get all -n "$NAMESPACE" || true
142+
kubectl get resourcecapsules -n "$NAMESPACE" || true
143+
kubectl get deployment test-app -n "$NAMESPACE" -o yaml || true
144+
145+
- name: Cleanup AKS test namespace
146+
if: always()
147+
run: |
148+
kubectl delete namespace "$NAMESPACE" --ignore-not-found=true

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,32 @@ This is a **teaching/runtime prototype** designed for:
4343
- Root privileges for namespace operations
4444
- Optional: Kubernetes cluster for CRD features
4545

46+
## Simple Azure deployment and verification (AKS)
47+
48+
This repository includes a manual GitHub Actions workflow to run the project’s Kubernetes verification flow on Azure Kubernetes Service.
49+
50+
Workflow file:
51+
- `.github/workflows/azure-aks-verify.yml`
52+
53+
What it does:
54+
- Logs into Azure and connects to an AKS cluster
55+
- Deploys test resources (ConfigMap, `ResourceCapsule` CRD object, Deployment)
56+
- Runs project verification focused on:
57+
- volume behavior (`TestAttachCapsuleToDeployment`)
58+
- new ResourceCapsule CRD concepts (`TestResourceCapsule`)
59+
60+
Required GitHub secrets:
61+
- `AZURE_CLIENT_ID`
62+
- `AZURE_TENANT_ID`
63+
- `AZURE_SUBSCRIPTION_ID`
64+
65+
How to run:
66+
1. Open **Actions****Deploy and Verify on Azure AKS**
67+
2. Click **Run workflow**
68+
3. Provide:
69+
- `resource_group`
70+
- `aks_cluster`
71+
4672
## Build steps
4773

4874
### build go code

0 commit comments

Comments
 (0)