{{- if not .Values.jsonServer.seedData.existingConfigMap }} apiVersion: v1 kind: ConfigMap metadata: name: {{ .Release.Name }}-configmap data: index.html: | JSON Server

Congrats!

You're successfully running JSON Server
✧*。٩(ˊᗜˋ*)و✧*。

update.sh: | #!/bin/sh while getopts u: flag do case "${flag}" in u) URL=${OPTARG};; esac done [ $(curl -kLs -w "%{http_code}" -o /dev/null https://$URL) != 200 ] && { echo 'Could not connect to' $URL exit 1 } echo '['$(date "+%Y-%m-%d %H:%M:%S")'] Started polling helm releases with 60 second interval' while sleep 60; do echo '['$(date "+%Y-%m-%d %H:%M:%S")']' $(curl -ks https://$URL/components | jq length) 'known releases in database' echo -n $(helm list --all-namespaces --output json | jq -c '.[]') | while IFS= read -r release; do APP_NAME=$(echo $release | jq -r '.name') APP_ID=$(curl -ks https://$URL/components?name=$APP_NAME | jq -r '.[0].id') # Release is not yet in database [ "$APP_ID" == null ] && { curl -ks -X POST https://$URL/components -H 'Content-Type: application/json' --data "$release" } # Release is already in database [ "$APP_ID" != null ] && { curl -ks -X PATCH https://$URL/components/$APP_ID -H 'Content-Type: application/json' --data "$release" } done done db.json: | {{ include "common.tplvalues.render" ( dict "value" .Values.jsonServer.seedData.configInline "context" $) | indent 4 }} {{- end -}}