KubeZero/charts/kubezero-storage/jsonnet/Makefile

37 lines
1.1 KiB
Makefile

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
generate: clean build.sh
bash build.sh $<
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)