-
Notifications
You must be signed in to change notification settings - Fork 32
48 lines (47 loc) · 1.38 KB
/
k8s-apply.yaml
File metadata and controls
48 lines (47 loc) · 1.38 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
name: Apply Kubectl
on:
workflow_dispatch:
jobs:
apply_k8s:
name: Verify K8s Service Account
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: azure/setup-kubectl@v3
- name: Create/Verify `.kube` directory
run: mkdir -p ~/.kube/
- name: Create kubectl config
run: |
cat << EOF >> ~/.kube/kubeconfig.yaml
${{ secrets.KUBECONFIG }}
EOF
- name: Add Secret
run: |
if [ -f ops/0-tf-secret.yaml ]; then
rm ops/0-tf-secret.yaml
fi
cat << EOF >> ops/0-tf-secret.json
{
"apiVersion": "v1",
"kind": "Secret",
"metadata": {
"name": "tf-python-secret"
},
"stringData": {
"SECRET_MESSAGE": "${{ secrets.ENV_SECRET_MESSAGE }}"
}
}
EOF
- name: Apply Kubernetes Config
run: |
KUBECONFIG=~/.kube/kubeconfig.yaml kubectl apply -f ops/
- name: Rollout tf-python
run: |
KUBECONFIG=~/.kube/kubeconfig.yaml kubectl rollout restart deployment/tf-python
- name: Echo deployments
run: |
KUBECONFIG=~/.kube/kubeconfig.yaml kubectl get deployments
- name: Echo Services
run: |
KUBECONFIG=~/.kube/kubeconfig.yaml kubectl get services