Add hash of files and env vars

This commit is contained in:
Nikolai Rodionov 2024-05-21 13:41:43 +02:00
parent 02f726ec8d
commit a9aceae68b
Signed by: allanger
GPG Key ID: 0AA46A90E25592AD
2 changed files with 12 additions and 1 deletions

View File

@ -2,7 +2,7 @@ apiVersion: v2
name: softplayer-lib-workload name: softplayer-lib-workload
description: A library to be reused accross softplayer charts description: A library to be reused accross softplayer charts
type: library type: library
version: 0.1.5 version: 0.1.6
maintainers: maintainers:
- name: allanger - name: allanger
email: allanger@badhouseplants.net email: allanger@badhouseplants.net

View File

@ -2,6 +2,15 @@
This is a builder for deployments This is a builder for deployments
*/}} */}}
{{- define "lib.metadata.hash" -}} {{- /* (define) */ -}}
{{- range $k, $v := .Env -}} {{- /* (1) */ -}}
{{ printf "softplayer.net/env/%s" $k }}: {{ $v.data | toString | sha256sum }}
{{ end -}} {{/* /(1) */}}
{{- range $k, $v := .Files -}} {{- /* (1) */ -}}
{{ printf "softplayer.net/files/%s" $k }}: {{ $v.data | toString | sha256sum }}
{{ end }} {{/* /(1) */}}
{{- end -}} {{- /* /(define) */ -}}
{{- define "deployment.spec" }} {{- /* (define) */}} {{- define "deployment.spec" }} {{- /* (define) */}}
# --------------------------------------------------------------------- # ---------------------------------------------------------------------
# The spec is build within the helm library # The spec is build within the helm library
@ -21,6 +30,8 @@ template:
metadata: metadata:
labels: labels:
{{- include "metadata.labels" . | nindent 6 }} {{- include "metadata.labels" . | nindent 6 }}
annotations:
{{- include "lib.metadata.hash" (dict "Env" $.Values.env "Files" $.Values.files) | nindent 6 }}
spec: spec:
{{- include "helper.workload.securityContext" . | nindent 4 -}} {{- include "helper.workload.securityContext" . | nindent 4 -}}
{{- include "helper.deployment.volumes" . | nindent 4 }} {{- include "helper.deployment.volumes" . | nindent 4 }}