forked from aws/karpenter-provider-aws
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
83 lines (64 loc) · 3.4 KB
/
Makefile
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
GOFLAGS ?= "-tags=${CLOUD_PROVIDER}"
RELEASE_REPO ?= public.ecr.aws/b6u6q9h4
RELEASE_VERSION ?= v0.1.2
RELEASE_MANIFEST = releases/${CLOUD_PROVIDER}/manifest.yaml
WITH_GOFLAGS = GOFLAGS=${GOFLAGS}
WITH_RELEASE_REPO = KO_DOCKER_REPO=${RELEASE_REPO}
help: ## Display help
@awk 'BEGIN {FS = ":.*##"; printf "Usage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
dev: codegen verify test ## Run all steps in the developer loop
ci: codegen verify battletest ## Run all steps used by continuous integration
release: publish helm docs ## Run all steps in release workflow
test: ## Run tests
ginkgo -r
battletest: ## Run stronger tests
# Ensure all files have cyclo-complexity =< 10
gocyclo -over 11 ./pkg
# Run randomized, parallelized, racing, code coveraged, tests
ginkgo -r \
-cover -coverprofile=coverage.out -outputdir=. -coverpkg=./pkg/... \
--randomizeAllSpecs --randomizeSuites -race
go tool cover -html coverage.out -o coverage.html
verify: ## Verify code. Includes dependencies, linting, formatting, etc
go mod tidy
go mod download
go vet ./...
go fmt ./...
golangci-lint run
codegen: ## Generate code. Must be run if changes are made to ./pkg/apis/...
controller-gen \
object:headerFile="hack/boilerplate.go.txt" \
webhook \
crd:trivialVersions=false \
paths="./pkg/..." \
output:crd:artifacts:config=config/crd/bases \
output:webhook:artifacts:config=config/webhook
./hack/boilerplate.sh
# Hack to remove v1.AdmissionReview until https://github.com/kubernetes-sigs/controller-runtime/issues/1161 is fixed
perl -pi -e 's/^ - v1$$//g' config/webhook/manifests.yaml
# CRDs don't currently jive with volatile time.
# `properties[lastTransitionTime].type: Unsupported value: "Any": supported
# values: "array", "boolean", "integer", "number", "object", "string"`
perl -pi -e 's/Any/string/g' config/crd/bases/autoscaling.karpenter.sh_horizontalautoscalers.yaml
perl -pi -e 's/Any/string/g' config/crd/bases/autoscaling.karpenter.sh_scalablenodegroups.yaml
perl -pi -e 's/Any/string/g' config/crd/bases/autoscaling.karpenter.sh_metricsproducers.yaml
perl -pi -e 's/Any/string/g' config/crd/bases/provisioning.karpenter.sh_provisioners.yaml
apply: ## Deploy the controller into your ~/.kube/config cluster
kubectl kustomize config | $(WITH_GOFLAGS) ko apply -B -f -
delete: ## Delete the controller from your ~/.kube/config cluster
kubectl kustomize config | ko delete -f -
publish: ## Generate release manifests and publish a versioned container image.
kubectl kustomize config | $(WITH_RELEASE_REPO) $(WITH_GOFLAGS) ko resolve -B -t $(RELEASE_VERSION) -f - > $(RELEASE_MANIFEST)
helm: ## Generate Helm Chart
cp $(RELEASE_MANIFEST) charts/karpenter/templates
yq w -i charts/karpenter/Chart.yaml version $(RELEASE_VERSION)
cd charts; helm package karpenter; helm repo index .
docs: ## Generate Docs
gen-crd-api-reference-docs \
-api-dir ./pkg/apis/autoscaling/v1alpha1 \
-config $(shell go env GOMODCACHE)/github.com/ahmetb/gen-crd-api-reference-docs@v0.2.0/example-config.json \
-out-file docs/README.md \
-template-dir $(shell go env GOMODCACHE)/github.com/ahmetb/gen-crd-api-reference-docs@v0.2.0/template
toolchain: ## Install developer toolchain
./hack/toolchain.sh
.PHONY: help dev ci release test battletest verify codegen apply delete publish helm docs toolchain