-
Notifications
You must be signed in to change notification settings - Fork 17
131 lines (129 loc) · 5.95 KB
/
e2e_test.yml
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: e2e_test
on:
pull_request:
branches:
- OSC-MIGRATION
- master
paths:
- "**.go"
- "Dockerfile"
- ".trivyignore"
- "Makefile"
- "go.*"
- "osc-bsu-csi-driver/**.yaml"
- ".github/workflows/e2e_test.yml"
push:
branches: [ OSC-MIGRATION, master ]
paths:
- "**.go"
- "Dockerfile"
- ".trivyignore"
- "Makefile"
- "go.*"
- "osc-bsu-csi-driver/**.yaml"
- ".github/workflows/e2e_test.yml"
workflow_dispatch:
jobs:
create_cluster:
runs-on: [self-hosted, linux]
steps:
# Retrieve the code from the repo (UNSAFE)
- uses: actions/checkout@v2
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
- uses: actions/checkout@v2
with:
repository: 'outscale-dev/osc-k8s-rke-cluster'
path: "set-up-rke-cluster"
- uses: azure/[email protected]
- uses: azure/setup-helm@v3
with:
version: v3.16.1
- uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'
cache: true
- uses: outscale-dev/frieza-github-actions/frieza-clean@master
with:
access_key: ${{ secrets.OSC_ACCESS_KEY }}
secret_key: ${{ secrets.OSC_SECRET_KEY }}
region: ${{ secrets.OSC_REGION }}
- name: Deploy Cluster
uses: outscale-dev/osc-k8s-rke-cluster/github_actions/deploy_cluster@master
with:
repository_folder: "set-up-rke-cluster"
osc_access_key: ${{ secrets.OSC_ACCESS_KEY }}
osc_secret_key: ${{ secrets.OSC_SECRET_KEY }}
osc_region: ${{ secrets.OSC_REGION }}
image_id: ${{ secrets.OMI_ID }}
rke_version: "v1.6.0"
kubernetes_version: "v1.30.2-rancher1-1"
- name: Wait to access the cluster
uses: nick-invision/retry@v2
with:
timeout_seconds: 60
max_attempts: 10
command: kubectl get nodes
env:
KUBECONFIG: set-up-rke-cluster/rke/kube_config_cluster.yml
- name: Deploy Docker-registry into cluster
run: |
ansible-playbook addons/docker-registry/playbook.yaml
./addons/docker-registry/start_port_forwarding.sh &
env:
KUBECONFIG: rke/kube_config_cluster.yml
ANSIBLE_CONFIG: ansible.cfg
working-directory: set-up-rke-cluster
- name: Push the Docker image
run: |
make buildx-image image-tag image-push
docker image prune -a -f
env:
REGISTRY_IMAGE: localhost:4242/csi
IMAGE_TAG: ${{ github.sha }}
REGISTRY_TAG: ${{ github.sha }}
- name: Retrieve NodePort Ip and NodePort
run: |
echo nodeport_port=$(kubectl get --namespace default -o jsonpath="{.spec.ports[0].nodePort}" services docker-registry) >> $GITHUB_ENV
echo nodeport_ip=$(kubectl get nodes --namespace default -o jsonpath="{.items[0].status.addresses[0].address}") >> $GITHUB_ENV
env:
KUBECONFIG: set-up-rke-cluster/rke/kube_config_cluster.yml
- name: Install CSI
run: |
kubectl apply -f set-up-rke-cluster/addons/csi/secrets.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/release-8.0/client/config/crd/snapshot.storage.k8s.io_volumesnapshotclasses.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/release-8.0/client/config/crd/snapshot.storage.k8s.io_volumesnapshotcontents.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/release-8.0/client/config/crd/snapshot.storage.k8s.io_volumesnapshots.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/release-8.0/deploy/kubernetes/snapshot-controller/rbac-snapshot-controller.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/release-8.0/deploy/kubernetes/snapshot-controller/setup-snapshot-controller.yaml
TARGET_IMAGE=${nodeport_ip}:${nodeport_port}/csi TARGET_TAG=$IMAGE_TAG make helm_deploy
env:
KUBECONFIG: set-up-rke-cluster/rke/kube_config_cluster.yml
OSC_REGION: ${{ secrets.OSC_REGION}}
IMAGE_TAG: ${{ github.sha }}
- name: Run e2e tests
env:
OSC_ACCESS_KEY: ${{ secrets.OSC_ACCESS_KEY }}
OSC_SECRET_KEY: ${{ secrets.OSC_SECRET_KEY }}
OSC_REGION: ${{ secrets.OSC_REGION }}
run: bash -c "KC=$(base64 -w 0 set-up-rke-cluster/rke/kube_config_cluster.yml) make test-e2e-single-az-buildx"
- name: Uninstall CSI
run: |
kubectl delete -f set-up-rke-cluster/addons/csi/secrets.yaml
kubectl delete -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/release-8.0/client/config/crd/snapshot.storage.k8s.io_volumesnapshotclasses.yaml
kubectl delete -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/release-8.0/client/config/crd/snapshot.storage.k8s.io_volumesnapshotcontents.yaml
kubectl delete -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/release-8.0/client/config/crd/snapshot.storage.k8s.io_volumesnapshots.yaml
kubectl delete -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/release-8.0/deploy/kubernetes/snapshot-controller/rbac-snapshot-controller.yaml
kubectl delete -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/release-8.0/deploy/kubernetes/snapshot-controller/setup-snapshot-controller.yaml
helm uninstall --wait osc-bsu-csi-driver --namespace kube-system
env:
KUBECONFIG: set-up-rke-cluster/rke/kube_config_cluster.yml
- name: Destroy Cluster
uses: outscale-dev/osc-k8s-rke-cluster/github_actions/destroy_cluster@master
if: ${{ always() }}
with:
repository_folder: "set-up-rke-cluster"
osc_access_key: ${{ secrets.OSC_ACCESS_KEY }}
osc_secret_key: ${{ secrets.OSC_SECRET_KEY }}
osc_region: ${{ secrets.OSC_REGION }}