forked from knative-extensions/net-istio
-
Notifications
You must be signed in to change notification settings - Fork 0
154 lines (123 loc) · 4.92 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
152
153
154
name: e2e
on:
pull_request:
branches: [ 'main', 'release-*' ]
push:
branches: [ 'main', 'release-*' ]
defaults:
run:
shell: bash
working-directory: ./src/knative.dev/net-istio
jobs:
test:
name: test
runs-on: ubuntu-latest
strategy:
fail-fast: false # Keep running if one leg fails.
matrix:
k8s-version:
- v1.26.x
- v1.27.x
- v1.28.x
test-suite:
- ./test/conformance
- ./test/e2e
istio-version:
- latest
encryption:
- disabled
- system-internal-tls
istio-profile:
- no-mesh
- ambient
env:
GOPATH: ${{ github.workspace }}
KO_DOCKER_REPO: kind.local
# Use a semi-random cluster suffix, but somewhat predictable
# so reruns don't just give us a completely new value.
CLUSTER_SUFFIX: c${{ github.run_id }}.local
steps:
- name: Set up Go 1.21.x
uses: actions/setup-go@v3
with:
go-version: 1.21.x
- name: Install Dependencies
working-directory: ./
run: |
echo '::group:: install ko'
curl -L https://github.com/google/ko/releases/download/v0.12.0/ko_0.12.0_Linux_x86_64.tar.gz | tar xzf - ko
chmod +x ./ko
sudo mv ko /usr/local/bin
echo '::endgroup::'
- name: Check out code onto GOPATH
uses: actions/checkout@v3
with:
path: ./src/knative.dev/net-istio
- name: Create KinD Cluster
uses: chainguard-dev/actions/setup-kind@main
id: kind
with:
k8s-version: ${{ matrix.k8s-version }}
kind-worker-count: 1
cluster-suffix: "${CLUSTER_SUFFIX}"
- name: Install Knative net-istio
run: |
set -o pipefail
# Replace cluster.local with random suffix.
sed -ie "s/cluster\.local/${CLUSTER_SUFFIX}/g" third_party/istio-${{ matrix.istio-version }}/istio-kind-${{ matrix.istio-profile }}/istio.yaml
# Deploy Istio
./third_party/istio-${{ matrix.istio-version }}/install-istio.sh istio-kind-${{ matrix.istio-profile }}
# Build and Publish our containers to the docker daemon (including test assets)
ko resolve --platform=linux/amd64 -f test/config/ -f config/ | kubectl apply -f -
CONFIG_ISTIO="./third_party/istio-${{ matrix.istio-version }}/istio-kind-${{ matrix.istio-profile }}/config-istio.yaml"
if [[ -f "${CONFIG_ISTIO}" ]]; then
kubectl apply -f "${CONFIG_ISTIO}"
fi
echo "GATEWAY_NAMESPACE_OVERRIDE=istio-system" >> $GITHUB_ENV
- name: Generate certificates and enable system-internal-tls
if: matrix.encryption == 'system-internal-tls' && matrix.istio-profile == 'no-mesh'
run: |
set -o pipefail
echo ">> Deploy certificate for upstream traffic"
./test/generate-upstream-cert.sh
echo ">> Setting environment variables for upstream tls"
echo "UPSTREAM_TLS_CERT=serving-certs" >> $GITHUB_ENV
echo "SERVER_NAME=kn-user-serving-tests" >> $GITHUB_ENV
echo ">> Enabling system-internal-tls in config-network"
kubectl apply -f test/config/system-internal-tls
- name: Upload Test Images
run: |
# Build and Publish our test images to the docker daemon.
./test/upload-test-images.sh
- name: Wait for Ready
run: |
echo Waiting for Pods to become ready.
# # TODO: Find a good way to do this with chaos enabled.
# kubectl wait pod --for=condition=Ready -n knative-serving -l '!job-name'
kubectl wait pod --for=condition=Ready -n ${GATEWAY_NAMESPACE_OVERRIDE} -l '!job-name'
# For debugging.
kubectl get pods --all-namespaces
- name: Run e2e Tests
run: |
set -x
# Exclude the control-plane node, which doesn't seem to expose the nodeport service.
IPS=( $(kubectl get nodes -lkubernetes.io/hostname!=kind-control-plane -ojsonpath='{.items[*].status.addresses[?(@.type=="InternalIP")].address}') )
# Run the tests tagged as e2e on the KinD cluster.
go test -race -count=1 -short -timeout=20m -tags=e2e ${{ matrix.test-suite }} \
--enable-alpha --enable-beta \
--ingressendpoint="${IPS[0]}" \
--ingressClass=istio.ingress.networking.knative.dev \
--cluster-suffix=$CLUSTER_SUFFIX
- name: Post failure notice to Slack
uses: rtCamp/action-slack-notify@v2.1.0
if: ${{ failure() && github.event_name != 'pull_request' }}
env:
SLACK_ICON: http://github.com/knative.png?size=48
SLACK_USERNAME: github-actions
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_CHANNEL: 'net-istio'
SLACK_COLOR: '#8E1600'
MSG_MINIMAL: 'true'
SLACK_TITLE: Periodic ${{ matrix.k8s-version }} failed.
SLACK_MESSAGE: |
For detailed logs: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}