mirror of
https://github.com/truecharts/library-charts.git
synced 2026-07-05 03:56:21 -03:00
add names, remove docs (will be added in different format)
This commit is contained in:
@@ -1,103 +0,0 @@
|
||||
# Annotations
|
||||
|
||||
These named functions will usually be called into other common templates.
|
||||
Chances for these to be called directly in an application chart should be non-existent.
|
||||
|
||||
So some example inputs, should not be considered that will be used in a values.yaml.
|
||||
|
||||
---
|
||||
|
||||
## ix.common.annotations
|
||||
|
||||
Input:
|
||||
|
||||
Values.yaml
|
||||
|
||||
```yaml
|
||||
global:
|
||||
annotations:
|
||||
annotation1: hard_value
|
||||
annotation2: "{{ .Values.key }}"
|
||||
|
||||
key: value
|
||||
```
|
||||
|
||||
Output:
|
||||
|
||||
```yaml
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
annotations:
|
||||
|
||||
annotation1: "hard_value"
|
||||
annotation2: "value"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## ix.common.annotations.workload.spec
|
||||
|
||||
Inputs:
|
||||
|
||||
Values.yaml
|
||||
|
||||
```yaml
|
||||
ixExternalInterfacesConfigurationNames:
|
||||
- iface1
|
||||
- iface2
|
||||
```
|
||||
|
||||
Template file
|
||||
|
||||
```yaml
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
...
|
||||
spec:
|
||||
template:
|
||||
metadata:
|
||||
annotations:
|
||||
{{- include "ix.common.annotations.workload.spec" $ | nindent 8 }}
|
||||
```
|
||||
|
||||
Output:
|
||||
|
||||
```yaml
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
spec:
|
||||
template:
|
||||
metadata:
|
||||
annotations:
|
||||
|
||||
k8s.v1.cni.cncf.io/networks: iface1, iface2
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## ix.common.annotations.workload
|
||||
|
||||
Input:
|
||||
|
||||
Template file
|
||||
|
||||
```yaml
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
annotations:
|
||||
{{- include "ix.common.annotations.workload" $ | nindent 4 }}
|
||||
```
|
||||
|
||||
Output:
|
||||
|
||||
```yaml
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
annotations:
|
||||
rollme: "aqG2v"
|
||||
```
|
||||
@@ -1,5 +1,6 @@
|
||||
{{/*
|
||||
These annotations will be shared on all objects
|
||||
Rendered under ".metadata.annotations"
|
||||
*/}}
|
||||
{{- define "ix.common.annotations" -}}
|
||||
{{- with .Values.global.annotations -}}
|
||||
@@ -10,7 +11,8 @@ These annotations will be shared on all objects
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
These annotations will be applied to all workload "spec" objects
|
||||
These annotations will be applied to all "workload" "spec" objects
|
||||
Rendered under ".spec.template.metadata.annotations"
|
||||
*/}}
|
||||
{{- define "ix.common.annotations.workload.spec" -}}
|
||||
{{- if .Values.ixExternalInterfacesConfigurationNames }}
|
||||
@@ -19,7 +21,8 @@ k8s.v1.cni.cncf.io/networks: {{ join ", " .Values.ixExternalInterfacesConfigurat
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
These annotations will be applied to all workload objects
|
||||
These annotations will be applied to all "workload" objects
|
||||
Rendered under ".metadata.annotations"
|
||||
*/}}
|
||||
{{- define "ix.common.annotations.workload" -}}
|
||||
rollme: {{ randAlphaNum 5 | quote }}
|
||||
68
library/common/1.0.0/templates/lib/chart/_names.tpl
Normal file
68
library/common/1.0.0/templates/lib/chart/_names.tpl
Normal file
@@ -0,0 +1,68 @@
|
||||
{{/*
|
||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||
global.nameOverride applies to the current chart and all sub-charts
|
||||
nameOverride applies only to the current chart
|
||||
*/}}
|
||||
|
||||
{{/*
|
||||
Expand ther name of the chart
|
||||
*/}}
|
||||
{{- define "ix.common.names.name" -}}
|
||||
{{- $globalNameOverride := "" -}}
|
||||
{{- if hasKey .Values "global" -}}
|
||||
{{/* Set to global.nameOverride if set, else set to empty */}}
|
||||
{{- $globalNameOverride = (default $globalNameOverride .Values.global.nameOverride) -}}
|
||||
{{- end -}}
|
||||
{{/* Order of preference: global.nameOverride -> nameOverride -> Chart.Name */}}
|
||||
{{- default .Chart.Name (default .Values.nameOverride $globalNameOverride) | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
*/}}
|
||||
{{- define "ix.common.names.fullname" -}}
|
||||
{{- $name := include "ix.common.names.name" . -}}
|
||||
{{- $globalFullNameOverride := "" -}}
|
||||
{{- if hasKey .Values "global" -}}
|
||||
{{- $globalFullNameOverride = (default $globalFullNameOverride .Values.global.fullnameOverride) -}}
|
||||
{{- end -}}
|
||||
{{- if or .Values.fullnameOverride $globalFullNameOverride -}}
|
||||
{{- $name = default .Values.fullnameOverride $globalFullNameOverride -}}
|
||||
{{- else -}}
|
||||
{{- if contains $name .Release.Name -}}
|
||||
{{- $name = .Release.Name -}}
|
||||
{{- else -}}
|
||||
{{- $name = printf "%s-%s" .Release.Name $name -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- trunc 63 $name | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the properly cased vresion of the controller type
|
||||
*/}}
|
||||
{{- define "ix.common.names.controllerType" -}}
|
||||
{{- if eq .Values.controller.type "deployment" -}}
|
||||
{{- print "Deployment" -}}
|
||||
{{- else if eq .Values.controller.type "daemonset" -}}
|
||||
{{- print "DaemonSet" -}}
|
||||
{{- else if eq .Values.controller.type "statefulset" -}}
|
||||
{{- print "StatefulSet" -}}
|
||||
{{- else -}}
|
||||
{{- fail (printf "Not a valid controller.type (%s)" .Values.controller.type) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create the "name" + "." + "namespace" fqdn
|
||||
*/}}
|
||||
{{- define "ix.common.names.fqdn" -}}
|
||||
{{- printf "%s.%s" (include "tc.common.names.fullname" .) .Release.Namespace | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create the "fqdn" + "." + "svc.cluster.local"
|
||||
*/}}
|
||||
{{- define "ix.common.names.fqdn" -}}
|
||||
{{- printf "%s.%s" (include "ix.common.names.fqdn" .) ".svc.cluster.local" -}}
|
||||
{{- end -}}
|
||||
@@ -1,7 +1,16 @@
|
||||
global:
|
||||
# -- Set additional global annotations. Helm templates can be used.
|
||||
# -- Sets an override for the suffix of the full name (Applies to current chart and all sub-charts)
|
||||
nameOverride: ""
|
||||
# -- Sets additional global annotations. Helm templates can be used.
|
||||
annotations: {}
|
||||
|
||||
# -- Sets an override for the suffix of the full name (Applies to current chart only)
|
||||
nameOverride: ""
|
||||
|
||||
ixExternalInterfacesConfigurationNames: []
|
||||
# - iface1
|
||||
# - iface2
|
||||
# - interface1
|
||||
# - interface2
|
||||
|
||||
controller:
|
||||
# Valid options are: deployment | daemonset | statefulset
|
||||
type: deployment
|
||||
|
||||
Reference in New Issue
Block a user