Add support for hostpath volumes

This commit is contained in:
Waqar Ahmed 2020-10-04 23:57:07 +05:00
parent 03a5ce89e9
commit 1766eb1aaf
4 changed files with 51 additions and 3 deletions

View File

@ -157,3 +157,32 @@
type: ipaddr
cidr: false
required: true
# Storage Options
# Host path based volumes
- variable: hostPathVolumes
label: "Host Path Volumes"
schema:
type: list
items:
- variable: hostPathConfiguration
label: "Host Path Configuration"
schema:
type: dict
attrs:
- variable: hostPath
label: "Host Path"
schema:
type: hostpath
required: true
- variable: mountPath
label: "Mount Path"
description: "Path where host path will be mounted inside the pod"
schema:
type: path
required: true
- variable: readOnly
label: "Read Only"
schema:
type: boolean
default: false

View File

@ -14,12 +14,20 @@ spec:
{{- include "ix-chart.selectorLabels" . | nindent 8 }}
annotations:
rollme: {{ randAlphaNum 5 | quote }}
{{- if .Values.externalInterfacesConfigurationNames }}
k8s.v1.cni.cncf.io/networks: {{ join ", " .Values.externalInterfacesConfigurationNames }}
{{- if .Values.ixExternalInterfacesConfigurationNames }}
k8s.v1.cni.cncf.io/networks: {{ join ", " .Values.ixExternalInterfacesConfigurationNames }}
{{- end }}
spec:
containers:
- name: {{ .Chart.Name }}
{{- if .Values.hostPathVolumes }}
volumeMounts:
{{- range $index, $hostPathConfiguration := .Values.hostPathVolumes }}
- mountPath: {{ $hostPathConfiguration.mountPath }}
name: ix-host-path-{{ $.Release.Name }}-{{ $index }}
readOnly: {{ $hostPathConfiguration.readOnly }}
{{- end }}
{{- end }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default "latest" }}"
@ -43,3 +51,11 @@ spec:
value: {{ .value | quote }}
{{- end }}
{{- end }}
{{- if .Values.hostPathVolumes }}
volumes:
{{- range $index, $hostPathConfiguration := .Values.hostPathVolumes }}
- name: ix-host-path-{{ $.Release.Name }}-{{ $index }}
hostPath:
path: {{ $hostPathConfiguration.hostPath }}
{{- end }}
{{- end }}

View File

@ -1,4 +1,4 @@
{{- range $index, $iface := .Values.externalInterfacesConfiguration }}
{{- range $index, $iface := .Values.ixExternalInterfacesConfiguration }}
---
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition

View File

@ -13,3 +13,6 @@ containerEnvironmentVariables: []
# Network related configuration
externalInterfaces: []
# Storage related configuration
hostPathVolumes: []