-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
93 lines (77 loc) · 3.32 KB
/
Makefile
File metadata and controls
93 lines (77 loc) · 3.32 KB
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
LOCALBIN ?= $(shell pwd)/.bin
$(LOCALBIN):
mkdir -p .bin
.PHONY: helm-deps-update
helm-deps-update:
helm dependency update ./chart
.PHONY: chart-local
chart-local: helm-deps-update
helm template -f ./chart/values.yaml mission-control ./chart
.PHONY: test-templates
test-templates: helm-deps-update
helm template --dry-run -f ./chart/values.yaml mission-control ./chart > /dev/null && echo "Templates are valid"
.PHONY: chart
chart: helm-deps-update
helm dependency build ./chart
helm package ./chart
.PHONY: agent-chart
agent-chart:
helm dependency build ./agent-chart
helm package ./agent-chart
.PHONY: crd-chart
crd-chart:
helm package ./crd-chart
# We have to update schema for chart dependencies to freely modify its properties
.PHONY: values.schema.json
values.schema.json: .bin/helm-schema
cd chart && ../.bin/helm-schema -r -f values.yaml -o temp-schema.json && cd -
jq --argjson JSON_CONTENT '{"additionalProperties": true,"required": [],"type": "object"}' \
'reduce ["apm-hub", "canary-checker", "config-db","flanksource-ui", "kratos", "mission-control-kubernetes-view", "mission-control-misc-playbooks"][] as $$key (.; .properties[$$key] = $$JSON_CONTENT) | .additionalProperties = true' \
chart/temp-schema.json > chart/values.schema.json
rm chart/temp-schema.json
cd agent-chart && ../.bin/helm-schema -r -f values.yaml -o temp-schema.json && cd -
jq --argjson JSON_CONTENT '{"additionalProperties": true,"required": [],"type": "object"}' \
'reduce ["apm-hub", "canary-checker", "config-db","flanksource-ui", "kratos", "mission-control-kubernetes-view", "pushTelemetry"][] as $$key (.; .properties[$$key] = $$JSON_CONTENT) | .additionalProperties = true' \
agent-chart/temp-schema.json > agent-chart/values.schema.json
rm agent-chart/temp-schema.json
.bin/helm-schema:
test -s $(LOCALBIN)/helm-schema || \
GOBIN=$(LOCALBIN) go install github.com/dadav/helm-schema/cmd/helm-schema@0.18.1
.PHONY: README.md
README.md: .bin/helm-docs
.bin/helm-docs -t README.md.tpl
.bin/helm-docs:
test -s $(LOCALBIN)/helm-docs || \
GOBIN=$(LOCALBIN) go install github.com/norwoodj/helm-docs/cmd/helm-docs@latest
.bin/ct: $(LOCALBIN)
@if [ ! -f $(LOCALBIN)/ct ]; then \
echo "Downloading chart-testing (ct) to .bin/..."; \
OS=$$(uname -s | tr '[:upper:]' '[:lower:]'); \
ARCH=$$(uname -m); \
if [ "$$ARCH" = "x86_64" ]; then ARCH="amd64"; fi; \
if [ "$$ARCH" = "aarch64" ]; then ARCH="arm64"; fi; \
CT_VERSION="v3.11.0"; \
URL="https://github.com/helm/chart-testing/releases/download/$${CT_VERSION}/chart-testing_$${CT_VERSION#v}_$${OS}_$${ARCH}.tar.gz"; \
curl -sSL "$$URL" | tar -xz -C $(LOCALBIN) ct etc; \
chmod +x $(LOCALBIN)/ct; \
fi
.PHONY: lint
lint: .bin/ct
$(LOCALBIN)/ct lint --charts chart --chart-yaml-schema $(LOCALBIN)/etc/chart_schema.yaml --lint-conf $(LOCALBIN)/etc/lintconf.yaml
.PHONY: go-test
go-test:
cd chart/test && ginkgo -r .
# A helper stub to only template out views (dashboard / system) for debugging purpose.
# make template-views | kubectl apply -n mc -f -
.PHONY: template-views
template-views:
@helm template mc-views ./chart \
-f ./chart/values.test.yaml \
--namespace mc \
--dependency-update \
--show-only 'templates/views/dashboard/*' \
--show-only 'templates/views/system/*' \
2>/dev/null
.PHONY: test-kratos-migration
test-kratos-migration:
bash test/kratos-migration/test.sh