Skip to content

Commit d43a9a6

Browse files
author
Vishnu Challa
committed
Kube-burner Report - OCP Wrapper Dashboard in latest grafonnet library
1 parent f504c80 commit d43a9a6

File tree

11 files changed

+2765
-5079
lines changed

11 files changed

+2765
-5079
lines changed

Makefile

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,64 @@
1-
JSONNET = https://github.com/google/jsonnet/releases/download/v0.17.0/jsonnet-bin-v0.17.0-linux.tar.gz
1+
JB = https://github.com/jsonnet-bundler/jsonnet-bundler/releases/latest/download/jb-linux-amd64
22
BINDIR = bin
33
TEMPLATESDIR = templates
44
OUTPUTDIR = rendered
55
ALLDIRS = $(BINDIR) $(OUTPUTDIR)
66
SYNCER_IMG_TAG ?= quay.io/cloud-bulldozer/dittybopper-syncer:latest
77
PLATFORM = linux/amd64,linux/arm64,linux/ppc64le,linux/s390x
88

9-
# Get all templates at $(TEMPLATESDIR)
10-
TEMPLATES := $(wildcard $(TEMPLATESDIR)/**/*.jsonnet)
9+
ifeq ($(filter v2,$(MAKECMDGOALS)),v2)
10+
# Set variables and instructions for v2
11+
TEMPLATES := $(wildcard $(TEMPLATESDIR)/**/*-v2.jsonnet)
12+
LIBRARY_PATH := $(TEMPLATESDIR)/vendor
13+
JSONNET := https://github.com/cloud-bulldozer/utils/releases/download/v0.0.0/jsonnet-bin-v0.20.0-linux.tar.gz
14+
else
15+
# Get all templates at $(TEMPLATESDIR)
16+
TEMPLATES := $(filter-out %-v2.jsonnet, $(wildcard $(TEMPLATESDIR)/**/*.jsonnet))
17+
LIBRARY_PATH := $(TEMPLATESDIR)/grafonnet-lib
18+
JSONNET := https://github.com/google/jsonnet/releases/download/v0.17.0/jsonnet-bin-v0.17.0-linux.tar.gz
19+
endif
1120

1221
# Replace $(TEMPLATESDIR)/*.jsonnet by $(OUTPUTDIR)/*.json
1322
outputs := $(patsubst $(TEMPLATESDIR)/%.jsonnet, $(OUTPUTDIR)/%.json, $(TEMPLATES))
1423

1524
all: deps format build
1625

17-
deps: $(ALLDIRS) $(TEMPLATESDIR)/grafonnet-lib $(BINDIR)/jsonnet
26+
deps: $(ALLDIRS) $(BINDIR)/jsonnet $(LIBRARY_PATH)
1827

1928
$(ALLDIRS):
2029
mkdir -p $(ALLDIRS)
2130

2231
format: deps
2332
$(BINDIR)/jsonnetfmt -i $(TEMPLATES)
2433

25-
build: deps $(TEMPLATESDIR)/grafonnet-lib $(outputs)
34+
build: deps $(LIBRARY_PATH) $(outputs)
2635

2736
clean:
2837
@echo "Cleaning up"
29-
rm -rf $(ALLDIRS) $(TEMPLATESDIR)/grafonnet-lib
30-
31-
$(TEMPLATESDIR)/grafonnet-lib:
32-
git clone --depth 1 https://github.com/grafana/grafonnet-lib.git $(TEMPLATESDIR)/grafonnet-lib
38+
rm -rf $(ALLDIRS) $(TEMPLATESDIR)/vendor $(TEMPLATESDIR)/grafonnet-lib
3339

3440
$(BINDIR)/jsonnet:
3541
@echo "Downloading jsonnet binary"
3642
curl -s -L $(JSONNET) | tar xz -C $(BINDIR)
43+
@echo "Downloading jb binary"
44+
curl -s -L $(JB) -o $(BINDIR)/jb
45+
chmod +x $(BINDIR)/jb
46+
47+
$(TEMPLATESDIR)/grafonnet-lib:
48+
git clone --depth 1 https://github.com/grafana/grafonnet-lib.git $(TEMPLATESDIR)/grafonnet-lib
49+
50+
$(TEMPLATESDIR)/vendor:
51+
@echo "Downloading vendor files"
52+
cd $(TEMPLATESDIR) && ../$(BINDIR)/jb install && cd ../
3753

3854
# Build each template and output to $(OUTPUTDIR)
3955
$(OUTPUTDIR)/%.json: $(TEMPLATESDIR)/%.jsonnet
4056
@echo "Building template $<"
4157
mkdir -p $(dir $@)
42-
$(BINDIR)/jsonnet $< > $@
58+
$(BINDIR)/jsonnet -J ./$(LIBRARY_PATH) $< > $@
59+
60+
v2: all
61+
@echo "Rendered the v2 dashboards with latest grafonnet library"
4362

4463
build-syncer-image: build
4564
podman build --platform=${PLATFORM} -f Dockerfile --manifest=${SYNCER_IMG_TAG} .

README.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,28 @@ bin/jsonnet templates/ocp-performance.jsonnet > rendered/ocp-performance.json
3434
$ ls rendered
3535
ocp-ingress-controller.json ocp-performance.json
3636
```
37+
Similarly for V2, the dashboards that are built using latest grafonnet library, use
38+
```
39+
$ make v2
40+
mkdir -p bin rendered
41+
Downloading jsonnet binary
42+
curl -s -L https://github.com/cloud-bulldozer/utils/releases/download/v0.0.0/jsonnet-bin-v0.20.0-linux.tar.gz | tar xz -C bin
43+
Downloading jb binary
44+
curl -s -L https://github.com/jsonnet-bundler/jsonnet-bundler/releases/latest/download/jb-linux-amd64 -o bin/jb
45+
chmod +x bin/jb
46+
Downloading vendor files
47+
cd templates && ../bin/jb install && cd ../
48+
GET https://github.com/grafana/grafonnet/archive/f40876da40d787e9c288de0b547ac85597c781d9.tar.gz 200
49+
GET https://github.com/grafana/grafonnet/archive/f40876da40d787e9c288de0b547ac85597c781d9.tar.gz 200
50+
GET https://github.com/jsonnet-libs/docsonnet/archive/cc9df63eaca56f39e8e4e1ce192141333257b08d.tar.gz 200
51+
GET https://github.com/jsonnet-libs/xtd/archive/0256a910ac71f0f842696d7bca0bf01ea77eb654.tar.gz 200
52+
bin/jsonnetfmt -i templates/General/ocp-performance-v2.jsonnet
53+
Building template templates/General/ocp-performance-v2.jsonnet
54+
mkdir -p rendered/General/
55+
bin/jsonnet -J ./templates/vendor templates/General/ocp-performance-v2.jsonnet > rendered/General/ocp-performance-v2.json
56+
Rendered the v2 dashboards with latest grafonnet library
57+
```
58+
Rest all operations reamin same as before.
3759

3860
In order to clean up the environment execute `make clean`.
3961

@@ -73,4 +95,4 @@ In addition, make sure to lint your modifications to jsonnet files if you don't
7395

7496
The dashboards from this repository have been tested with the following versions:
7597

76-
- Grafana 7.X
98+
- Grafana 7.X

0 commit comments

Comments
 (0)