github.com/grafana/pyroscope@v1.18.0/operations/pyroscope/jsonnet/test-jsonnet.sh (about) 1 #!/usr/bin/env bash 2 3 set -euo pipefail 4 5 REPO_ROOT="$(git rev-parse --show-toplevel)" 6 declare -r REPO_ROOT 7 cd "${REPO_ROOT}" 8 9 # create temporary directory 10 TMP_DIR="$(mktemp -d)" 11 declare -r TMP_DIR 12 on_exit() { 13 rm -rf "${TMP_DIR}" 14 } 15 trap on_exit EXIT 16 17 cd "${TMP_DIR}" 18 tk init 19 20 jb install github.com/grafana/jsonnet-libs/tanka-util@master 21 jb install github.com/grafana/pyroscope/operations/pyroscope@main 22 23 # link latest 24 rm -rf vendor/github.com/grafana/pyroscope/operations/pyroscope 25 ln -fs "${REPO_ROOT}/operations/pyroscope" vendor/github.com/grafana/pyroscope/operations/pyroscope 26 27 # create a monolithic environment 28 tk env add --namespace pyroscope-mono --server https://localhost:6443 environments/pyroscope-mono 29 cat > environments/pyroscope-mono/main.jsonnet <<EOF 30 local pyroscope = import 'pyroscope/jsonnet/pyroscope/pyroscope.libsonnet'; 31 32 pyroscope.new(name='mono', overrides={ 33 namespace: 'pyroscope', 34 values+: { 35 pyroscope+: { 36 nameOverride: 'mono', 37 }, 38 }, 39 }) 40 EOF 41 tk export rendered-mono environments/pyroscope-mono 42 ls -l rendered-mono 43 44 # create a micro-services environment 45 tk env add --namespace pyroscope-micro --server https://localhost:6443 environments/pyroscope-micro 46 cat > environments/pyroscope-micro/main.jsonnet <<EOF 47 local pyroscope = import 'pyroscope/jsonnet/pyroscope/pyroscope.libsonnet'; 48 local valuesMicroServices = import 'pyroscope/jsonnet/values-micro-services.json'; 49 50 pyroscope.new(name='micro', overrides={ 51 namespace: 'pyroscope-micro', 52 values+: valuesMicroServices { 53 pyroscope+: { 54 nameOverride: 'micro', 55 }, 56 }, 57 }) 58 EOF 59 tk export rendered-micro environments/pyroscope-micro 60 ls -l rendered-micro 61