-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Kube burner Report - OCP Wrapper Dashboard using latest grafonnet lib…
…rary. (#80) * Added: Support for multiple multiple folders, python client Modified: Internal logic for creating/updating dashboards Deleted: Removed old logic as it is not flexible for automation * Kube-burner Report - OCP Wrapper Dashboard in latest grafonnet library * using go-jsonnet binaries * adding commit hash as a tag --------- Co-authored-by: Vishnu Challa <[email protected]>
- Loading branch information
1 parent
fc4673c
commit 6aa348b
Showing
9 changed files
with
2,767 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,66 @@ | ||
JSONNET = https://github.com/google/jsonnet/releases/download/v0.17.0/jsonnet-bin-v0.17.0-linux.tar.gz | ||
JSONNET := https://github.com/google/go-jsonnet/releases/download/v0.20.0/go-jsonnet_0.20.0_Linux_x86_64.tar.gz | ||
JB = https://github.com/jsonnet-bundler/jsonnet-bundler/releases/latest/download/jb-linux-amd64 | ||
BINDIR = bin | ||
TEMPLATESDIR = templates | ||
OUTPUTDIR = rendered | ||
ALLDIRS = $(BINDIR) $(OUTPUTDIR) | ||
SYNCER_IMG_TAG ?= quay.io/cloud-bulldozer/dittybopper-syncer:latest | ||
PLATFORM = linux/amd64,linux/arm64,linux/ppc64le,linux/s390x | ||
|
||
# Get all templates at $(TEMPLATESDIR) | ||
TEMPLATES := $(wildcard $(TEMPLATESDIR)/**/*.jsonnet) | ||
ifeq ($(filter v2,$(MAKECMDGOALS)),v2) | ||
# Set variables and instructions for v2 | ||
TEMPLATES := $(wildcard $(TEMPLATESDIR)/**/*-v2.jsonnet) | ||
LIBRARY_PATH := $(TEMPLATESDIR)/vendor | ||
else | ||
# Get all templates at $(TEMPLATESDIR) | ||
TEMPLATES := $(filter-out %-v2.jsonnet, $(wildcard $(TEMPLATESDIR)/**/*.jsonnet)) | ||
LIBRARY_PATH := $(TEMPLATESDIR)/grafonnet-lib | ||
endif | ||
|
||
# Replace $(TEMPLATESDIR)/*.jsonnet by $(OUTPUTDIR)/*.json | ||
outputs := $(patsubst $(TEMPLATESDIR)/%.jsonnet, $(OUTPUTDIR)/%.json, $(TEMPLATES)) | ||
|
||
all: deps format build | ||
|
||
deps: $(ALLDIRS) $(TEMPLATESDIR)/grafonnet-lib $(BINDIR)/jsonnet | ||
deps: $(ALLDIRS) $(BINDIR)/jsonnet $(LIBRARY_PATH) | ||
|
||
$(ALLDIRS): | ||
mkdir -p $(ALLDIRS) | ||
|
||
format: deps | ||
$(BINDIR)/jsonnetfmt -i $(TEMPLATES) | ||
|
||
build: deps $(TEMPLATESDIR)/grafonnet-lib $(outputs) | ||
build: deps $(LIBRARY_PATH) $(outputs) | ||
|
||
clean: | ||
@echo "Cleaning up" | ||
rm -rf $(ALLDIRS) $(TEMPLATESDIR)/grafonnet-lib | ||
|
||
$(TEMPLATESDIR)/grafonnet-lib: | ||
git clone --depth 1 https://github.com/grafana/grafonnet-lib.git $(TEMPLATESDIR)/grafonnet-lib | ||
rm -rf $(ALLDIRS) $(TEMPLATESDIR)/vendor $(TEMPLATESDIR)/grafonnet-lib | ||
|
||
$(BINDIR)/jsonnet: | ||
@echo "Downloading jsonnet binary" | ||
curl -s -L $(JSONNET) | tar xz -C $(BINDIR) | ||
@echo "Downloading jb binary" | ||
curl -s -L $(JB) -o $(BINDIR)/jb | ||
chmod +x $(BINDIR)/jb | ||
|
||
$(TEMPLATESDIR)/grafonnet-lib: | ||
git clone --depth 1 https://github.com/grafana/grafonnet-lib.git $(TEMPLATESDIR)/grafonnet-lib | ||
|
||
$(TEMPLATESDIR)/vendor: | ||
@echo "Downloading vendor files" | ||
cd $(TEMPLATESDIR) && ../$(BINDIR)/jb install && cd ../ | ||
|
||
# Build each template and output to $(OUTPUTDIR) | ||
$(OUTPUTDIR)/%.json: $(TEMPLATESDIR)/%.jsonnet | ||
@echo "Building template $<" | ||
mkdir -p $(dir $@) | ||
$(BINDIR)/jsonnet $< > $@ | ||
$(BINDIR)/jsonnet -J ./$(LIBRARY_PATH) $< > $@ | ||
|
||
v2: all | ||
@echo "Rendered the v2 dashboards with latest grafonnet library" | ||
|
||
build-syncer-image: build | ||
podman build --platform=${PLATFORM} -f Dockerfile --manifest=${SYNCER_IMG_TAG} . | ||
|
||
push-syncer-image: | ||
podman manifest push ${SYNCER_IMG_TAG} ${SYNCER_IMG_TAG} | ||
podman manifest push ${SYNCER_IMG_TAG} ${SYNCER_IMG_TAG} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.