-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
67 lines (52 loc) · 2.03 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
# Setting SHELL to bash allows bash commands to be executed by recipes.
# Options are set to exit when a recipe line exits non-zero or a piped command fails.
SHELL = /usr/bin/env bash -o pipefail
.SHELLFLAGS = -ec
DEFAULT=help
MODULE=deploy
.PHONY: help test build push tools fmt
help: ## Display this help
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\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)
tools: ## Install cue, kind, Timoni
brew bundle
get: ## Update Kubernetes API CUE definitions
@go mod init
@go get -u k8s.io/api/...
@go get -u k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1
@cue get go k8s.io/api/core/v1
@cue get go k8s.io/api/apps/v1
@cue get go k8s.io/api/rbac/v1
@cue get go k8s.io/api/networking/v1
@cue get go k8s.io/apimachinery/pkg/apis/meta/v1
@cue get go k8s.io/apimachinery/pkg/runtime
@cue get go k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1
@rm go.mod go.sum
test: ## Build with test_values.cue
@timoni build -n testing test -f test_values.cue .
bundleup: ## Deploy using demo bundle
@timoni bundle apply -f bundle_test.cue
gen: vet ## Print the CUE generated objects
@cue gen
kind: ## Create kind cluster
@kind create cluster --config ./test/kind.yaml
build: ## Build with timoni with ns+name provided as arg/flag
@timoni build -n testing test .
fmt: ## Format cue files
@cue fmt .
@cue fmt ./templates
@timoni mod lint ./
e2e: ## Run full flow + ep validate
@$(MAKE) apply
@test/validate.sh
@$(MAKE) delete
apply: ## Apply the module with default values
@kubectl create ns test
@timoni apply -n test test-deploy -f test_values.cue ./ --timeout=1m
delete: ## Delete the module with default values
@timoni delete -n test test-deploy ./ --timeout=1m
@kubectl delete ns test
push: ## Push the module with timoni
@timoni mod push . \
oci://ghcr.io/${OWNER}/cue-modules/$(MODULE) \
--version ${TAG} \
--creds ${USER}:${PASS}