Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed old code and keeping only latest grafonnet dashboards #125

Merged
merged 1 commit into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- uses: actions/checkout@v4

- name: Compile dashboards
run: make v2
run: make

- name: Run grafana container
run: sudo docker run -d -p 3000:3000 docker.io/grafana/grafana:9.4.3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ jobs:
QUAY_TOKEN: ${{ secrets.QUAY_TOKEN }}

- name: Build & push syncer image
run: make v2 build-syncer-image push-syncer-image
run: make build-syncer-image push-syncer-image
22 changes: 5 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,9 @@ ALLDIRS = $(BINDIR) $(OUTPUTDIR)
SYNCER_IMG_TAG ?= quay.io/cloud-bulldozer/dittybopper-syncer:latest
PLATFORM = linux/amd64,linux/arm64,linux/ppc64le,linux/s390x

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
# Get all templates at $(TEMPLATESDIR)
TEMPLATES := $(wildcard $(TEMPLATESDIR)/**/*.jsonnet)
LIBRARY_PATH := $(TEMPLATESDIR)/vendor

# Replace $(TEMPLATESDIR)/*.jsonnet by $(OUTPUTDIR)/*.json
outputs := $(patsubst $(TEMPLATESDIR)/%.jsonnet, $(OUTPUTDIR)/%.json, $(TEMPLATES))
Expand All @@ -37,7 +31,7 @@ build: deps $(LIBRARY_PATH) $(outputs)

clean:
@echo "Cleaning up"
rm -rf $(ALLDIRS) $(TEMPLATESDIR)/vendor $(TEMPLATESDIR)/grafonnet-lib
rm -rf $(ALLDIRS) $(TEMPLATESDIR)/vendor

$(BINDIR)/jsonnet:
@echo "Downloading jsonnet binary"
Expand All @@ -46,9 +40,6 @@ $(BINDIR)/jsonnet:
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 ../
Expand All @@ -59,10 +50,7 @@ $(OUTPUTDIR)/%.json: $(TEMPLATESDIR)/%.jsonnet
mkdir -p $(dir $@)
$(BINDIR)/jsonnet -J ./$(LIBRARY_PATH) $< > $@

v2: all
@echo "Rendered the v2 dashboards with latest grafonnet library"

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

push-syncer-image:
Expand Down
22 changes: 1 addition & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,8 @@ Render a jsonnet file is as simple as executing `jsonnet <jsonnet_template>`. Th
A makefile has been included to automate jsonnet formatting and rendering tasks. Executing `make` downloads the jsonnet binary and renders the templates at the *rendered* directory.

i.e.

```
$ make
mkdir -p bin rendered tmp
git clone --depth 1 https://github.com/grafana/grafonnet-lib.git templates/grafonnet-lib
Cloning into 'templates/grafonnet-lib'...
Downloading jsonnet binary
curl -s -L https://github.com/google/go-jsonnet/releases/download/v0.20.0/go-jsonnet_0.20.0_Linux_x86_64.tar.gz | tar xz -C bin
Formating template templates/ocp-performance.jsonnet
bin/jsonnetfmt templates/ocp-performance.jsonnet > tmp/ocp-performance.jsonnet
mv tmp/ocp-performance.jsonnet templates/ocp-performance.jsonnet
Building template templates/ocp-performance.jsonnet
bin/jsonnet templates/ocp-performance.jsonnet > rendered/ocp-performance.json
$ ls rendered
ocp-ingress-controller.json ocp-performance.json
```
Similarly for V2, the dashboards that are built using latest grafonnet library, use
```
$ make v2
mkdir -p bin rendered
Downloading jsonnet binary
curl -s -L https://github.com/google/go-jsonnet/releases/download/v0.20.0/go-jsonnet_0.20.0_Linux_x86_64.tar.gz | tar xz -C bin
Expand All @@ -53,10 +36,7 @@ bin/jsonnetfmt -i templates/General/ocp-performance-v2.jsonnet
Building template templates/General/ocp-performance-v2.jsonnet
mkdir -p rendered/General/
bin/jsonnet -J ./templates/vendor templates/General/ocp-performance-v2.jsonnet > rendered/General/ocp-performance-v2.json
Rendered the v2 dashboards with latest grafonnet library
```
Rest all operations remain same as before.

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

In order to lint the templates using `jsonnetfmt`execute `make format`
Expand All @@ -73,14 +53,14 @@ Dashboards Available after Migration to Grafonnet v10.1.0(latest):
- CPT
- [x] Ingress Perf Dashboard.
- [x] K8s Netperf Dashboard.
- [x] Kube-burner Report Mode Dashboard.
- [x] Kube Burner Report OCP Wrapper dashboard.
- General
- [x] API Performance Dashboard.
- [x] Cilium K8s Performance Dashboard.
- [x] Etcd Dashboard.
- [x] Hypershift Performance Dashboard.
- [x] K8s Performance Dashboard.
- [ ] Kube Burner Dashboard.
- [x] OpenShift Performance Dashboard.
- [x] OVN Dashboard.
- [x] Pgbench Dashboard.
Expand Down
File renamed without changes.
Loading