mirror of
https://github.com/truecharts/library-charts.git
synced 2026-07-04 15:31:22 -03:00
add annotations
This commit is contained in:
103
library/common/1.0.0/templates/lib/_annotations.md
Normal file
103
library/common/1.0.0/templates/lib/_annotations.md
Normal file
@@ -0,0 +1,103 @@
|
||||
# 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"
|
||||
```
|
||||
30
library/common/1.0.0/templates/lib/_annotations.tpl
Normal file
30
library/common/1.0.0/templates/lib/_annotations.tpl
Normal file
@@ -0,0 +1,30 @@
|
||||
{{/*
|
||||
These annotations will be shared on all objects
|
||||
*/}}
|
||||
{{- define "ix.common.annotations" -}}
|
||||
{{- with .Values.global.annotations -}}
|
||||
{{- range $k, $v := . }}
|
||||
{{ $k }}: {{ tpl $v $ | quote }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
These annotations will be applied to all workload "spec" objects
|
||||
*/}}
|
||||
{{- define "ix.common.annotations.workload.spec" -}}
|
||||
{{- if .Values.ixExternalInterfacesConfigurationNames }}
|
||||
k8s.v1.cni.cncf.io/networks: {{ join ", " .Values.ixExternalInterfacesConfigurationNames }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
These annotations will be applied to all workload objects
|
||||
*/}}
|
||||
{{- define "ix.common.annotations.workload" -}}
|
||||
rollme: {{ randAlphaNum 5 | quote }}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Workloads = Deployment, ReplicaSet, StatefulSet, DaemonSet, Job, CronJob, etc
|
||||
*/}}
|
||||
Reference in New Issue
Block a user