-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
550 lines (452 loc) · 22 KB
/
Copy pathMakefile
File metadata and controls
550 lines (452 loc) · 22 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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
VERSION := $(shell cat .version)
CHART_VERSION := $(shell cat .version | sed 's/^v//')
# Single source of truth: charts/varnish-gateway/values.yaml.
VARNISH_VERSION := $(shell awk -F'"' '/^ varnishVersion:/{print $$2; exit}' charts/varnish-gateway/values.yaml)
REGISTRY ?= ghcr.io/varnish
OPERATOR_IMAGE := $(REGISTRY)/gateway-operator
CHAPERONE_IMAGE := $(REGISTRY)/gateway-chaperone
.PHONY: help test build build-linux docker clean vendor act
.PHONY: build-go test-go test-envtest envtest install-envtest build-ghost test-ghost
.PHONY: helm-lint helm-template helm-test
.PHONY: test-conformance test-conformance-report test-conformance-single
.PHONY: kind-create kind-delete kind-load kind-deploy test-conformance-kind
.PHONY: manifests generate verify-manifests
.PHONY: docs-venv docs-serve docs-build docs-clean
.PHONY: fmt fmt-check vet staticcheck nilaway vuln lint
help:
@echo "Varnish Gateway Operator - Makefile targets"
@echo ""
@echo "Go targets:"
@echo " make build-go Build Go binaries for current platform"
@echo " make test-go Run Go tests (includes envtest)"
@echo " make test-envtest Run only envtest integration tests"
@echo " make envtest Setup envtest binaries (kube-apiserver, etcd)"
@echo " make build-linux Build Linux Go binaries for amd64 and arm64"
@echo ""
@echo "Rust targets:"
@echo " make build-ghost Build Ghost VMOD (requires Rust toolchain)"
@echo " make test-ghost Run Ghost tests"
@echo ""
@echo "Combined targets:"
@echo " make build Build all (Go + Ghost)"
@echo " make test Run all tests"
@echo ""
@echo "Docker targets:"
@echo " make docker Build all Docker images for current arch"
@echo " make docker-operator Build operator image"
@echo " make docker-chaperone Build chaperone image"
@echo ""
@echo "CI/Testing:"
@echo " make act Run CI workflow locally with act (requires act tool)"
@echo ""
@echo "Conformance:"
@echo " make test-conformance Run all conformance tests (requires live cluster)"
@echo " make test-conformance-report Run conformance tests and generate report"
@echo " make test-conformance-single TEST=TestShortName Run a single conformance test"
@echo " make test-conformance-kind Full cycle: kind cluster, build, deploy, test, teardown"
@echo ""
@echo "Kind cluster:"
@echo " make kind-create Create kind cluster and install Gateway API CRDs"
@echo " make kind-delete Delete kind cluster"
@echo " make kind-load Load Docker images into kind cluster"
@echo " make kind-deploy Deploy operator to kind cluster"
@echo ""
@echo "Deploy:"
@echo " make deploy-update Update deploy/ manifests with current version"
@echo " make deploy Update manifests and apply to cluster"
@echo ""
@echo "Helm:"
@echo " make helm-lint Lint Helm chart"
@echo " make helm-template Template Helm chart (dry-run)"
@echo ""
@echo "Code generation:"
@echo " make manifests Generate CRD manifests from Go types (controller-gen)"
@echo " make generate Generate deepcopy functions (controller-gen)"
@echo " make verify-manifests Verify generated files are up-to-date"
@echo ""
@echo "Docs site (MkDocs Material):"
@echo " make docs-serve Live-reload dev server at http://127.0.0.1:8000"
@echo " make docs-build Build static site into _site/ (strict mode)"
@echo " make docs-clean Remove _site/ and the docs virtualenv"
@echo ""
@echo "Static analysis:"
@echo " make fmt Reformat all non-vendor Go files with gofmt"
@echo " make fmt-check Fail if any non-vendor Go file is not gofmt-clean"
@echo " make vet Run go vet"
@echo " make staticcheck Run staticcheck"
@echo " make nilaway Run nilaway (nil-deref analyzer)"
@echo " make vuln Run govulncheck (CVE scanner)"
@echo " make lint Run fmt-check + vet + staticcheck + nilaway + vuln"
@echo ""
@echo "Other:"
@echo " make vendor Update Go vendor directory"
@echo " make clean Remove build artifacts"
@echo ""
@echo "Configuration:"
@echo " VERSION=$(VERSION)"
@echo " REGISTRY=$(REGISTRY)"
# ============================================================================
# Combined targets
# ============================================================================
build: build-go build-ghost
test: test-go test-ghost
# ============================================================================
# Go targets
# ============================================================================
build-go: dist/operator dist/chaperone
# EnvTest Configuration
ENVTEST_K8S_VERSION = 1.31.0
ENVTEST := $(shell pwd)/bin/setup-envtest
ENVTEST_ASSETS_DIR := $(shell pwd)/testbin
# Install setup-envtest tool
install-envtest:
@mkdir -p bin
GOBIN=$(shell pwd)/bin go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
# Download and setup envtest binaries (kube-apiserver, etcd)
envtest: install-envtest
@mkdir -p $(ENVTEST_ASSETS_DIR)
$(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(ENVTEST_ASSETS_DIR) -p path
# Run only envtest-based integration tests
test-envtest: envtest
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(ENVTEST_ASSETS_DIR) -p path)" \
go test -v -tags=integration ./internal/controller/...
test-go: envtest
go vet ./...
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(ENVTEST_ASSETS_DIR) -p path)" \
go test -tags=integration ./...
# ============================================================================
# Static analysis
# ============================================================================
# Tools are installed on demand into ./bin (same pattern as setup-envtest).
# Pin versions here so CI and local runs agree.
STATICCHECK_VERSION := 2025.1.1
NILAWAY_VERSION := latest
GOVULNCHECK_VERSION := latest
STATICCHECK := $(shell pwd)/bin/staticcheck
NILAWAY := $(shell pwd)/bin/nilaway
GOVULNCHECK := $(shell pwd)/bin/govulncheck
$(STATICCHECK):
@mkdir -p bin
GOBIN=$(shell pwd)/bin go install honnef.co/go/tools/cmd/staticcheck@$(STATICCHECK_VERSION)
$(NILAWAY):
@mkdir -p bin
GOBIN=$(shell pwd)/bin go install go.uber.org/nilaway/cmd/nilaway@$(NILAWAY_VERSION)
$(GOVULNCHECK):
@mkdir -p bin
GOBIN=$(shell pwd)/bin go install golang.org/x/vuln/cmd/govulncheck@$(GOVULNCHECK_VERSION)
# gofmt — reformat all first-party Go files. `go list` excludes vendor/.
fmt:
gofmt -w $(shell go list -f '{{.Dir}}' ./...)
# gofmt gate — fail (non-zero exit) if any first-party Go file is not
# gofmt-clean. `go list` excludes vendor/ automatically. Run `make fmt` to fix.
fmt-check:
@unformatted=$$(gofmt -l $(shell go list -f '{{.Dir}}' ./...)); \
if [ -n "$$unformatted" ]; then \
echo "Not gofmt-clean (run 'make fmt'):"; \
echo "$$unformatted"; \
exit 1; \
fi
# `go vet` — fast, low-noise correctness checks shipped with the toolchain.
vet:
go vet ./...
# staticcheck — broader correctness/style checks (SA, S, ST series).
staticcheck: $(STATICCHECK)
$(STATICCHECK) ./...
# nilaway — Uber's nil-deref analyzer. We don't use `-include-pkgs` because
# it would also drop findings whose nil *source* is in k8s code (e.g.
# DeepCopy() returning nil) even when the dereference is in our code. Instead
# we keep full analysis and grep-filter findings located in vendor/.
nilaway: $(NILAWAY)
@$(NILAWAY) ./... 2>&1 | grep -v "^/.*/vendor/" || true
# govulncheck — scans for known CVEs in module dependencies that are
# reachable from our code. Run on releases at minimum.
vuln: $(GOVULNCHECK)
$(GOVULNCHECK) ./...
# Aggregate target. `fmt-check` and `vet` first because they're the cheapest.
lint: fmt-check vet staticcheck nilaway vuln
dist/operator:
@mkdir -p dist
go build -mod=vendor -o dist/operator ./cmd/operator
dist/chaperone:
@mkdir -p dist
go build -mod=vendor -o dist/chaperone ./cmd/chaperone
# Build Linux binaries for both architectures
build-linux: build-linux-amd64 build-linux-arm64
build-linux-amd64: dist/operator-linux-amd64 dist/chaperone-linux-amd64
dist/operator-linux-amd64:
@mkdir -p dist
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -mod=vendor -o dist/operator-linux-amd64 ./cmd/operator
dist/chaperone-linux-amd64:
@mkdir -p dist
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -mod=vendor -o dist/chaperone-linux-amd64 ./cmd/chaperone
build-linux-arm64: dist/operator-linux-arm64 dist/chaperone-linux-arm64
dist/operator-linux-arm64:
@mkdir -p dist
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -mod=vendor -o dist/operator-linux-arm64 ./cmd/operator
dist/chaperone-linux-arm64:
@mkdir -p dist
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -mod=vendor -o dist/chaperone-linux-arm64 ./cmd/chaperone
# ============================================================================
# Rust/Ghost targets
# ============================================================================
build-ghost:
cd ghost && cargo build --release
test-ghost:
cd ghost && cargo clippy --release -- -D warnings
cd ghost && cargo build --release
cd ghost && LD_LIBRARY_PATH=$$(pwd)/target/release cargo test --release --lib
cd ghost && LD_LIBRARY_PATH=$$(pwd)/target/release VARNISHTEST_DURATION=8s cargo test --release run_vtc_tests
# ============================================================================
# Docker images
# ============================================================================
docker: docker-operator docker-chaperone
docker-operator:
docker build -t $(OPERATOR_IMAGE):$(VERSION) -f docker/operator.Dockerfile .
docker tag $(OPERATOR_IMAGE):$(VERSION) $(OPERATOR_IMAGE):latest
docker-chaperone:
docker build --build-arg VARNISH_VERSION=$(VARNISH_VERSION) -t $(CHAPERONE_IMAGE):$(VERSION) -f docker/chaperone.Dockerfile .
docker tag $(CHAPERONE_IMAGE):$(VERSION) $(CHAPERONE_IMAGE):latest
# ============================================================================
# Load / correctness testing (test/load)
# ============================================================================
ECHO_IMAGE := $(REGISTRY)/gateway-echo
COLLECTOR_IMAGE := $(REGISTRY)/gateway-ledger-collector
LOAD_NS ?= varnish-load
GATEWAY_URL ?= http://127.0.0.1:8080
COLLECTOR_URL ?= http://127.0.0.1:9090
K6_RPS ?= 50
K6_DURATION ?= 1m
K6_VUS ?= 10
.PHONY: load-build load-docker load-up load-down load-run load-analyze load-download load-up-large load-down-large
# Large-fixture knobs (used by load-up-large).
LARGE_VHOSTS ?= 50
LARGE_PATHS ?= 10
load-build:
CGO_ENABLED=0 go build -mod=vendor -o dist/load-echo ./test/load/echo
CGO_ENABLED=0 go build -mod=vendor -o dist/load-collector ./test/load/collector
CGO_ENABLED=0 go build -mod=vendor -o dist/load-analyze ./test/load/analyze
load-docker:
docker build -t $(ECHO_IMAGE):$(VERSION) -f test/load/echo/Dockerfile .
docker tag $(ECHO_IMAGE):$(VERSION) $(ECHO_IMAGE):latest
docker build -t $(COLLECTOR_IMAGE):$(VERSION) -f test/load/collector/Dockerfile .
docker tag $(COLLECTOR_IMAGE):$(VERSION) $(COLLECTOR_IMAGE):latest
load-up:
kubectl apply -f test/load/deploy/echo.yaml
kubectl apply -f test/load/deploy/collector.yaml
kubectl apply -f test/load/fixtures/routes.yaml
kubectl -n $(LOAD_NS) rollout status deploy/ledger-collector --timeout=2m
kubectl -n $(LOAD_NS) rollout status deploy/echo-a --timeout=2m
kubectl -n $(LOAD_NS) rollout status deploy/echo-b --timeout=2m
load-down:
kubectl delete -f test/load/fixtures/routes.yaml --ignore-not-found
kubectl delete -f test/load/deploy/echo.yaml --ignore-not-found
kubectl delete -f test/load/deploy/collector.yaml --ignore-not-found
# Generate and apply a large HTTPRoute fixture for C02/C03 at scale.
# Layers on top of load-up (which creates the Gateway); the generator
# emits HTTPRoutes only by default, so run load-up first.
# make load-up-large LARGE_VHOSTS=100 LARGE_PATHS=20 -> 2000 routes
load-up-large:
go run ./test/load/fixtures/gen \
-out test/load/fixtures/generated \
-vhosts $(LARGE_VHOSTS) -paths $(LARGE_PATHS) \
-ns $(LOAD_NS)
kubectl apply -f test/load/fixtures/generated/routes.yaml
kubectl -n $(LOAD_NS) create configmap k6-routes \
--from-file=routes.json=test/load/fixtures/generated/routes.json \
--dry-run=client -o yaml | kubectl apply -f -
load-down-large:
kubectl -n $(LOAD_NS) delete httproute -l fixture=generated --ignore-not-found
kubectl -n $(LOAD_NS) delete configmap k6-routes --ignore-not-found
# Run k6. Expects GATEWAY_URL and COLLECTOR_URL reachable from the host
# (typically via kubectl port-forward).
load-run:
k6 run \
-e GATEWAY_URL=$(GATEWAY_URL) \
-e COLLECTOR_URL=$(COLLECTOR_URL) \
-e RPS=$(K6_RPS) -e DURATION=$(K6_DURATION) -e VUS=$(K6_VUS) \
test/load/k6/run.js
load-download:
curl -fsS $(COLLECTOR_URL)/download -o dist/ledger.ndjson
@echo "wrote dist/ledger.ndjson ($$(wc -l < dist/ledger.ndjson) lines)"
load-analyze: load-download
go run ./test/load/analyze -f dist/ledger.ndjson
# ============================================================================
# Chaos scenarios (requires Chaos Mesh + load suite up)
# ============================================================================
.PHONY: chaos-run chaos-suite chaos-kind-setup chaos-kind-teardown
# Usage: make chaos-run SCENARIO=C01
# Traffic is generated in-cluster; no GATEWAY_URL / COLLECTOR_URL required.
chaos-run:
@test -n "$(SCENARIO)" || (echo "SCENARIO=<id> required (e.g. C01)"; exit 2)
./test/chaos/run.sh $(SCENARIO)
# Run the full chaos suite unattended. Pass-through flags via CHAOS_ARGS:
# make chaos-suite CHAOS_ARGS="--scenarios C01,C04 --bail"
chaos-suite:
./test/chaos/suite.sh $(CHAOS_ARGS)
chaos-kind-setup:
./test/chaos/kind-setup.sh
chaos-kind-teardown:
./test/chaos/kind-setup.sh teardown
# ============================================================================
# CI/Testing
# ============================================================================
# Run CI workflow locally using act (https://github.com/nektos/act)
# Requires: act tool installed (go install github.com/nektos/act@latest)
act:
act -W .github/workflows/ci.yml push -P ubuntu-latest=catthehacker/ubuntu:act-latest
# ============================================================================
# Gateway API Conformance Tests (requires live cluster with operator deployed)
# ============================================================================
CONFORMANCE_IMPL_FLAGS = \
--gateway-class=varnish \
--organization="Varnish Software AS" \
--project="Varnish Gateway" \
--url=https://gateway.varnish.org \
--version=$(VERSION) \
--contact=@perbu
test-conformance:
go test -tags=conformance -v -timeout 600s -count=1 ./conformance/ \
-args $(CONFORMANCE_IMPL_FLAGS)
test-conformance-report:
@mkdir -p $(CURDIR)/dist
go test -tags=conformance -v -timeout 600s -count=1 ./conformance/ \
-args $(CONFORMANCE_IMPL_FLAGS) \
--report-output=$(CURDIR)/dist/conformance-report.yaml
test-conformance-single:
ifndef TEST
$(error TEST is required. Usage: make test-conformance-single TEST=HTTPRouteMethodMatching)
endif
go test -tags=conformance -v -timeout 600s -count=1 ./conformance/ \
-args $(CONFORMANCE_IMPL_FLAGS) --run-test=$(TEST)
# ============================================================================
# Kind cluster for conformance testing
# ============================================================================
GATEWAY_API_VERSION ?= v1.5.0
KIND_CLUSTER_NAME ?= varnish-gw
KIND := go tool kind
kind-create:
$(KIND) create cluster --name $(KIND_CLUSTER_NAME) --wait 60s
kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/download/$(GATEWAY_API_VERSION)/standard-install.yaml
./docs/development/kind-metallb.sh
kind-delete:
-$(KIND) delete cluster --name $(KIND_CLUSTER_NAME)
@# Force-remove any containers still labeled for this cluster (kind crashed mid-create, etc.).
@stale=$$(docker ps -aq --filter "label=io.x-k8s.kind.cluster=$(KIND_CLUSTER_NAME)"); \
if [ -n "$$stale" ]; then echo "Removing stale kind containers: $$stale"; docker rm -f -v $$stale; fi
@# Drop volumes labeled for this cluster.
@vols=$$(docker volume ls -q --filter "label=io.x-k8s.kind.cluster=$(KIND_CLUSTER_NAME)"); \
if [ -n "$$vols" ]; then echo "Removing stale kind volumes: $$vols"; docker volume rm $$vols; fi
@# Remove the shared kind bridge network only if no other kind clusters remain.
@if [ -z "$$($(KIND) get clusters 2>/dev/null)" ] && docker network inspect kind >/dev/null 2>&1; then \
echo "Removing kind docker network"; docker network rm kind >/dev/null || true; \
fi
kind-load:
$(KIND) load docker-image $(OPERATOR_IMAGE):$(VERSION) --name $(KIND_CLUSTER_NAME)
$(KIND) load docker-image $(CHAPERONE_IMAGE):$(VERSION) --name $(KIND_CLUSTER_NAME)
kind-deploy: deploy-update
kubectl apply -f deploy/00-prereqs.yaml
kubectl wait --for=condition=Established crd/gatewayclassparameters.gateway.varnish-software.com --timeout=30s
kubectl apply -f deploy/01-operator.yaml -f deploy/02-chaperone-rbac.yaml -f deploy/03-gatewayclass.yaml
kubectl rollout status deployment/varnish-gateway-operator -n varnish-gateway-system --timeout=120s
test-conformance-kind: KIND_VERSION = kind
test-conformance-kind:
$(MAKE) kind-create
$(MAKE) docker VERSION=$(KIND_VERSION)
$(MAKE) kind-load VERSION=$(KIND_VERSION)
$(MAKE) kind-deploy VERSION=$(KIND_VERSION)
$(MAKE) test-conformance-report; rc=$$?; $(MAKE) kind-delete; exit $$rc
# ============================================================================
# Deploy
# ============================================================================
deploy-update:
@echo "Updating deploy/01-operator.yaml to version $(VERSION)"
@perl -pi -e 's|gateway-operator:[a-zA-Z0-9._-]+|gateway-operator:$(VERSION)|g; s|gateway-chaperone:[a-zA-Z0-9._-]+|gateway-chaperone:$(VERSION)|g' deploy/01-operator.yaml
deploy: deploy-update
kubectl apply -f deploy/00-prereqs.yaml -f deploy/01-operator.yaml -f deploy/02-chaperone-rbac.yaml -f deploy/03-gatewayclass.yaml
dev-deploy:
$(MAKE) docker VERSION=dev
$(MAKE) deploy VERSION=dev
kubectl rollout restart deployment/varnish-gateway-operator -n varnish-gateway-system
@if kubectl get deployment/varnish-gateway -n varnish-gateway-system >/dev/null 2>&1; then \
kubectl rollout restart deployment/varnish-gateway -n varnish-gateway-system; \
fi
# ============================================================================
# Helm
# ============================================================================
CHART_PATH := charts/varnish-gateway
RELEASE_NAME ?= varnish-gateway
helm-lint:
helm lint $(CHART_PATH)
helm-template:
helm template $(RELEASE_NAME) $(CHART_PATH) --debug
# Render the chart against every fixture in test/fixtures/values-*.yaml.
# Catches nil-pointer regressions from new top-level value keys (mirrors the
# `--reuse-values` failure mode that broke the 0.18.5 → 0.20.0 upgrade).
helm-test: helm-lint
@helm template $(RELEASE_NAME) $(CHART_PATH) >/dev/null
@for f in $(CHART_PATH)/test/fixtures/values-*.yaml; do \
echo "==> rendering against $$f"; \
helm template $(RELEASE_NAME) $(CHART_PATH) -f $$f >/dev/null || exit 1; \
done
@echo "All chart fixture renders OK."
# ============================================================================
# Code generation (controller-gen)
# ============================================================================
CONTROLLER_GEN = go tool controller-gen
# Generate CRD manifests from Go types into Helm chart, then assemble deploy/00-prereqs.yaml
manifests:
$(CONTROLLER_GEN) crd paths="./api/..." output:crd:artifacts:config=charts/varnish-gateway/crds
@echo "Assembling deploy/00-prereqs.yaml..."
@printf '# Namespace for varnish-gateway operator\napiVersion: v1\nkind: Namespace\nmetadata:\n name: varnish-gateway-system\n labels:\n app.kubernetes.io/name: varnish-gateway\n app.kubernetes.io/component: operator\n' > deploy/00-prereqs.yaml
@echo "---" >> deploy/00-prereqs.yaml
@cat charts/varnish-gateway/crds/gateway.varnish-software.com_gatewayclassparameters.yaml >> deploy/00-prereqs.yaml
@echo "---" >> deploy/00-prereqs.yaml
@cat charts/varnish-gateway/crds/gateway.varnish-software.com_varnishcachepolicies.yaml >> deploy/00-prereqs.yaml
@echo "---" >> deploy/00-prereqs.yaml
@cat charts/varnish-gateway/crds/gateway.varnish-software.com_varnishcacheinvalidations.yaml >> deploy/00-prereqs.yaml
# Generate deepcopy functions from Go types
generate:
$(CONTROLLER_GEN) object paths="./api/..."
# Verify generated files are up-to-date (for CI)
verify-manifests: manifests generate
@if [ -n "$$(git diff --name-only)" ]; then \
echo "ERROR: Generated files are out of date. Run 'make manifests generate' and commit the changes."; \
git diff --name-only; \
exit 1; \
fi
# ============================================================================
# Docs site (MkDocs Material)
# ============================================================================
DOCS_VENV := .venv-docs
DOCS_PY := $(DOCS_VENV)/bin/python
DOCS_PIP := $(DOCS_VENV)/bin/pip
MKDOCS := $(DOCS_VENV)/bin/mkdocs
# Create the virtualenv and install pinned deps. Re-runs when
# requirements-docs.txt changes.
$(DOCS_VENV)/.stamp: requirements-docs.txt
@python3 -m venv $(DOCS_VENV)
@$(DOCS_PIP) install --quiet --upgrade pip
@$(DOCS_PIP) install --quiet -r requirements-docs.txt
@touch $@
docs-venv: $(DOCS_VENV)/.stamp
# Sync the version badge in the hero with .version before building/serving.
# Uses a temp mkdocs config so the source file stays stable in git.
docs-serve: docs-venv
@VG_VERSION=$(VERSION) $(MKDOCS) serve --dev-addr 127.0.0.1:8000 \
--config-file mkdocs.yml
docs-build: docs-venv
@echo "Building docs site for $(VERSION)..."
@perl -pi -e 's|^(\s*version:\s*)v[0-9][^\s]*|$${1}$(VERSION)|' mkdocs.yml
@$(MKDOCS) build --strict --config-file mkdocs.yml
@echo "Built site in _site/"
docs-clean:
rm -rf _site $(DOCS_VENV)
# ============================================================================
# Maintenance
# ============================================================================
vendor:
go mod vendor
clean:
rm -rf dist/ _site/
rm -f operator chaperone
cd ghost && cargo clean