generated from knative-extensions/sample-controller
-
Notifications
You must be signed in to change notification settings - Fork 27
191 lines (157 loc) · 6.44 KB
/
minkind-apply.yaml
File metadata and controls
191 lines (157 loc) · 6.44 KB
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
name: MinKinD Apply E2Es
on:
pull_request:
branches: [ master ]
# schedule:
# - cron: '0 */3 * * *'
defaults:
run:
shell: bash
working-directory: ./src/github.com/mattmoor/mink
jobs:
cli-tests:
name: e2e tests
runs-on: ubuntu-latest
strategy:
fail-fast: false # Keep running if one leg fails.
matrix:
# To cut down on redundant testing, test each suite against a
# particular version of K8s.
include:
- k8s-version: v1.22.x
selfhost-variant: dockerfile
- k8s-version: v1.22.x
selfhost-variant: buildpacks
- k8s-version: v1.23.x
selfhost-variant: ko
env:
GOPATH: ${{ github.workspace }}
GO111MODULE: on
GOFLAGS: -ldflags=-s -ldflags=-w -mod=vendor -tags=nostackdriver
GGCR_EXPERIMENT_ESTARGZ: "1"
KO_DOCKER_REPO: registry.local:5000/knative
GATEWAY_OVERRIDE: kourier
GATEWAY_NAMESPACE_OVERRIDE: mink-system
SYSTEM_NAMESPACE: mink-system
ARTIFACTS: ${{ github.workspace }}/artifacts
steps:
- name: Set up Go 1.17.x
uses: actions/setup-go@v2
with:
go-version: 1.17.x
- name: Install Dependencies
working-directory: ./
run: |
echo '::group:: install ko'
curl -L https://github.com/google/ko/releases/download/v0.8.3/ko_0.8.3_Linux_x86_64.tar.gz | tar xzf - ko
chmod +x ./ko
sudo mv ko /usr/local/bin
echo '::endgroup::'
echo '::group:: install crane'
curl -L https://github.com/google/go-containerregistry/releases/download/v0.1.4/go-containerregistry_Linux_x86_64.tar.gz | tar xzf - crane
chmod +x ./crane
sudo mv crane /usr/local/bin
echo '::endgroup::'
echo '::group:: install yq'
go get github.com/mikefarah/yq/v3
echo '::endgroup::'
echo '::group:: install goimports'
go get golang.org/x/tools/cmd/goimports
echo '::endgroup::'
echo '::group:: install kn'
curl -Lo ./kn https://github.com/knative/client/releases/download/v0.19.0/kn-linux-amd64
chmod +x ./kn
sudo mv kn /usr/local/bin
echo '::endgroup::'
- name: Check out mink
uses: actions/checkout@v3
with:
path: ./src/github.com/mattmoor/mink
- name: Setup Cluster
working-directory: ./src/github.com/mattmoor/mink
run: |
./hack/setup-kind.sh \
--registry-url $(echo ${KO_DOCKER_REPO} | cut -d'/' -f 1) \
--cluster-suffix c${{ github.run_id }}.local \
--nodes 3 \
--k8s-version ${{ matrix.k8s-version }}
- name: Build and Install mink
run: |
./hack/build.sh
# Use mink to install things.
mink install --replicas=3
cat > $HOME/.mink.yaml <<EOF
# Number of concurrent builds to allow.
# We match this to nodes
parallelism: 3
# Bundle source context to here by default!
bundle: ${KO_DOCKER_REPO}/bundle:latest
# Send the resulting image here by default!
image: |
{{ if eq .Scheme "ko" }}
${KO_DOCKER_REPO}/{{ lower (join "ko-images" .Host .Path) }}
{{ else if eq .Scheme "buildpack" }}
${KO_DOCKER_REPO}/{{ lower (join "buildpack-images" .Host .Path) }}
{{ else if eq .Scheme "dockerfile" }}
${KO_DOCKER_REPO}/{{ lower (join "dockerfile-images" .Host .Path) }}
{{ else if eq .Scheme "task" }}
${KO_DOCKER_REPO}/{{ lower (join "task-images" .Host .Path) }}
{{ else if eq .Scheme "pipeline" }}
${KO_DOCKER_REPO}/{{ lower (join "pipeline-images" .Host .Path) }}
{{ else }}
BREAK THINGS
{{ end }}
EOF
# Rebuild a self-hosted mink distributing builds using `ko publish`
- name: mink apply (ko)
if: matrix.selfhost-variant == 'ko'
run: |
kubectl delete jobs -nmink-system --all
# Rebuild and redeploy.
# TODO(mattmoor): Narrowing the scope here because ko asks for resources,
# and nodes keep running out.
mink apply -Rf config/core/deployments/dataplane.yaml
kubectl rollout status -n ${SYSTEM_NAMESPACE} statefulsets/controlplane
kubectl rollout status -n ${SYSTEM_NAMESPACE} daemonsets/dataplane
# Rebuild a self-hosted mink distributing builds using `mink build`
- name: mink apply (dockerfile)
if: matrix.selfhost-variant == 'dockerfile'
run: |
kubectl delete jobs -nmink-system --all
kubectl apply -f examples/kaniko.yaml
# Turn our `ko://` configs into `dockerfile:///` configs with
# references to synthetic Dockerfiles matching what ko does.
./dockerize.sh
# Rebuild and redeploy again.
mink apply -Rf generated/dockerfile/config/core
kubectl rollout status -n ${SYSTEM_NAMESPACE} statefulsets/controlplane
kubectl rollout status -n ${SYSTEM_NAMESPACE} daemonsets/dataplane
- name: mink apply (buildpack)
if: matrix.selfhost-variant == 'buildpacks'
run: |
# TODO(mattmoor): Don't delete these jobs, since we don't conflict with
# (or replace!) them below, and unless this successfully runs, we won't
# pass the smoke test.
# kubectl delete jobs -nmink-system --all
# Turn our `ko://` configs into `buildpack:///` configs.
./buildpackerize.sh
# Rebuild and redeploy again.
# TODO(mattmoor): buildpacks change enough that this is not a particularly good test.
# Lots of assumptions about /ko-app/foo and uid abound, which complicate this translation,
# so scope things to IMC for now.
mink apply -Rf generated/buildpacks/config/in-memory
kubectl rollout status -n ${SYSTEM_NAMESPACE} statefulsets/controlplane
kubectl rollout status -n ${SYSTEM_NAMESPACE} daemonsets/dataplane
# Finally, run a smoke test.
- name: Run smoke test
run: |
kn service create autoscale-go --image=gcr.io/knative-samples/autoscale-go:0.1
# Extract the IP from the xip.io hostname, and put it in /etc/hosts to avoid flakes.
URL="$(kn service describe autoscale-go -o url)"
HOST="$(echo ${URL} | cut -d'/' -f 3)"
IP="$(echo ${HOST} | cut -d'.' -f 3-6)"
sudo echo ${IP} ${HOST} | sudo tee -a /etc/hosts
# Make sure we can curl the sample.
curl "${URL}/?sleep=100"
- uses: chainguard-dev/actions/kind-diag@main
if: ${{ failure() }}