From f1e0a25d1c843335e7130892d3ff1977a66820d0 Mon Sep 17 00:00:00 2001 From: djpbessems Date: Wed, 28 Feb 2024 21:31:23 +1100 Subject: [PATCH] chore: Remove redundant chart templating --- .../spamasaurusrex/templates/configmap.yaml | 96 ------------------- .../spamasaurusrex/templates/deployment.yaml | 38 +------- 2 files changed, 2 insertions(+), 132 deletions(-) delete mode 100644 charts/spamasaurusrex/templates/configmap.yaml diff --git a/charts/spamasaurusrex/templates/configmap.yaml b/charts/spamasaurusrex/templates/configmap.yaml deleted file mode 100644 index e549176..0000000 --- a/charts/spamasaurusrex/templates/configmap.yaml +++ /dev/null @@ -1,96 +0,0 @@ -{{- 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/bash - - while getopts u: flag - do - case "${flag}" in - u) URL=${OPTARG};; - esac - done - - [[ $(getent hosts $URL) ]] || { - echo 'Could not resolve' $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' - - for entry in $(helm list --all-namespaces --output json | jq -r '.[] | @base64'); do - RELEASE=$(echo $entry | base64 -d | jq -cS '.type="helm" | del(.namespace, .revision, .status)') - 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" -o /dev/null - } - # Release is already in database - [ "$APP_ID" != null ] && { - curl -ks -X PATCH https://$URL/components/$APP_ID -H 'Content-Type: application/json' --data "$RELEASE" -o /dev/null - } - done - - done - db.json: | -{{ include "common.tplvalues.render" ( dict "value" .Values.jsonServer.seedData.configInline "context" $) | indent 4 }} -{{- end -}} diff --git a/charts/spamasaurusrex/templates/deployment.yaml b/charts/spamasaurusrex/templates/deployment.yaml index 188d5e8..3ed3e38 100644 --- a/charts/spamasaurusrex/templates/deployment.yaml +++ b/charts/spamasaurusrex/templates/deployment.yaml @@ -29,8 +29,8 @@ spec: - name: {{ .Chart.Name }} securityContext: {{- toYaml .Values.securityContext | nindent 12 }} - image: "{{ .Values.jsonServer.image.repository }}:{{ .Values.jsonServer.image.tag | default .Chart.AppVersion }}" - imagePullPolicy: {{ .Values.jsonServer.image.pullPolicy }} + image: "{{ .Values.spamasaurusRex.image.repository }}:{{ .Values.spamasaurusRex.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.spamasaurusRex.image.pullPolicy }} ports: - name: http containerPort: {{ .Values.service.port }} @@ -45,40 +45,6 @@ spec: port: http resources: {{- toYaml .Values.resources | nindent 12 }} - volumeMounts: - - name: {{ .Release.Name }}-configmap - mountPath: /data/db.json - subPath: db.json - - name: {{ .Release.Name }}-configmap - mountPath: /usr/local/lib/node_modules/spamasaurusrex/public/index.html - subPath: index.html - - name: {{ .Chart.Name }}-sidecar - securityContext: - {{- toYaml .Values.securityContext | nindent 12 }} - image: "{{ .Values.sidecar.image.repository }}:{{ .Values.sidecar.image.tag }}" - imagePullPolicy: {{ .Values.sidecar.image.pullPolicy }} - resources: - {{- toYaml .Values.resources | nindent 12 }} - command: - - /bin/bash - - -c - - "/opt/update.sh -u {{ .Values.sidecar.targetUrl }}" - volumeMounts: - - name: {{ .Release.Name }}-configmap - mountPath: /opt/update.sh - subPath: update.sh - volumes: - - name: {{ .Release.Name }}-configmap - configMap: - name: {{ .Release.Name }}-configmap - items: - - key: db.json - path: db.json - - key: index.html - path: index.html - - key: update.sh - path: update.sh - mode: 0744 {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }}