Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Commit 80ca611

Browse files
committed
Update instructions to use k8s-alpha library
Signed-off-by: Jack Baldry <[email protected]>
1 parent febde0f commit 80ca611

File tree

3 files changed

+34
-13
lines changed

3 files changed

+34
-13
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
cortex-mixin.zip
22
cortex-mixin/out
33
cortex-mixin/vendor
4+
/test-readme/

Makefile

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
JSONNET_FMT := jsonnetfmt
44

55
lint:
6-
@RESULT=0; \
7-
for f in $$(find . -name '*.libsonnet' -print -o -name '*.jsonnet' -print); do \
8-
$(JSONNET_FMT) -- "$$f" | diff -u "$$f" -; \
9-
RESULT=$$(($$RESULT + $$?)); \
10-
done; \
6+
@RESULT=0;
7+
for f in $$(find . -name '*.libsonnet' -print -o -name '*.jsonnet' -print); do
8+
$(JSONNET_FMT) -- "$$f" | diff -u "$$f" -;
9+
RESULT=$$(($$RESULT + $$?));
10+
done;
1111
exit $$RESULT
1212

1313
fmt:
14-
@find . -name 'vendor' -prune -o -name '*.libsonnet' -print -o -name '*.jsonnet' -print | \
14+
@find . -name 'vendor' -prune -o -name '*.libsonnet' -print -o -name '*.jsonnet' -print |
1515
xargs -n 1 -- $(JSONNET_FMT) -i
1616

1717
build-image:
@@ -21,10 +21,24 @@ publish-build-image:
2121
docker push grafana/cortex-jsonnet-build-image:$(shell git rev-parse --short HEAD)
2222

2323
build-mixin:
24-
cd cortex-mixin && \
25-
rm -rf out && mkdir out && \
26-
jb install && \
27-
jsonnet -J vendor -S dashboards.jsonnet -m out/ && \
28-
jsonnet -J vendor -S recording_rules.jsonnet > out/rules.yaml && \
24+
cd cortex-mixin
25+
rm -rf out && mkdir out
26+
jb install
27+
jsonnet -J vendor -S dashboards.jsonnet -m out/
28+
jsonnet -J vendor -S recording_rules.jsonnet > out/rules.yaml
2929
jsonnet -J vendor -S alerts.jsonnet > out/alerts.yaml
3030
zip -r cortex-mixin.zip cortex-mixin/out
31+
test-readme:
32+
rm -rf -- test-readme
33+
GO111MODULE=on go get github.com/grafana/tanka/cmd/tk
34+
GO111MODULE=on go get github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb
35+
mkdir test-readme && cd test-readme
36+
tk init --k8s=false
37+
jb install github.com/jsonnet-libs/k8s-alpha/1.18
38+
cat <<EOF > lib/k.libsonnet
39+
(import "github.com/jsonnet-libs/k8s-alpha/1.18/main.libsonnet") +
40+
(import "github.com/jsonnet-libs/k8s-alpha/1.18/extensions/kausal-shim.libsonnet")
41+
EOF
42+
jb install github.com/grafana/cortex-jsonnet/cortex
43+
cp vendor/cortex/cortex-manifests.jsonnet.example environments/default/main.jsonnet
44+
tk show environments/default

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,17 @@ To generate the YAMLs for deploying Cortex:
1414
$ GO111MODULE=on go get github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb
1515
```
1616

17-
1. Initialise the application and download the cortex jsonnet lib.
17+
1. Initialise the Tanka, and install the Cortex and Kubernetes Jsonnet libraries.
1818

1919
```console
2020
$ mkdir <name> && cd <name>
21-
$ tk init
21+
$ tk init --k8s=false
22+
$ # The k8s-alpha library supports Kubernetes versions 1.14+
23+
$ jb install github.com/jsonnet-libs/k8s-alpha/1.18
24+
$ cat <<EOF > lib/k.libsonnet
25+
(import "github.com/jsonnet-libs/k8s-alpha/1.18/main.libsonnet")
26+
+ (import "github.com/jsonnet-libs/k8s-alpha/1.18/extensions/kausal-shim.libsonnet")
27+
EOF
2228
$ jb install github.com/grafana/cortex-jsonnet/cortex
2329
```
2430
1. Use the example monitoring.jsonnet.example:

0 commit comments

Comments
 (0)