-
Notifications
You must be signed in to change notification settings - Fork 10
/
Makefile
122 lines (106 loc) · 4.43 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
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
start-watch:
gow run -tags $(or $(datree_build_env),staging) -ldflags="-X github.com/datreeio/admission-webhook-datree/pkg/config.WebhookVersion=0.0.1" main.go
change-ping-uninstall-url-to-staging:
sed -i '' 's|https://gateway\.datree\.io/cli/cluster/uninstall|https://gateway.staging.datree.io/cli/cluster/uninstall|' charts/datree-admission-webhook/templates/namespace-post-delete.yaml
change-ping-uninstall-url-to-production:
sed -i '' 's|https://gateway\.staging\.datree\.io/cli/cluster/uninstall|https://gateway.datree.io/cli/cluster/uninstall|' charts/datree-admission-webhook/templates/namespace-post-delete.yaml
start:
go run -tags $(or $(datree_build_env),staging) -ldflags="-X github.com/datreeio/admission-webhook-datree/pkg/config.WebhookVersion=0.0.1" main.go
start-dev:
make datree_build_env=dev start
start-staging:
make datree_build_env=staging start
start-production:
make datree_build_env=main start
build:
go build -tags $(or $(datree_build_env),staging) -ldflags="-X github.com/datreeio/admission-webhook-datree/pkg/config.WebhookVersion=0.0.1" -o webhook-datree
build-dev:
make datree_build_env=dev build
build-staging:
make datree_build_env=staging build
build-production:
make datree_build_env=main build
test:
DATREE_ENFORCE="true" go test ./...
helm-install-local-in-minikube:
make change-ping-uninstall-url-to-staging && \
eval $(minikube docker-env) && \
./scripts/build-docker-image.sh && \
helm install -n datree datree-webhook ./charts/datree-admission-webhook \
--create-namespace \
-f ./internal/fixtures/values.dev.yaml \
--set datree.token="${DATREE_TOKEN}" \
--set scanJob.ttlSecondschange-ping-uninstall-url-to-productionFinished=100 \
--debug && \
make change-ping-uninstall-url-to-production
helm-upgrade-local:
make change-ping-uninstall-url-to-staging && \
eval $(minikube docker-env) && \
helm upgrade -n datree datree-webhook ./charts/datree-admission-webhook \
-f ./internal/fixtures/values.dev.yaml \
--set datree.token="${DATREE_TOKEN}" \
--set scanJob.ttlSecondschange-ping-uninstall-url-to-productionFinished=100 \
--debug && \
make change-ping-uninstall-url-to-production
helm-uninstall:
helm uninstall -n datree datree-webhook
helm-install-staging:
make change-ping-uninstall-url-to-staging && \
helm install -n datree datree-webhook ./charts/datree-admission-webhook \
--create-namespace \
--set datree.token="${DATREE_TOKEN}" \
--set datree.clusterName="minikube" \
--set datree.policy="Starter" \
--set clusterScanner.image.repository="datree/cluster-scanner-staging" \
--set clusterScanner.image.tag="latest" \
--set image.repository="datree/webhook-staging" \
--set image.tag="latest" \
--debug && \
make change-ping-uninstall-url-to-production
okd-helm-install-staging:
make change-ping-uninstall-url-to-staging && \
helm install -n datree datree-webhook ./charts/datree-admission-webhook \
--create-namespace \
--set datree.token="${DATREE_TOKEN}" \
--set datree.clusterName="okd" \
--set datree.policy="Starter" \
--set clusterScanner.image.repository="datree/cluster-scanner-staging" \
--set clusterScanner.image.tag="latest" \
--set image.repository="datree/webhook-staging" \
--set image.tag="latest" \
--set securityContext.seccompProfile=null \
--set securityContext.runAsUser=null \
--set datree.labelKubeSystem=false \
--debug && \
make change-ping-uninstall-url-to-production
helm-template-staging:
make change-ping-uninstall-url-to-staging && \
helm template -n datree datree-webhook ./charts/datree-admission-webhook \
--create-namespace \
--set datree.token="${DATREE_TOKEN}" \
--set datree.clusterName="minikube" \
--set datree.policy="Starter" \
--set clusterScanner.image.repository="datree/cluster-scanner-staging" \
--set clusterScanner.image.tag="latest" \
--set image.repository="datree/webhook-staging" \
--set image.tag="latest" \
--debug && \
make change-ping-uninstall-url-to-production
# in order to run the command, first install helm-docs by running: "brew install norwoodj/tap/helm-docs"
# https://github.com/norwoodj/helm-docs
generate-helm-docs:
helm-docs \
--sort-values-order=file \
--output-file ./README.md \
--template-files=./charts/datree-admission-webhook/README.md.gotmpl \
&& \
helm-docs \
--sort-values-order=file \
--output-file ../../README.md \
--template-files=./README.md.gotmpl
lint:
golangci-lint run ./...
tilt-dev:
DATREE_TOKEN="${DATREE_TOKEN}" tilt up
tilt-debug:
DATREE_TOKEN="${DATREE_TOKEN}" TILT_ENV="debugging" tilt up