Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@vfarcic
Last active August 9, 2022 11:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vfarcic/c09d2657583afd75e38522b66776f785 to your computer and use it in GitHub Desktop.
Save vfarcic/c09d2657583afd75e38522b66776f785 to your computer and use it in GitHub Desktop.
# Source: https://gist.github.com/c09d2657583afd75e38522b66776f785
###################################
# Helm And Kustomize Replacement? #
# Jsonnet With Grafana Tanka #
# https://youtu.be/-qpcsUXElYc #
###################################
# Additional Info:
# - Jsonnet: https://jsonnet.org
# - Grafana Tanka: https://grafana.com/oss/tanka
#########
# Setup #
#########
# Create a Kubernetes cluster (any should do)
# Install `tk` and `jb` CLIs from https://tanka.dev/install
git clone https://github.com/vfarcic/tanka-demo
cd tanka-demo
export CURRENT_CONTEXT=$(kubectl \
config current-context)
export API_SERVER=$(kubectl config view \
--raw --minify --flatten \
--output jsonpath="{.clusters[?(@.name == \"$CURRENT_CONTEXT\")].cluster.server}")
# Install `jq` CLI from https://stedolan.github.io/jq/download/
cat environments/production/spec.json \
| jq ".spec.apiServer = \"$API_SERVER\"" \
| tee environments/production/spec.json
cat environments/libs/spec.json \
| jq ".spec.apiServer = \"$API_SERVER\"" \
| tee environments/libs/spec.json
###################################
# Jsonnet With Grafana Tanka Demo #
###################################
ls -1
# `tk init` creates the initial folder structure and files
tk eval environments/production
tk show environments/production
tk apply environments/production
kubectl --namespace production get all,ingresses
cat environments/production/kubernetes.libsonnet
cat environments/production/silly-demo.Jsonnet
cat environments/production/devops-toolkit.Jsonnet
cat environments/production/main.Jsonnet
cat environments/production/spec.json
cat environments/production/kubernetes.libsonnet
cat environments/libs/main.Jsonnet
tk show environments/libs
###########
# Destroy #
###########
tk delete environments/production
# Destroy or reset the cluster
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment