This repository was archived by the owner on Mar 21, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathjustfile
More file actions
102 lines (76 loc) · 4.04 KB
/
Copy pathjustfile
File metadata and controls
102 lines (76 loc) · 4.04 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
set shell := ["bash", "-euo", "pipefail", "-c"]
import "hack/tools.just"
# Print list of available recipes
default:
@just --list
export CGO_ENABLED := "0"
_gotools:
go fmt ./...
go vet {{go_flags}} ./...
# Called in CI
_lint: _license_headers _gotools
# Generate, lint, test and build everything
all: gen lint lint-gha test build kube-build && version
# Run linters against code (incl. license headers)
lint: _lint _golangci_lint
{{golangci_lint}} run --show-stats ./...
# Run golangci-lint to attempt to fix issues
lint-fix: _lint _golangci_lint
{{golangci_lint}} run --show-stats --fix ./...
go_flags := "-ldflags=\"-w -s -X go.githedgehog.com/gateway/pkg/version.Version=" + version + "\""
go_build := "go build " + go_flags
go_linux_build := "GOOS=linux GOARCH=amd64 " + go_build
_kube_gen:
# Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject implementations
{{controller_gen}} object:headerFile="hack/boilerplate.go.txt" paths="./..."
# Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects
{{controller_gen}} rbac:roleName=manager-role crd:allowDangerousTypes=true webhook paths="./..." output:crd:artifacts:config=config/crd/bases
# Generate docs, code/manifests, things to embed, etc
gen: _kube_gen _crd_ref_docs
{{crd_ref_docs}} --source-path=./api/ --config=api/docs.config.yaml --renderer=markdown --output-path=./docs/api.md
# Build all artifacts
build: gen _license_headers _gotools && version
{{go_linux_build}} -o ./bin/gateway ./cmd
# Build complete
oci_repo := "127.0.0.1:30000"
oci_prefix := "githedgehog/gateway"
_helm-gateway-api: _kustomize _helm _kube_gen
@rm config/helm/gateway-api-v*.tgz || true
{{kustomize}} build config/crd > config/helm/gateway-api/templates/crds.yaml
{{helm}} package config/helm/gateway-api --destination config/helm --version {{version}}
{{helm}} lint config/helm/gateway-api-{{version}}.tgz
_helm-gateway: _kustomize _helm _helmify _kube_gen
@rm config/helm/gateway-v*.tgz || true
@rm config/helm/gateway/templates/*.yaml config/helm/gateway/values.yaml || true
{{kustomize}} build config/default | {{helmify}} config/helm/gateway
{{helm}} package config/helm/gateway --destination config/helm --version {{version}}
{{helm}} lint config/helm/gateway-{{version}}.tgz
# Build all K8s artifacts (images and charts)
kube-build: build (_docker-build "gateway") _helm-gateway-api _helm-gateway && version
# Docker images and Helm charts built
# Push all K8s artifacts (images and charts)
kube-push: kube-build (_helm-push "gateway-api") (_kube-push "gateway") && version
# Docker images and Helm charts pushed
# Push all K8s artifacts (images and charts) and binaries
push: kube-push && version
_test_api_kind := "gw-api"
# Install API on a kind cluster and wait for CRDs to be ready
test-api: _helm _helm-gateway-api
kind export kubeconfig --name {{_test_api_kind}}
{{helm}} install -n default gateway-api config/helm/gateway-api-{{version}}.tgz
sleep 10
kubectl wait --for condition=established --timeout=60s crd/peerings.gateway.githedgehog.com
kubectl get crd | grep gateway
test-api-auto: _kind_prep test-api _kind_cleanup
_kind_prep:
kind delete cluster --name {{_test_api_kind}} || kind delete cluster --name {{_test_api_kind}}
kind create cluster --name {{_test_api_kind}}
_kind_cleanup:
kind delete cluster --name {{_test_api_kind}} || kind delete cluster --name {{_test_api_kind}} || echo "Kind cluster {{_test_api_kind}} deletion failed, you may want to delete it manually"
# Patch deployment using the default kubeconfig (KUBECONFIG env or ~/.kube/config)
patch: && version
kubectl -n fab patch fab/default --type=merge -p '{"spec":{"overrides":{"versions":{"gateway":{"api":"{{version}}","controller":"{{version}}"}}}}}'
patch-dataplane dp_version:
kubectl -n fab patch fab/default --type=merge -p '{"spec":{"overrides":{"versions":{"gateway":{"dataplane":"{{dp_version}}"}}}}}'
patch-frr frr_version:
kubectl -n fab patch fab/default --type=merge -p '{"spec":{"overrides":{"versions":{"gateway":{"frr":"{{frr_version}}"}}}}}'