Ver Fonte

Add support for hostpath volumes

Waqar Ahmed há 4 anos atrás
pai
commit
1766eb1aaf

+ 29 - 0
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

+ 18 - 2
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 }}

+ 1 - 1
charts/ix-chart/2009.0.1/templates/external-interfaces.yaml.py → 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

+ 3 - 0
charts/ix-chart/2009.0.1/values.yaml

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