-
Notifications
You must be signed in to change notification settings - Fork 15
197 lines (196 loc) · 7.39 KB
/
pr.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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
name: PR
on: pull_request
jobs:
end2end:
name: End To End
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ingressVersion:
- "" # uses makefile default (stable version)
isUpgrade:
- false
k8sVersion:
- v1.28.0
- v1.27.3
- v1.26.6
- v1.25.11
- v1.24.15
include:
- isUpgrade: true
k8sVersion: v1.25.11
ref: main
- ingressVersion: controller-v1.2.1
k8sVersion: v1.25.11
timeout-minutes: 20
defaults:
run:
shell: bash -ex -o pipefail {0}
working-directory: ./src/github.com/${{ github.repository }}
env:
GOPATH: ${{ github.workspace }}
KONK_NAMESPACE: baz
PRINT_DEBUG: |
set +x
while read cmd
do
echo "::group::$cmd"
$cmd
echo "::endgroup::"
done <<< "git diff
helm list --all-namespaces
kubectl describe po,ing,certificate,clusterissuer,issuer,konk,konkservice -A
kubectl get po,rs,svc,ep,certificate,clusterissuer,issuer,ingress,secrets,configmap -A
kubectl logs -l app.kubernetes.io/name=etcd -n $KONK_NAMESPACE
kubectl logs -l app.kubernetes.io/component=apiserver -n $KONK_NAMESPACE
kubectl logs -l app.kubernetes.io/name=konk-operator
kubectl logs -l app.kubernetes.io/component=controller,app.kubernetes.io/name=example-apiserver
kubectl logs -l app.kubernetes.io/component=apiserver,app.kubernetes.io/name=example-apiserver -c example-apiserver
kubectl logs -l app.kubernetes.io/component=controller -n ingress-nginx"
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
path: ./src/github.com/${{ github.repository }}
ref: ${{ matrix.ref }}
- name: Cache Go modules
uses: actions/cache@v3
with:
path: |
~/go/pkg/mod
${{ github.workspace }}/pkg/mod
key: ${{ runner.os }}-go-${{ matrix.isUpgrade }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- uses: satackey/[email protected]
continue-on-error: true
- name: Fetch tags
run: |
git fetch --prune --unshallow
- name: Free space by removing unnecessary files
run: |
sudo rm -rf /usr/local/lib/android
- name: ingress version
if: ${{ ! matrix.ingressVersion }}
run: |
echo "ingress_version=$(
curl -sS --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' https://api.github.com/repos/kubernetes/ingress-nginx/releases | jq '[.[] | select(.draft==false and .prerelease==false and (.tag_name | startswith("controller-"))) | .tag_name][0]' -r
)" >> $GITHUB_ENV
- name: Helm Lint
run: |
mkdir -p ~/.kube
make helm-lint
- uses: helm/[email protected]
timeout-minutes: 5
with:
config: ./src/github.com/${{ github.repository }}/test/kind.yaml
node_image: kindest/node:${{ matrix.k8sVersion }}
- name: Deploy charts
timeout-minutes: 2
run: |
kubectl cluster-info
make deploy-cert-manager deploy-ingress-nginx INGRESS_VERSION=${{ matrix.ingressVersion || env.ingress_version }}
- name: Install konk-operator
if: ${{ matrix.isUpgrade }}
timeout-minutes: 6
run: |
make kind-load-konk KIND_NAME="chart-testing"
make deploy-konk-operator
kubectl create ns $KONK_NAMESPACE || true
kubectl create -n $KONK_NAMESPACE -f examples/konk.yaml
until kubectl wait -n $KONK_NAMESPACE --timeout=3m --for=condition=ready pod -l app.kubernetes.io/component=apiserver,app.kubernetes.io/name=konk
do
sleep 1
done
- name: Checkout code
if: ${{ matrix.isUpgrade }}
uses: actions/checkout@v4
with:
path: ./src/github.com/${{ github.repository }}
- name: Fetch tags
if: ${{ matrix.isUpgrade }}
run: |
git fetch --prune --unshallow
- name: Install/Upgrade konk-operator
timeout-minutes: 3
run: |
make kind-load-konk KIND_NAME="chart-testing"
make deploy-crds deploy-konk-operator
- name: Test Konk
timeout-minutes: 6
run: |
kubectl create ns $KONK_NAMESPACE || true
kubectl apply -n $KONK_NAMESPACE -f examples/konk.yaml
# FIXME: use the helm-operator status to detect installation was successful
until kubectl wait -n $KONK_NAMESPACE --timeout=3m --for=condition=ready pod -l app.kubernetes.io/name=etcd
do
sleep 1
done
until kubectl wait -n $KONK_NAMESPACE --timeout=3m --for=condition=ready pod -l app.kubernetes.io/component=apiserver,app.kubernetes.io/name=konk
do
sleep 1
done
make test-konk KONK_NAMESPACE=$KONK_NAMESPACE
make test-konk-local
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: 1.15.x
- name: Build Extension APIServer
timeout-minutes: 7
run: |
make kind-load-apiserver KIND_NAME="chart-testing"
- name: Deploy Extension APIServer
timeout-minutes: 4
run: |
# deploy example-apiserver using a passed KONK reference
make deploy-example-apiserver KIND_NAME="chart-testing" \
HELM_FLAGS="--set=konk.name=runner-konk --set=konk.namespace=$KONK_NAMESPACE --set=konk.create=false --set=image.pullPolicy=IfNotPresent"
POD_NAME=$(kubectl get pod -o name -l app.kubernetes.io/name=konk-service,app.kubernetes.io/component=apiservice )
until kubectl exec -it $POD_NAME -- kubectl get contact
do
kubectl exec -it $POD_NAME -- kubectl describe apiservice v1alpha1.example.infoblox.com
sleep 3
done
- name: Test Extension APIServer
run: |
make test-apiserver
# Test konkservice deployed
make test-apiserver-konk-service
kubectl wait --timeout=1m --for=condition=ready pod -l app.kubernetes.io/name=konk-service,app.kubernetes.io/component=apiservice-test
- name: Test ingress
timeout-minutes: 1
run: |
kubectl -n ingress-nginx logs -l app.kubernetes.io/component=controller --tail 0 -f &
until kubectl -s localhost:80 get contacts
do
sleep 3
done
- name: Print debug
if: ${{ always() }}
run: bash -c "$PRINT_DEBUG"
- name: Test delete
timeout-minutes: 3
run: |
helm list --all-namespaces
kubectl delete konks,konkservices --all --all-namespaces
[ -z "$(helm list --all-namespaces --filter '^runner-.*konk(-service)?$' | tee /dev/stderr | grep konk)" ]
- name: Print debug
if: ${{ always() }}
run: bash -c "$PRINT_DEBUG"
readme:
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- run: make chart-readmes
- name: commit changes
uses: EndBug/add-and-commit@v9
with:
message: update chart readme
add: helm-charts
push: origin HEAD:${{ github.head_ref }}