forked from kubernetes-sigs/agent-sandbox
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
139 lines (109 loc) · 4.43 KB
/
Makefile
File metadata and controls
139 lines (109 loc) · 4.43 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
.PHONY: all
all: fix-go-generate build lint-go lint-api test-unit toc-verify
.PHONY: fix-go-generate
fix-go-generate:
dev/tools/fix-go-generate
GOPATH ?= $(shell go env GOPATH)
.PHONY: generate-api-docs
generate-api-docs: ## Generate API reference documentation
@echo "Generating API Docs..."
go install github.com/elastic/crd-ref-docs@latest
$(GOPATH)/bin/crd-ref-docs --source-path=./ --config=./docs/crd-ref-docs.yaml --renderer=markdown --output-path=./docs/api.md --max-depth=10
rm -rf ./tmp-api-source
VERSION_PKG := sigs.k8s.io/agent-sandbox/internal/version
GIT_VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo "unknown")
GIT_SHA ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown")
BUILD_DATE ?= $(shell date -u +'%Y-%m-%dT%H:%M:%SZ')
LD_FLAGS := -s -w -X $(VERSION_PKG).gitVersion=$(GIT_VERSION) \
-X $(VERSION_PKG).gitSHA=$(GIT_SHA) \
-X $(VERSION_PKG).buildDate=$(BUILD_DATE)
.PHONY: build
build:
go build -ldflags "$(LD_FLAGS)" -o bin/manager cmd/agent-sandbox-controller/main.go
KIND_CLUSTER=agent-sandbox
.PHONY: deploy-kind
# `EXTENSIONS=true make deploy-kind` to deploy with Extensions enabled.
# `CONTROLLER_ARGS="--enable-pprof-debug --zap-log-level=debug" make deploy-kind` to deploy with custom controller flags.
# `CONTROLLER_ONLY=true make deploy-kind` to build and push only the controller image.
deploy-kind:
./dev/tools/create-kind-cluster --recreate ${KIND_CLUSTER} --kubeconfig bin/KUBECONFIG
./dev/tools/push-images --image-prefix=kind.local/ --kind-cluster-name=${KIND_CLUSTER} $(if $(filter true,$(CONTROLLER_ONLY)),--controller-only)
./dev/tools/deploy-to-kube --image-prefix=kind.local/ $(if $(filter true,$(EXTENSIONS)),--extensions) $(if $(CONTROLLER_ARGS),--controller-args="$(CONTROLLER_ARGS)")
.PHONY: deploy-cloud-provider-kind
deploy-cloud-provider-kind:
./dev/tools/deploy-cloud-provider
.PHONY: delete-kind
delete-kind:
kind delete cluster --name ${KIND_CLUSTER}
.PHONY: kill-cloud-provider-kind
kill-cloud-provider-kind:
killall cloud-provider-kind
.PHONY: test-unit
test-unit:
./dev/tools/test-unit
.PHONY: test-e2e
test-e2e:
RACE=$(RACE) ./dev/ci/presubmits/test-e2e
.PHONY: test-e2e-race
test-e2e-race:
RACE=1 ./dev/ci/presubmits/test-e2e
.PHONY: test-e2e-benchmarks
test-e2e-benchmarks:
./dev/ci/presubmits/test-e2e --suite benchmarks
.PHONY: lint-go
lint-go:
./dev/tools/lint-go
.PHONY: fix-go
fix-go:
./dev/tools/lint-go --fix
.PHONY: lint-api
lint-api:
./dev/tools/lint-api
.PHONY: fix-api
fix-api:
./dev/tools/lint-api --fix
# Location of your local k8s.io repo (can be overridden: make release-promote TAG=v0.1.0 K8S_IO_DIR=../other/k8s.io)
K8S_IO_DIR ?= ../../kubernetes/k8s.io
# Default remote (can be overriden: make release-publish REMOTE=upstream ...)
REMOTE_UPSTREAM ?= upstream
REMOTE_FORK ?= origin
# Gemini model for release notes generation
GEMINI_MODEL ?= gemini-2.5-flash
# Promote all staging images to registry.k8s.io
# Usage: make release-promote TAG=vX.Y.Z
.PHONY: release-promote
release-promote:
@if [ -z "$(TAG)" ]; then echo "TAG is required (e.g., make release-promote TAG=vX.Y.Z)"; exit 1; fi
./dev/tools/tag-promote-images --tag=${TAG} --k8s-io-dir=${K8S_IO_DIR} --upstream-remote=${REMOTE_UPSTREAM} --fork-remote=${REMOTE_FORK} $(if $(filter true,$(SKIP_TAGGING)),--skip-tagging) $(if $(filter true,$(ONLY_TAGGING)),--only-tagging)
# Publish a draft release to GitHub
# Usage: make release-publish TAG=vX.Y.Z GEMINI_MODEL=gemini-2.5-flash
.PHONY: release-publish
release-publish:
@if [ -z "$(TAG)" ]; then echo "TAG is required (e.g., make release-publish TAG=vX.Y.Z)"; exit 1; fi
go mod tidy
go generate ./...
./dev/tools/release --tag=${TAG} --publish --model=${GEMINI_MODEL}
# Generate release manifests only
# Usage: make release-manifests TAG=vX.Y.Z
.PHONY: release-manifests
release-manifests:
@if [ -z "$(TAG)" ]; then echo "TAG is required (e.g., make release-manifests TAG=vX.Y.Z)"; exit 1; fi
go mod tidy
go generate ./...
./dev/tools/release --tag=${TAG}
# Example usage:
# make release-python-sdk TAG=v0.1.1.post1 (for patch release on PyPI)
.PHONY: release-python-sdk
release-python-sdk:
@if [ -z "$(TAG)" ]; then echo "TAG is required (e.g., make release-python-sdk TAG=vX.Y.Z.postN)"; exit 1; fi
./dev/tools/release-python --tag=${TAG} --remote=${REMOTE_UPSTREAM}
.PHONY: toc-update
toc-update:
./dev/tools/update-toc
.PHONY: toc-verify
toc-verify:
./dev/tools/verify-toc
.PHONY: clean
clean:
rm -rf dev/tools/tmp
rm -rf bin/manager