-
Notifications
You must be signed in to change notification settings - Fork 24
151 lines (121 loc) · 4.05 KB
/
kind-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
name: KinD e2e tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
concurrency:
group: kind-e2e-tests-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
e2e:
name: e2e tests
runs-on: ubuntu-latest
env:
GOPATH: ${{ github.workspace }}
GO111MODULE: off
KO_DOCKER_REPO: kind.local
timeout-minutes: 30
steps:
- name: Set up Go 1.19.x
uses: actions/setup-go@v3
with:
go-version: 1.19.x
- name: Setup ko
uses: imjasonh/[email protected]
- name: Check out code onto GOPATH
uses: actions/checkout@v3
with:
path: ./src/github.com/${{ github.repository }}
- name: Setup KinD Cluster with VMware sources.
working-directory: ./src/github.com/${{ github.repository }}
env:
KIND_VERSION: v0.16.0
run: |
set -x
curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64
chmod +x ./kind
sudo mv kind /usr/local/bin
# KinD configuration.
cat > kind.yaml <<EOF
apiVersion: kind.x-k8s.io/v1alpha4
kind: Cluster
nodes:
- role: control-plane
- role: worker
EOF
# Create a cluster!
kind create cluster --config kind.yaml
# Build and Publish our test images to the docker daemon.
./test/upload-test-images.sh
# Build and Publish our containers to the docker daemon (including test assets)
export GO111MODULE=on
export GOFLAGS=-mod=vendor
ko apply -PRf config/
# webhook readiness probe can take some time to enter ready state
kubectl -n vmware-sources wait --timeout=3m --for=condition=Available deploy/vsphere-source-webhook
- name: Build vcsim image
working-directory: ./src/github.com/${{ github.repository }}
run: |
export GO111MODULE=on
echo "VCSIM_IMAGE=$(ko publish -B github.com/vmware/govmomi/vcsim)" >> $GITHUB_ENV
- name: Run E2E tests
working-directory: ./src/github.com/${{ github.repository }}
run: |
set -x
# For logstream to work.
export SYSTEM_NAMESPACE=vmware-sources
# Run the tests tagged as e2e on the KinD cluster.
go test -v -race -timeout=10m -tags=e2e github.com/${{ github.repository }}/test/e2e/...
- name: Debug
if: ${{ always() }}
run: |
kubectl get pods --all-namespaces
kubectl -n vmware-sources describe pods
kubectl -n vmware-sources get events
- name: Collect diagnostics
uses: chainguard-dev/actions/kind-diag@main
# Only upload logs on failure.
if: ${{ failure() }}
with:
cluster-resources: nodes
namespace-resources: pods,svc
artifact-name: logs
plugins:
name: kn plugins
runs-on: ubuntu-latest
env:
KO_DOCKER_REPO: kind.local
KIND_CLUSTER_NAME: plugins
timeout-minutes: 10
steps:
- name: Set up Go 1.19.x
uses: actions/setup-go@v3
with:
go-version: 1.19.x
- name: Setup ko
uses: imjasonh/[email protected]
- name: Check out code
uses: actions/checkout@v3
- name: Setup KinD Cluster
env:
KIND_VERSION: v0.16.0
run: |
set -x
curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64
chmod +x ./kind
sudo mv kind /usr/local/bin
# Create cluster with defaults
kind create cluster
- name: Deploy vcsim
run: |
ko apply -PRf test/config
kubectl wait --timeout=1m --for=condition=Available deploy/vcsim
kubectl port-forward deploy/vcsim 8989:8989 &
- name: Build plugins
run: |
go build -o kn-vsphere ./plugins/vsphere/cmd/vsphere
- name: Test plugin
run: |
./kn-vsphere auth create --name vsphere-credentials --username user --password pass --verify-url 127.0.0.1:8989 --verify-insecure=true
kubectl get secret vsphere-credentials # assert exists