A lot of work on the workload library
This commit is contained in:
23
charts/crds/.helmignore
Normal file
23
charts/crds/.helmignore
Normal 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/
|
8
charts/crds/Chart.yaml
Normal file
8
charts/crds/Chart.yaml
Normal file
@ -0,0 +1,8 @@
|
||||
apiVersion: v2
|
||||
name: softplayer-lib-crd
|
||||
description: A library to be reused accross softplayer charts
|
||||
type: library
|
||||
version: 0.1.0
|
||||
maintainers:
|
||||
- name: allanger
|
||||
email: allanger@badhouseplants.net
|
16
charts/crds/templates/_crds.yaml
Normal file
16
charts/crds/templates/_crds.yaml
Normal file
@ -0,0 +1,16 @@
|
||||
{{- define "lib.crds" -}}
|
||||
{{- range $crd := .Values.crds }}
|
||||
{{ $manifest := $.Files.Get (printf "files/%s.yaml" $crd.file) | fromYaml }}
|
||||
---
|
||||
apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
{{- include "lib.metadata" (dict "Context" $ "customName" $manifest.metadata.name )}}
|
||||
spec:
|
||||
group: {{ $manifest.spec.group }}
|
||||
names:
|
||||
{{ $manifest.spec.names | toYaml | indent 4 }}
|
||||
scope: {{ $manifest.spec.scope }}
|
||||
versions:
|
||||
{{ $manifest.spec.versions | toYaml | indent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
51
charts/crds/templates/_helpers.tpl
Normal file
51
charts/crds/templates/_helpers.tpl
Normal file
@ -0,0 +1,51 @@
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "chart.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 "chart.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 version as used by the chart label.
|
||||
*/}}
|
||||
{{- define "chart.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Common labels
|
||||
*/}}
|
||||
{{- define "chart.labels" -}}
|
||||
helm.sh/chart: {{ include "chart.chart" . }}
|
||||
{{ include "chart.selectorLabels" . }}
|
||||
{{- if .Chart.AppVersion }}
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||
{{- end }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Selector labels
|
||||
*/}}
|
||||
{{- define "chart.selectorLabels" -}}
|
||||
app.kubernetes.io/name: {{ include "chart.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- end }}
|
8
charts/crds/templates/_notes.tpl
Normal file
8
charts/crds/templates/_notes.tpl
Normal file
@ -0,0 +1,8 @@
|
||||
{{- define "lib.notes" -}}
|
||||
*** Release metadata ***
|
||||
Chart: {{ .Chart.Name }}
|
||||
Chart version: {{ .Chart.Version }}
|
||||
App version: {{ .Chart.Version }}
|
||||
Image: {{ index $.Chart.Annotations "helm.badhouseplants.net/registry" }}
|
||||
Release name: {{ .Release.Name }}
|
||||
{{- end }}
|
13
charts/crds/templates/_utils.yaml
Normal file
13
charts/crds/templates/_utils.yaml
Normal file
@ -0,0 +1,13 @@
|
||||
{{- /*
|
||||
lib.util.merge will merge two YAML templates and output the result.
|
||||
This takes an array of three values:
|
||||
- the top context
|
||||
- the template name of the overrides (destination)
|
||||
- the template name of the base (source)
|
||||
*/}}
|
||||
{{- define "lib.util.merge" -}}
|
||||
{{- $top := first . -}}
|
||||
{{- $overrides := fromYaml (include (index . 1) $top) | default (dict ) -}}
|
||||
{{- $tpl := fromYaml (include (index . 2) $top) | default (dict ) -}}
|
||||
{{- toYaml (merge $overrides $tpl) -}}
|
||||
{{- end -}}
|
13
charts/crds/templates/metadata/_base.tpl
Normal file
13
charts/crds/templates/metadata/_base.tpl
Normal file
@ -0,0 +1,13 @@
|
||||
{{- define "lib.metadata" }}
|
||||
metadata:
|
||||
{{- if .customName }}
|
||||
name: {{ .customName }}
|
||||
{{- else }}
|
||||
name: {{ include "chart.fullname" .Context }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{ include "metadata.labels" .Context | indent 4 }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "metadata.customName" -}}
|
||||
{{- end -}}
|
20
charts/crds/templates/metadata/_labels.tpl
Normal file
20
charts/crds/templates/metadata/_labels.tpl
Normal file
@ -0,0 +1,20 @@
|
||||
{{/*
|
||||
Common labels
|
||||
*/}}
|
||||
{{- define "metadata.labels" -}}
|
||||
helm.sh/chart: {{ include "chart.chart" . }}
|
||||
{{ include "chart.selectorLabels" . }}
|
||||
{{- if .Chart.AppVersion }}
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||
{{- end }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Selector labels
|
||||
*/}}
|
||||
{{- define "metadata.selectorLabels" -}}
|
||||
app.kubernetes.io/name: {{ include "chart.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- end }}
|
||||
|
Reference in New Issue
Block a user