-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (82 loc) · 2.95 KB
/
Copy pathdeploy-controller.yml
File metadata and controls
97 lines (82 loc) · 2.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: Deploy GitHub Actions Runner Controller
on:
push:
branches: [ main ]
paths:
- 'charts/controller/**'
- 'config/values.yaml'
- '.github/workflows/deploy-controller.yml'
pull_request:
branches: [ main ]
paths:
- 'charts/controller/**'
- 'config/values.yaml'
- '.github/workflows/deploy-controller.yml'
workflow_dispatch:
env:
HELM_VERSION: v3.12.0
KUBECTL_VERSION: v1.28.0
jobs:
validate:
name: Validate Configuration
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Helm
uses: azure/setup-helm@v3
with:
version: ${{ env.HELM_VERSION }}
- name: Validate Helm chart
run: |
helm lint charts/controller/
helm template test charts/controller/ -f config/values.yaml
- name: Validate Kubernetes manifests
run: |
helm template test charts/controller/ -f config/values.yaml | kubectl apply --dry-run=client -f -
deploy:
name: Deploy Controller
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch'
needs: validate
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Helm
uses: azure/setup-helm@v3
with:
version: ${{ env.HELM_VERSION }}
- name: Install kubectl
uses: azure/setup-kubectl@v3
with:
version: ${{ env.KUBECTL_VERSION }}
- name: Azure Login
uses: azure/login@v1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Get AKS credentials
run: |
az aks get-credentials --resource-group ${{ secrets.AKS_RESOURCE_GROUP }} --name ${{ secrets.AKS_CLUSTER_NAME }} --overwrite-existing
- name: Prepare values file with secrets
run: |
# Create a temporary values file with secrets replaced
cp config/values.yaml config/values-with-secrets.yaml
sed -i "s/\${GITHUB_TOKEN}/${{ secrets.GITHUB_TOKEN }}/g" config/values-with-secrets.yaml
sed -i "s/\${GITHUB_WEBHOOK_SECRET}/${{ secrets.GITHUB_WEBHOOK_SECRET }}/g" config/values-with-secrets.yaml
- name: Deploy Controller
run: |
helm upgrade --install github-runner-controller ./charts/controller \
-f config/values-with-secrets.yaml \
--namespace github-runner-system \
--create-namespace \
--wait \
--timeout 10m
- name: Clean up temporary files
run: |
rm -f config/values-with-secrets.yaml
- name: Verify deployment
run: |
kubectl get pods -n github-runner-system -l app.kubernetes.io/component=controller
kubectl get runnerdeployments -n github-runner-system || echo "No runner deployments yet"