From a5699541b2ea711edec47a43a13a18abe03730ed Mon Sep 17 00:00:00 2001 From: Sebastien Baizet Date: Fri, 20 Sep 2024 10:02:17 +0200 Subject: [PATCH] put genesis config into value file --- .../templates/config-file.yaml | 8 ++-- charts/balance-checker/templates/helpers.tpl | 47 +++++++++++++++++++ charts/scroll-common/Chart.yaml | 2 +- charts/scroll-common/README.md | 8 +++- .../scroll-common/templates/genesis.conf.yaml | 3 +- charts/scroll-common/values.yaml | 2 + 6 files changed, 63 insertions(+), 7 deletions(-) create mode 100644 charts/balance-checker/templates/helpers.tpl diff --git a/charts/balance-checker/templates/config-file.yaml b/charts/balance-checker/templates/config-file.yaml index 1e303f3f..0bde592b 100644 --- a/charts/balance-checker/templates/config-file.yaml +++ b/charts/balance-checker/templates/config-file.yaml @@ -1,10 +1,10 @@ -{{- if .Values.global.isStandalone }} --- apiVersion: v1 kind: ConfigMap metadata: name: balance-checker-config + labels: + {{- include "scroll-sdk.labels" $ | nindent 4 }} data: -{{ (.Files.Glob "configs/balance-checker-config.json").AsConfig | indent 2 }} ---- -{{- end }} + balance-checker-config.json : | +{{ .Values.scrollConfig | indent 4 }} diff --git a/charts/balance-checker/templates/helpers.tpl b/charts/balance-checker/templates/helpers.tpl new file mode 100644 index 00000000..d762ba10 --- /dev/null +++ b/charts/balance-checker/templates/helpers.tpl @@ -0,0 +1,47 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "scroll-sdk.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "scroll-sdk.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} +{{/* +Create chart name and build as used by the chart label. +*/}} +{{- define "scroll-sdk.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} +{{/* +Common labels +*/}} +{{- define "scroll-sdk.labels" -}} +helm.sh/chart: {{ include "scroll-sdk.chart" . }} +{{ include "scroll-sdk.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/build: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} +{{/* +Selector labels +*/}} +{{- define "scroll-sdk.selectorLabels" -}} +app.kubernetes.io/name: {{ include "scroll-sdk.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} diff --git a/charts/scroll-common/Chart.yaml b/charts/scroll-common/Chart.yaml index c99498aa..c6d690aa 100644 --- a/charts/scroll-common/Chart.yaml +++ b/charts/scroll-common/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 description: scroll helm charts to deploy common scripts and configuration name: scroll-common -version: 0.0.2 +version: 0.0.3 appVersion: v0.1.0 kubeVersion: ">=1.22.0-0" maintainers: diff --git a/charts/scroll-common/README.md b/charts/scroll-common/README.md index e06d8e1f..670824e8 100644 --- a/charts/scroll-common/README.md +++ b/charts/scroll-common/README.md @@ -1,6 +1,6 @@ # scroll-common -![Version: 0.0.2](https://img.shields.io/badge/Version-0.0.2-informational?style=flat-square) ![AppVersion: v0.1.0](https://img.shields.io/badge/AppVersion-v0.1.0-informational?style=flat-square) +![Version: 0.0.3](https://img.shields.io/badge/Version-0.0.3-informational?style=flat-square) ![AppVersion: v0.1.0](https://img.shields.io/badge/AppVersion-v0.1.0-informational?style=flat-square) scroll helm charts to deploy common scripts and configuration @@ -20,5 +20,11 @@ Kubernetes: `>=1.22.0-0` |------------|------|---------| | oci://ghcr.io/scroll-tech/scroll-sdk/helm | external-secrets-lib | 0.0.3 | +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| genesisConfig | string | `"{}\n"` | | + ---------------------------------------------- Autogenerated from chart metadata using [helm-docs v1.14.2](https://github.com/norwoodj/helm-docs/releases/v1.14.2) diff --git a/charts/scroll-common/templates/genesis.conf.yaml b/charts/scroll-common/templates/genesis.conf.yaml index 9da8a66e..ea88820f 100644 --- a/charts/scroll-common/templates/genesis.conf.yaml +++ b/charts/scroll-common/templates/genesis.conf.yaml @@ -5,4 +5,5 @@ metadata: {{- include "scroll-common.labels" $ | nindent 4 }} name: genesis-config data: -{{ (.Files.Glob "configs/genesis.json").AsConfig | indent 2 }} + genesis.json: +{{ .Values.genesisConfig indent 4 }} diff --git a/charts/scroll-common/values.yaml b/charts/scroll-common/values.yaml index e69de29b..d2c46199 100644 --- a/charts/scroll-common/values.yaml +++ b/charts/scroll-common/values.yaml @@ -0,0 +1,2 @@ +genesisConfig: | + {}