Example for helm values in fleet.yaml

This commit is contained in:
Mario Manno 2022-12-02 15:27:04 +01:00
parent e72b4c1015
commit a012674ae3
5 changed files with 85 additions and 0 deletions

View File

@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/

View File

@ -0,0 +1,6 @@
apiVersion: v2
name: sleeper-chart
description: A test chart
type: application
version: 0.1.0
appVersion: "1.16.0"

View File

@ -0,0 +1,27 @@
helm:
# It is possible to specify the keys and values as gotpl strings for advanced templating needs.
# Most of the functions from sprig templating library is available.
# The template context has following keys.
# `.ClusterValues` are retrieved from target cluster's `spec.templateValues`
# `.ClusterLabels` and `.ClusterAnnotations` are the labels and annoations in the cluster resource.
# `.ClusterName` as the fleet's cluster resource name.
# `.ClusterNamespace` as the namespace which the cluster resource exists.
values:
name: name-{{ .ClusterName }}
namespace: |
{{ .ClusterNamespace }}{{ uuidv4 }}
labels: |
{{- .ClusterLabels | toJson }}
clusterValues: |
{{- .ClusterValues | toJson }}
image:
# hasKey, default .Attr not working
# clusterLabels is not a Dictionary
pullPolicy: |
{{ if hasKey .ClusterValues "policy" }}{{.ClusterValues.policy}}{{else}}"IfNotPresent"{{end}}
repository: |-
{{if index .ClusterLabels "repository"}}{{.ClusterLabels.repository}}{{else}}rancher/mirrored-library-busybox{{end}}
other: |
{{ index .ClusterLabels "policy" }}
# http://masterminds.github.io/sprig/
annotations: "{{ list 1 1 1 2 | uniq }}"

View File

@ -0,0 +1,18 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: sleeper
data:
name: {{ .Values.name }}
namespace: {{ .Values.namespace }}
labels: |
# configmaps can only contain strings, toJson for debug:
{{ .Values.labels | toJson }}
clusterValues: |
{{ .Values.clusterValues | toJson }}
global: |
{{ .Values.global | toJson }}
annotations: |
{{ .Values.annotations | toJson }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}

View File

@ -0,0 +1,11 @@
name: ""
namespace: ""
labels: ""
clusterValues: ""
image:
repository: rancher/mirrored-library-busybox
pullPolicy: IfNotPresent
tag: "1.34.1"
annotations: ["test"]