-
Notifications
You must be signed in to change notification settings - Fork 126
/
Makefile
203 lines (161 loc) · 8.16 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
# Image URL to use all building/pushing image targets
# renovate: datasource=github-tags depName=kubernetes-sigs/kustomize
KUSTOMIZE_VERSION?=v5.4.3
CHART_APPVERSION ?= v2.2.0 # x-release-please-version
# renovate: datasource=docker depName=cytopia/yamllint
YAMLLINT_VERSION ?= alpine
# RELEASE_REGISTRY is the container registry to push
# into.
RELEASE_REGISTRY?=ghcr.io/keptn
ARCH?=amd64
TAG ?= "$(shell date +%Y%m%d%s)"
TAG := $(TAG)
## Location to install dependencies to
LOCALBIN ?= $(shell pwd)/bin
$(LOCALBIN):
mkdir -p $(LOCALBIN)
## Tool Binaries
KUSTOMIZE ?= $(LOCALBIN)/kustomize
############
# CHAINSAW #
############
.PHONY: integration-test #these tests should run on a real cluster!
integration-test:
kubectl apply -f ./lifecycle-operator/config/crd/bases
chainsaw test --test-dir ./test/chainsaw/integration/
.PHONY: integration-test-local #these tests should run on a real cluster!
integration-test-local:
kubectl apply -f ./lifecycle-operator/config/crd/bases
chainsaw test --test-dir ./test/chainsaw/integration/ --config ./.chainsaw-local.yaml
.PHONY: integration-test-metrics #these tests should run on a real cluster!
integration-test-metrics:
kubectl apply -f ./lifecycle-operator/config/crd/bases
chainsaw test --test-dir ./test/chainsaw/testmetrics/
chainsaw test --test-dir ./test/chainsaw/testanalysis/
.PHONY: integration-test-metrics-local #these tests should run on a real cluster!
integration-test-metrics-local:
kubectl apply -f ./lifecycle-operator/config/crd/bases
chainsaw test --test-dir ./test/chainsaw/testmetrics/ --config ./.chainsaw-local.yaml
chainsaw test --test-dir ./test/chainsaw/testanalysis/ --config ./.chainsaw-local.yaml
.PHONY: integration-test-lifecycle #these tests should run on a real cluster!
integration-test-lifecycle:
kubectl apply -f ./lifecycle-operator/config/crd/bases
chainsaw test --test-dir ./test/chainsaw/scheduling-gates/
chainsaw test --test-dir ./test/chainsaw/non-blocking-deployment/
chainsaw test --test-dir ./test/chainsaw/timeout-failure-deployment/
chainsaw test --test-dir ./test/chainsaw/traces/
.PHONY: integration-test-lifecycle-local #these tests should run on a real cluster!
integration-test-lifecycle-local:
kubectl apply -f ./lifecycle-operator/config/crd/bases
chainsaw test --test-dir ./test/chainsaw/scheduling-gates/ --config ./.chainsaw-local.yaml
chainsaw test --test-dir ./test/chainsaw/non-blocking-deployment/ --config ./.chainsaw-local.yaml
chainsaw test --test-dir ./test/chainsaw/timeout-failure-deployment/ --config ./.chainsaw-local.yaml
chainsaw test --test-dir ./test/chainsaw/traces/ --config ./.chainsaw-local.yaml
.PHONY: integration-test-cert-manager #these tests should run on a real cluster!
integration-test-cert-manager:
chainsaw test --test-dir ./test/chainsaw/testcertificate/
.PHONY: integration-test-cert-manager-local #these tests should run on a real cluster!
integration-test-cert-manager-local: install-prometheus
chainsaw test --test-dir ./test/chainsaw/testcertificate/ --config ./.chainsaw-local.yaml
.PHONY: integration-test-allowed-namespaces #these tests should run on a real cluster!
integration-test-allowed-namespaces:
chainsaw test --test-dir ./test/chainsaw/allowed-namespaces/
.PHONY: integration-test-allowed-namespaces-local #these tests should run on a real cluster!
integration-test-allowed-namespaces-local: install-prometheus
chainsaw test --test-dir ./test/chainsaw/allowed-namespaces/ --config ./.chainsaw-local.yaml
.PHONY: load-test
load-test:
kubectl apply -f ./test/load/assets/templates/namespace.yaml
kubectl apply -f ./test/load/assets/templates/provider.yaml
kube-burner init -c ./test/load/cfg.yml --metrics-profile ./test/load/metrics.yml --prometheus-url http://localhost:9090
.PHONY: install-prometheus
install-prometheus:
kubectl create namespace monitoring --dry-run=client -o yaml | kubectl apply -f -
kubectl apply --server-side -f test/prometheus/setup
kubectl wait --for=condition=Established --all CustomResourceDefinition --namespace=monitoring
kubectl apply -f test/prometheus/
kubectl wait --for=condition=available deployment/prometheus-operator -n monitoring --timeout=120s
kubectl wait --for=condition=available deployment/prometheus-adapter -n monitoring --timeout=120s
kubectl wait --for=condition=available deployment/kube-state-metrics -n monitoring --timeout=120s
kubectl wait pod/prometheus-k8s-0 --for=condition=ready --timeout=120s -n monitoring
.PHONY: metrics-operator-test
metrics-operator-test:
$(MAKE) -C metrics-operator test
.PHONY: certmanager-test
certmanager-test:
$(MAKE) -C keptn-cert-manager test
.PHONY: operator-test
operator-test:
$(MAKE) -C lifecycle-operator test
.PHONY: scheduler-test
scheduler-test:
$(MAKE) -C scheduler test
#command(make test) to run all tests
.PHONY: test
test: metrics-operator-test certmanager-test operator-test scheduler-test integration-test
.PHONY: cleanup-manifests
cleanup-manifests:
rm -rf manifests
KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
.PHONY: kustomize
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
$(KUSTOMIZE): $(LOCALBIN)
test -s $(LOCALBIN)/kustomize || { curl -s $(KUSTOMIZE_INSTALL_SCRIPT) | bash -s -- $(subst v,,$(KUSTOMIZE_VERSION)) $(LOCALBIN); }
.PHONY: build-deploy-operator
build-deploy-operator:
$(MAKE) -C lifecycle-operator release-local.$(ARCH) RELEASE_REGISTRY=$(RELEASE_REGISTRY) TAG=$(TAG)
$(MAKE) -C lifecycle-operator push-local RELEASE_REGISTRY=$(RELEASE_REGISTRY) TAG=$(TAG)
$(MAKE) -C lifecycle-operator release-manifests RELEASE_REGISTRY=$(RELEASE_REGISTRY) CHART_APPVERSION=$(TAG) ARCH=$(ARCH)
kubectl apply -f lifecycle-operator/config/rendered/release.yaml
.PHONY: build-deploy-metrics-operator
build-deploy-metrics-operator:
$(MAKE) -C metrics-operator release-local.$(ARCH) RELEASE_REGISTRY=$(RELEASE_REGISTRY) TAG=$(TAG)
$(MAKE) -C metrics-operator push-local RELEASE_REGISTRY=$(RELEASE_REGISTRY) TAG=$(TAG)
$(MAKE) -C metrics-operator release-manifests RELEASE_REGISTRY=$(RELEASE_REGISTRY) CHART_APPVERSION=$(TAG) ARCH=$(ARCH)
kubectl apply -f metrics-operator/config/rendered/release.yaml
.PHONY: build-deploy-scheduler
build-deploy-scheduler:
$(MAKE) -C scheduler release-local.$(ARCH) RELEASE_REGISTRY=$(RELEASE_REGISTRY) TAG=$(TAG)
$(MAKE) -C scheduler push-local RELEASE_REGISTRY=$(RELEASE_REGISTRY) TAG=$(TAG)
$(MAKE) -C scheduler release-manifests RELEASE_REGISTRY=$(RELEASE_REGISTRY) CHART_APPVERSION=$(TAG) ARCH=$(ARCH)
kubectl create namespace keptn-system --dry-run=client -o yaml | kubectl apply -f -
kubectl apply -f scheduler/config/rendered/release.yaml
.PHONY: build-deploy-certmanager
build-deploy-certmanager:
$(MAKE) -C keptn-cert-manager release-local.$(ARCH) RELEASE_REGISTRY=$(RELEASE_REGISTRY) TAG=$(TAG)
$(MAKE) -C keptn-cert-manager push-local RELEASE_REGISTRY=$(RELEASE_REGISTRY) TAG=$(TAG)
$(MAKE) -C keptn-cert-manager release-manifests RELEASE_REGISTRY=$(RELEASE_REGISTRY) CHART_APPVERSION=$(TAG) ARCH=$(ARCH)
kubectl create namespace keptn-system --dry-run=client -o yaml | kubectl apply -f -
kubectl apply -f keptn-cert-manager/config/rendered/release.yaml
.PHONY: build-deploy-dev-environment
build-deploy-dev-environment: build-deploy-certmanager build-deploy-operator build-deploy-metrics-operator build-deploy-scheduler
include docs/Makefile
yamllint:
@docker run --rm -t -v $(PWD):/data cytopia/yamllint:$(YAMLLINT_VERSION) .
##Run lint for the subfiles
.PHONY: install-golangci-lint
install-golangci-lint:
@go install -v github.com/golangci/golangci-lint/cmd/golangci-lint@latest
.PHONY: metrics-operator-lint
metrics-operator-lint: install-golangci-lint
$(MAKE) -C metrics-operator lint
.PHONY: certmanager-lint
certmanager-lint: install-golangci-lint
$(MAKE) -C keptn-cert-manager lint
.PHONY: operator-lint
operator-lint: install-golangci-lint
$(MAKE) -C lifecycle-operator lint
.PHONY: scheduler-lint
scheduler-lint: install-golangci-lint
$(MAKE) -C scheduler lint
.PHONY: helm-test
helm-test:
./.github/scripts/helm-test.sh
.PHONY: generate-helm-test-results
generate-helm-test-results:
./.github/scripts/generate-helm-results.sh
.PHONY: lint
lint: metrics-operator-lint
lint: certmanager-lint
lint: operator-lint
lint: scheduler-lint