-
Notifications
You must be signed in to change notification settings - Fork 15
142 lines (111 loc) · 4.53 KB
/
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
132
133
134
135
136
137
138
name: Test
on: [push]
jobs:
lint:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: lint
uses: golangci/golangci-lint-action@v2
with:
args: --timeout 2m
controllers_testing:
name: controllers_testing
runs-on: ubuntu-latest
needs: lint
env:
KIND_CLUSTER_NAME: kind-cluster
strategy:
matrix:
kubernetes-version: [v1.16.4, v1.19.4, v1.22.4, v1.23.4]
steps:
- uses: actions/checkout@v3
- name: Set up Go 1.18
uses: actions/setup-go@v3
with:
go-version: 1.18
id: go
- name: Set up Kind Cluster
uses: helm/[email protected]
with:
node_image: kindest/node:${{ matrix.kubernetes-version }}
cluster_name: ${{ env.KIND_CLUSTER_NAME }}
- name: Test
run: make gotest
e2e_testing:
name: e2e_testing
runs-on: ubuntu-latest
needs: lint
env:
KIND_CLUSTER_NAME: kind-cluster
OPERATOR_NAMESPACE: tarantool-operator
APP_NAMESPACE: tarantool-app
OPERATOR_IMAGE_REPO: tarantool-operator
OPERATOR_IMAGE_TAG: 0.0.0
strategy:
fail-fast: false
matrix:
kubernetes-version: [v1.16.4, v1.19.4, v1.22.4, v1.23.4]
steps:
- uses: actions/checkout@v1
- name: Set up helm
uses: azure/setup-helm@v1
- name: Set up Kind Cluster
uses: helm/[email protected]
with:
node_image: kindest/node:${{ matrix.kubernetes-version }}
cluster_name: ${{ env.KIND_CLUSTER_NAME }}
- name: Prepare Tarantool operator Docker image
run: |
make docker-build REPO=${{ env.OPERATOR_IMAGE_REPO }} VERSION=${{ env.OPERATOR_IMAGE_TAG }}
kind load docker-image ${{ env.OPERATOR_IMAGE_REPO }}:${{ env.OPERATOR_IMAGE_TAG }} \
--name ${{ env.KIND_CLUSTER_NAME }}
- name: Install Tarantool Operator in Kind
run: |
# Set the default namespace
kubectl config set-context --current --namespace=${{ env.OPERATOR_NAMESPACE }}
helm install -n ${{ env.OPERATOR_NAMESPACE }} operator helm-charts/tarantool-operator \
--create-namespace \
--set image.repository=${{ env.OPERATOR_IMAGE_REPO }} \
--set image.tag=${{ env.OPERATOR_IMAGE_TAG }}
- name: Waiting for Operator Deployment availability
run: kubectl wait deployment/controller-manager --for=condition=available --timeout=60s || true
- name: Сhecking the number of available replicas
run: |
available_num=$(kubectl get deployments/controller-manager -o=jsonpath="{.status.availableReplicas}")
desired_num=$(kubectl get deployments/controller-manager -o=jsonpath="{.status.replicas}")
if [[ $available_num -ne $desired_num ]]; then
kubectl describe deployments/controller-manager
echo 'ERROR: invalid number of available replicas...' >&2; exit 1
fi
- name: Install Tarantool Cartridge app in Kind
run: |
# Set the default namespace
kubectl config set-context --current --namespace=${{ env.APP_NAMESPACE }}
helm install -n ${{ env.APP_NAMESPACE }} --create-namespace \
-f test/helpers/ci/cluster_values.yaml \
crtg \
helm-charts/tarantool-cartridge
- name: Waiting for routers Pods availability
run: for i in {1..60}; do kubectl wait -n ${{ env.APP_NAMESPACE }} --for=condition=ready pod --timeout=180s -l tarantool.io/role=router && break || sleep 1; done
- name: Сhecking the number of ready router replicas
run : |
desired_routers_num=1
ready_routers_num=$(kubectl get statefulsets/crtg-router-0 -o=jsonpath="{.status.readyReplicas}")
if [[ $ready_routers_num -ne $desired_routers_num ]]; then
kubectl describe statefulsets/crtg-router-0
kubectl describe pod -l tarantool.io/role=router
echo 'ERROR: invalid number of ready routers...' >&2; exit 1
fi
- name: Waiting for storages availability
run: kubectl wait --for=condition=ready pod --timeout=180s -l tarantool.io/role=storage || true
- name: Сhecking the number of ready storage replicas
run: |
desired_storage_num=1
ready_storage_num=$(kubectl get statefulsets/crtg-storage-0 -o=jsonpath="{.status.readyReplicas}")
if [[ $ready_storage_num -ne $desired_storage_num ]]; then
kubectl describe statefulsets/crtg-storage-0
kubectl describe pod -l tarantool.io/role=storage
echo 'ERROR: invalid number of ready storages...' >&2; exit 1
fi