2022-03-08 10:41:47 +00:00
|
|
|
JSONNET_ARGS := -n 2 --max-blank-lines 2 --string-style s --comment-style s
|
|
|
|
ifneq (,$(shell which jsonnetfmt))
|
|
|
|
JSONNET_FMT_CMD := jsonnetfmt
|
|
|
|
else
|
|
|
|
JSONNET_FMT_CMD := jsonnet
|
|
|
|
JSONNET_FMT_ARGS := fmt $(JSONNET_ARGS)
|
|
|
|
endif
|
|
|
|
JSONNET_FMT := $(JSONNET_FMT_CMD) $(JSONNET_FMT_ARGS)
|
|
|
|
|
|
|
|
dashboardsDirPath=dashboards
|
|
|
|
rulessDirPath=rules
|
|
|
|
|
|
|
|
all: fmt generate lint
|
|
|
|
|
|
|
|
fmt:
|
|
|
|
find . -name 'vendor' -prune -o -name '*.libsonnet' -print -o -name '*.jsonnet' -print | \
|
|
|
|
xargs -n 1 -- $(JSONNET_FMT) -i
|
|
|
|
|
2022-04-20 09:21:04 +00:00
|
|
|
generate: clean build.sh
|
|
|
|
bash build.sh $<
|
2022-03-08 10:41:47 +00:00
|
|
|
jsonnet -J vendor -m rules -e '(import "prometheusRules.libsonnet")'
|
|
|
|
jsonnet -J vendor -m dashboards -e '(import "dashboards.libsonnet")'
|
|
|
|
|
|
|
|
render: generate
|
|
|
|
../../kubezero-metrics/sync_grafana_dashboards.py dashboards.yaml ../templates/lvm/grafana-dashboards.yaml
|
|
|
|
../../kubezero-metrics/sync_prometheus_rules.py rules.yaml ../templates/lvm/
|
|
|
|
|
|
|
|
lint:
|
|
|
|
find . -name 'vendor' -prune -o -name '*.libsonnet' -print -o -name '*.jsonnet' -print | \
|
|
|
|
while read f; do \
|
|
|
|
$(JSONNET_FMT) "$$f" | diff -u "$$f" -; \
|
|
|
|
done
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -rf $(dashboardsDirPath) $(rulessDirPath)
|
|
|
|
mkdir -p $(dashboardsDirPath) $(rulessDirPath)
|