-
Notifications
You must be signed in to change notification settings - Fork 22
177 lines (146 loc) · 5.92 KB
/
e2e.yaml
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
name: Tests
on:
workflow_dispatch:
inputs:
debug_enabled:
type: boolean
description: Run the build with upterm debugging enabled
(https://github.com/lhotari/action-upterm/)
required: false
default: false
push:
tags:
- v*
branches:
- main
paths:
- "**/*.go"
pull_request:
concurrency:
group: e2e-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true
jobs:
unit-test:
runs-on: ubuntu-latest
name: Unit Test
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
cache: false
- name: Run Unit Tests
run: go test ./test/controllerstest
e2e:
runs-on: ubuntu-latest
name: E2E Test
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
cache: false
- name: Install Prerequisites
run: |
# Install clusterctl
curl -L https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.6.3/clusterctl-linux-amd64 -o clusterctl
chmod +x clusterctl
sudo mv clusterctl /usr/local/bin/
#Install Kind
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.23.0/kind-linux-amd64
chmod +x ./kind
sudo mv ./kind /usr/local/bin/kind
# Install envsubst
GOBIN="$(pwd)/bin" go install -tags tools github.com/drone/envsubst/v2/cmd/[email protected]
# Install kubectl
curl -LO "https://dl.k8s.io/release/v1.29.2/bin/linux/amd64/kubectl"
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
# Install DevSpace
curl -fsSL -o /tmp/devspace https://github.com/devspace-cloud/devspace/releases/latest/download/devspace-linux-amd64
chmod +x /tmp/devspace
sudo mv /tmp/devspace /usr/local/bin/devspace
- name: Create and Start Kind Cluster
run: |
kind create cluster --image=kindest/node:v1.28.9@sha256:dca54bc6a6079dd34699d53d7d4ffa2e853e46a20cd12d619a09207e35300bd0
echo "=== cluster-info ==="
kubectl cluster-info --context kind-kind
- name: Init
run: |
clusterctl init
echo "=== config get-contexts ==="
kubectl config get-contexts
- name: DevSpace Deploy
run: |
devspace deploy -p deploy
- name: Display Kubernetes Env
run: |
echo "=== Kubectl version ==="
kubectl version
echo "=== Kubectl config ==="
kubectl config view
echo "=== Kubectl get pods ==="
kubectl get pods -A
echo "=== Kubectl get namespaces ==="
kubectl get namespaces
echo "=== Test get crd ==="
kubectl get crd
- name: Create Vcluster Custom Resource K3S
run: |
export CLUSTER_NAME=vcluster-k3s
export CLUSTER_NAMESPACE=vcluster-k3s
export CHART_VERSION=0.20.0-beta.7
export HELM_VALUES=$(cat ./test/e2e/k3s-values.yaml | sed -z 's/\n/\\n/g')
kubectl create namespace ${CLUSTER_NAMESPACE}
cat templates/cluster-template.yaml | ./bin/envsubst | kubectl apply -n ${CLUSTER_NAMESPACE} -f -
- name: Validate Resource Ready K3S
run: |
kubectl wait --for=condition=ready vcluster -n vcluster-k3s vcluster-k3s --timeout=100s
- name: Run E2E Tests K3S
run: NAMESPACE=vcluster-k3s LOCAL_PORT=14550 go test -mod=vendor ./test/e2e -v
- name: Create Vcluster Custom Resource K0S
run: |
export CLUSTER_NAME=vcluster-k0s
export CLUSTER_NAMESPACE=vcluster-k0s
export CHART_VERSION=0.20.0-beta.7
export CHART_NAME=vcluster
export HELM_VALUES=$(cat ./test/e2e/k0s-values.yaml | sed -z 's/\n/\\n/g')
kubectl create namespace ${CLUSTER_NAMESPACE}
cat templates/cluster-template.yaml | ./bin/envsubst | kubectl apply -n ${CLUSTER_NAMESPACE} -f -
- name: Validate Resource Ready K0S
run: |
kubectl wait --for=condition=ready vcluster -n vcluster-k0s vcluster-k0s --timeout=100s
- name: Run E2E Tests K0S
run: NAMESPACE=vcluster-k0s LOCAL_PORT=14551 go test -mod=vendor ./test/e2e -v
- name: Create Vcluster Custom Resource K8S
run: |
export CLUSTER_NAME=vcluster-k8s
export CLUSTER_NAMESPACE=vcluster-k8s
export CHART_VERSION=0.20.0-beta.7
export CHART_NAME=vcluster
export HELM_VALUES=$(cat ./test/e2e/k8s-values.yaml | sed -z 's/\n/\\n/g')
kubectl create namespace ${CLUSTER_NAMESPACE}
cat templates/cluster-template.yaml | ./bin/envsubst | kubectl apply -n ${CLUSTER_NAMESPACE} -f -
- name: Validate Resource Ready K8S
run: |
kubectl wait --for=condition=ready vcluster -n vcluster-k8s vcluster-k8s --timeout=100s
- name: Run E2E Tests K8S
run: NAMESPACE=vcluster-k8s LOCAL_PORT=14552 go test -mod=vendor ./test/e2e -v
- name: Create Vcluster Custom Resource EKS
run: |
export CLUSTER_NAME=vcluster-eks
export CLUSTER_NAMESPACE=vcluster-eks
export CHART_VERSION=0.20.0-beta.7
export CHART_NAME=vcluster
export HELM_VALUES=$(cat ./test/e2e/eks-values.yaml | sed -z 's/\n/\\n/g')
kubectl create namespace ${CLUSTER_NAMESPACE}
cat templates/cluster-template.yaml | ./bin/envsubst | kubectl apply -n ${CLUSTER_NAMESPACE} -f -
- name: Validate Resource Ready EKS
run: |
kubectl wait --for=condition=ready vcluster -n vcluster-eks vcluster-eks --timeout=100s
- name: Run E2E Tests EKS
run: NAMESPACE=vcluster-eks LOCAL_PORT=14553 go test -mod=vendor ./test/e2e -v