port external Interfaces from iXOfficial (#525)

* port external Interfaces from iXOfficial

* Fix, Clean and Polish
This commit is contained in:
Kjeld Schouten-Lebbing
2021-05-28 01:22:40 +02:00
committed by GitHub
parent 560832db4b
commit 7f52e732c1
6 changed files with 39 additions and 7 deletions
+1 -1
View File
@@ -19,4 +19,4 @@ name: common
sources:
- https://github.com/truecharts/apps/tree/master/library/common
type: library
version: 5.0.2
version: 5.1.0
@@ -13,8 +13,9 @@ metadata:
{{- with .Values.controller.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.controller.annotations }}
annotations:
{{- include "common.annotations.workload" . | nindent 4 }}
{{- with .Values.controller.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
@@ -24,8 +25,9 @@ spec:
{{- include "common.labels.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- include "common.annotations.workload.spec" . | nindent 8 }}
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
@@ -13,8 +13,9 @@ metadata:
{{- with .Values.controller.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.controller.annotations }}
annotations:
{{- include "common.annotations.workload" . | nindent 4 }}
{{- with .Values.controller.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
@@ -42,8 +43,9 @@ spec:
{{- include "common.labels.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- include "common.annotations.workload.spec" . | nindent 8 }}
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
@@ -31,8 +31,9 @@ metadata:
{{- with .Values.controller.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.controller.annotations }}
annotations:
{{- include "common.annotations.workload" . | nindent 4 }}
{{- with .Values.controller.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
@@ -54,8 +55,9 @@ spec:
serviceName: {{ include "common.names.fullname" . }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- include "common.annotations.workload.spec" . | nindent 8 }}
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
@@ -0,0 +1,15 @@
{{/*
This template serves as a blueprint for External Interface objects that are created
using the SCALE GUI.
*/}}
{{- define "common.classes.externalInterfaces" -}}
{{- range $index, $iface := .Values.externalInterfaces }}
---
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: ix-{{ $.Release.Name }}-{{ $index }}
spec:
config: '{{ $iface }}'
{{- end }}
{{- end -}}
@@ -0,0 +1,11 @@
{{/* Common annotations shared across objects */}}
{{- define "common.annotations.workload.spec" -}}
rollme: {{ randAlphaNum 5 | quote }}
{{- if .Values.externalInterfaces }}
k8s.v1.cni.cncf.io/networks: {{ join ", " .Values.externalInterfaces }}
{{- end }}
{{- end -}}
{{- define "common.annotations.workload" -}}
rollme: {{ randAlphaNum 5 | quote }}
{{- end -}}