-
Notifications
You must be signed in to change notification settings - Fork 60
/
Makefile
79 lines (68 loc) · 3.19 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
SHELL=/usr/bin/env bash -o pipefail
NAMESPACE=default
KUBECONFIG=/tmp/kubeconfig
VERSION ?= latest
IMAGE_TAG_BASE ?= quay.io/mittwald/kubernetes-secret-generator
IMG ?= secret-generator:${VERSION}
.PHONY: install
install: ## Install all resources (RBAC and Operator)
@echo ....... Applying Rules and Service Account .......
kubectl apply -f deploy/role.yaml -n ${NAMESPACE}
kubectl apply -f deploy/role_binding.yaml -n ${NAMESPACE}
kubectl apply -f deploy/service_account.yaml -n ${NAMESPACE}
@echo ....... Applying CRDs .......
kubectl apply -f deploy/crds/secretgenerator.mittwald.de_basicauths_crd.yaml
kubectl apply -f deploy/crds/secretgenerator.mittwald.de_sshkeypairs_crd.yaml
kubectl apply -f deploy/crds/secretgenerator.mittwald.de_stringsecrets_crd.yaml
@echo ....... Applying Operator .......
kubectl apply -f deploy/operator.yaml -n ${NAMESPACE}
.PHONY: installwithmonitoring
installwithmonitoring: ## Install all resources (RBAC and Operator) with monitoring role
@echo ....... Applying Rules and Service Account .......
kubectl apply -f deploy/role_with_service_permissions.yaml -n ${NAMESPACE}
kubectl apply -f deploy/role_binding.yaml -n ${NAMESPACE}
kubectl apply -f deploy/service_account.yaml -n ${NAMESPACE}
@echo ....... Applying Operator .......
kubectl apply -f deploy/operator.yaml -n ${NAMESPACE}
.PHONY: uninstall
uninstall: ## Uninstall all that all performed in the $ make install
@echo ....... Uninstalling .......
@echo ....... Deleting Rules and Service Account .......
kubectl delete -f deploy/role.yaml -n ${NAMESPACE}
kubectl delete -f deploy/role_binding.yaml -n ${NAMESPACE}
kubectl delete -f deploy/service_account.yaml -n ${NAMESPACE}
@echo ....... Deleting Operator .......
kubectl delete -f deploy/operator.yaml -n ${NAMESPACE}
.PHONY: uninstallwithmonitoring
uninstallwithmonitoring: ## Uninstall all that all performed in the $ make installwithmonitoring
@echo ....... Uninstalling .......
@echo ....... Deleting Rules and Service Account .......
kubectl delete -f deploy/role_with_service_permissions.yaml -n ${NAMESPACE}
kubectl delete -f deploy/role_binding.yaml -n ${NAMESPACE}
kubectl delete -f deploy/service_account.yaml -n ${NAMESPACE}
@echo ....... Deleting Operator .......
kubectl delete -f deploy/operator.yaml -n ${NAMESPACE}
.PHONY: test
test: crd
@echo go test
go test ./... -v -count=1
.PHONY: fmt
fmt:
@echo go fmt
go fmt $$(go list ./...)
.PHONY: kind
kind: deletekind## Create a kind cluster to test against
kind create cluster --name kind-k8s-secret-generator
kind get kubeconfig --name kind-k8s-secret-generator | tee ${KUBECONFIG}
.PHONY: deletekind
deletekind:
kind delete cluster --name kind-k8s-secret-generator
.PHONY: crd
crd: kind
kubectl --context kind-kind-k8s-secret-generator apply -f deploy/crds/secretgenerator.mittwald.de_basicauths_crd.yaml
kubectl --context kind-kind-k8s-secret-generator apply -f deploy/crds/secretgenerator.mittwald.de_sshkeypairs_crd.yaml
kubectl --context kind-kind-k8s-secret-generator apply -f deploy/crds/secretgenerator.mittwald.de_stringsecrets_crd.yaml
.PHONY: build
build:
operator-sdk build --go-build-args "-ldflags -X=version.Version=${SECRET_OPERATOR_VERSION}" ${DOCKER_IMAGE}
@exit $(.SHELLSTATUS)