Add ability to add external ifaces using macvlan

This commit is contained in:
Waqar Ahmed 2020-10-02 23:23:20 +05:00
parent 057ab72ff0
commit 08b3e9e5c9
5 changed files with 68 additions and 0 deletions

View File

@ -82,3 +82,44 @@
schema:
type: string
required: true
# Networking options
- variable: externalInterfaces
description: "Add External Interfaces"
label: "Add external Interfaces"
group: "Networking"
schema:
type: list
items:
- variable: interfaceConfiguration
description: "Interface Configuration"
label: "Interface Configuration"
schema:
type: dict
$ref:
- "normalise/interfaceConfiguration"
attrs:
- variable: hostInterface
description: "Please specify host interface"
label: "Host Interface"
schema:
type: string
required: true
$ref:
- "definitions/interface"
- variable: ipam
description: "Define how IP Address will be managed"
label: "IP Address Management"
schema:
type: dict
required: true
attrs:
- variable: type
description: "Specify type for IPAM"
label: "IPAM Type"
schema:
type: string
required: true
enum:
- "dhcp"
- "static"

View File

@ -61,3 +61,10 @@ Create the name of the service account to use
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
{{/*
Name for external interfaces to be added to chart
*/}}
{{- define "externalInterfaceName" -}}
{{- printf "%s" .Release.Name }}
{{- end }}

View File

@ -12,6 +12,14 @@ spec:
metadata:
labels:
{{- include "ix-chart.selectorLabels" . | nindent 8 }}
annotations:
rollme: {{ randAlphaNum 5 | quote }}
{{- if .Values.externalInterfaces }}
k8s.v1.cni.cncf.io/networks:
{{- range $index, $iface := .Values.externalInterfaces }}
- {{ include "externalInterfaceName" . }}-{{ $index }}
{{- end }}
{{- end }}
spec:
containers:
- name: {{ .Chart.Name }}

View File

@ -0,0 +1,9 @@
{{- range $index, $iface := .Values.externalInterfaces }}
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: {{ include "externalInterfaceName" . }}-{{ $index }}
spec:
config: '{{ $iface }}'
----------------------------------------------------------
{{- end }}

View File

@ -10,3 +10,6 @@ image:
containerCommand: []
containerArgs: []
containerEnvironmentVariables: []
# Network related configuration
externalInterfaces: []