From 1766eb1aafe01e7cdb9f5863c5a6ccbaefee5c84 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Sun, 4 Oct 2020 23:57:07 +0500 Subject: [PATCH] Add support for hostpath volumes --- charts/ix-chart/2009.0.1/questions.yaml | 29 +++++++++++++++++++ .../2009.0.1/templates/deployment.yaml | 20 +++++++++++-- ...faces.yaml.py => external-interfaces.yaml} | 2 +- charts/ix-chart/2009.0.1/values.yaml | 3 ++ 4 files changed, 51 insertions(+), 3 deletions(-) rename charts/ix-chart/2009.0.1/templates/{external-interfaces.yaml.py => external-interfaces.yaml} (69%) diff --git a/charts/ix-chart/2009.0.1/questions.yaml b/charts/ix-chart/2009.0.1/questions.yaml index be29b8b3b92..28998637008 100644 --- a/charts/ix-chart/2009.0.1/questions.yaml +++ b/charts/ix-chart/2009.0.1/questions.yaml @@ -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 diff --git a/charts/ix-chart/2009.0.1/templates/deployment.yaml b/charts/ix-chart/2009.0.1/templates/deployment.yaml index 33bdba12bbb..0e92215b151 100644 --- a/charts/ix-chart/2009.0.1/templates/deployment.yaml +++ b/charts/ix-chart/2009.0.1/templates/deployment.yaml @@ -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 }} diff --git a/charts/ix-chart/2009.0.1/templates/external-interfaces.yaml.py b/charts/ix-chart/2009.0.1/templates/external-interfaces.yaml similarity index 69% rename from charts/ix-chart/2009.0.1/templates/external-interfaces.yaml.py rename to charts/ix-chart/2009.0.1/templates/external-interfaces.yaml index 6776e0385af..f68c46f6b17 100644 --- a/charts/ix-chart/2009.0.1/templates/external-interfaces.yaml.py +++ b/charts/ix-chart/2009.0.1/templates/external-interfaces.yaml @@ -1,4 +1,4 @@ -{{- range $index, $iface := .Values.externalInterfacesConfiguration }} +{{- range $index, $iface := .Values.ixExternalInterfacesConfiguration }} --- apiVersion: "k8s.cni.cncf.io/v1" kind: NetworkAttachmentDefinition diff --git a/charts/ix-chart/2009.0.1/values.yaml b/charts/ix-chart/2009.0.1/values.yaml index 8baa57459aa..c8db8d43989 100644 --- a/charts/ix-chart/2009.0.1/values.yaml +++ b/charts/ix-chart/2009.0.1/values.yaml @@ -13,3 +13,6 @@ containerEnvironmentVariables: [] # Network related configuration externalInterfaces: [] + +# Storage related configuration +hostPathVolumes: []