Browse Source

HPCC-24121 NFS Helm chart example

Signed-off-by: Jake Smith <jake.smith@lexisnexisrisk.com>
Jake Smith 5 years ago
parent
commit
0abce8089a

+ 25 - 0
dockerfiles/examples/nfs/README.md

@@ -0,0 +1,25 @@
+# HPCC NFS storage
+
+## Directory contents
+
+### hpcc-nfs/
+
+The hpcc-nfs helm chart will provision a NFS Server and optionally a default shared PVC using the default Storage Class.It will also creates a Persistent Volume Claim for each of the required HPCC storage types.
+
+The use case for using this helm chart is where either no ReadWriteMany storage classes are availale on the K8s implementation being targeted, or that the ReadWriteMany storage class available is expensive or inflexible.
+For example, under GKE(Google Kubernetes Engine), ReadWriteMany volumes can be provisioned with their 'Filestore' storage class, however, the minimum capacity is 1TB.
+
+
+Example use:
+
+helm install nfsstorage hpcc-nfs/
+helm install myhpcc hpcc/ --set global.image.version=latest -f examples/local/values-nfs.yaml
+
+### values-nfs.yaml
+
+An example values file to be supplied when installing the HPCC chart.
+NB: Either use the output auto-generated when installing the "hpcc-nfs" helm chart, or ensure the names in your values files for the storage types matched the PVC names created.
+
+### Notes
+
+The main use case for this example is with GKE (Google Kubernetes Engine).

+ 23 - 0
dockerfiles/examples/nfs/hpcc-nfs/.helmignore

@@ -0,0 +1,23 @@
+# Patterns to ignore when building packages.
+# This supports shell glob matching, relative path matching, and
+# negation (prefixed with !). Only one pattern per line.
+.DS_Store
+# Common VCS dirs
+.git/
+.gitignore
+.bzr/
+.bzrignore
+.hg/
+.hgignore
+.svn/
+# Common backup files
+*.swp
+*.bak
+*.tmp
+*.orig
+*~
+# Various IDEs
+.project
+.idea/
+*.tmproj
+.vscode/

+ 6 - 0
dockerfiles/examples/nfs/hpcc-nfs/Chart.yaml

@@ -0,0 +1,6 @@
+apiVersion: v2
+name: hpcc-nfs
+description: A Helm chart to provision HPCC PVC's using an NFS deployment as shared storage
+type: application
+version: 0.1.0
+appVersion: 1.16.0

+ 22 - 0
dockerfiles/examples/nfs/hpcc-nfs/templates/NOTES.txt

@@ -0,0 +1,22 @@
+{{- $dllPvcName := printf "dll-%s-pvc" (include "hpcc-nfs.fullname" $) }}
+{{- $daliPvcName := printf "dali-%s-pvc" (include "hpcc-nfs.fullname" $) }}
+{{- $dataPvcName := printf "data-%s-pvc" (include "hpcc-nfs.fullname" $) }}
+
+# Nfs server deployed.
+# Persistent Volume Claims created: {{ $dllPvcName }}, {{ $daliPvcName }}, {{ $dataPvcName }}
+# 
+# Pass a values yaml to the hpcc helm chart to use these existing claims.
+# The generated content below can be used for that value yaml file.
+
+storage:
+  dllStorage:
+    existingClaim: "{{ $dllPvcName }}"
+    forcePermissions: true
+
+  daliStorage:
+    existingClaim: "{{ $daliPvcName }}"
+    forcePermissions: true
+
+  dataStorage:
+    existingClaim: "{{ $dataPvcName }}"
+    forcePermissions: true

+ 20 - 0
dockerfiles/examples/nfs/hpcc-nfs/templates/_helpers.tpl

@@ -0,0 +1,20 @@
+{{/* vim: set filetype=mustache: */}}
+
+{{/*
+Create a default fully qualified app name.
+We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
+If release name contains chart name it will be used as a full name.
+*/}}
+{{- define "hpcc-nfs.fullname" -}}
+{{- if .Values.fullnameOverride -}}
+{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
+{{- else -}}
+{{- $name := default .Chart.Name .Values.nameOverride -}}
+{{- if contains $name .Release.Name -}}
+{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
+{{- else -}}
+{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+{{- end -}}
+{{- end -}}
+

+ 75 - 0
dockerfiles/examples/nfs/hpcc-nfs/templates/hpcc-volumes.yaml

@@ -0,0 +1,75 @@
+{{- $serverName := (include "hpcc-nfs.fullname" $) }}
+apiVersion: v1
+kind: PersistentVolume
+metadata:
+  name: {{ printf "dll-%s-pv" (include "hpcc-nfs.fullname" $) }}
+spec:
+  capacity:
+    storage: {{ .Values.dllStorage.size }}
+  accessModes:
+    - ReadWriteMany
+  nfs:
+    server: {{ printf "%s.default.svc.cluster.local" $serverName }}
+    path: "/"
+---
+apiVersion: v1
+kind: PersistentVolumeClaim
+metadata:
+  name: {{ printf "dll-%s-pvc" (include "hpcc-nfs.fullname" $) }}
+spec:
+  accessModes:
+    - ReadWriteMany
+  storageClassName: ""
+  resources:
+    requests:
+      storage: {{ .Values.dllStorage.size }}
+---
+apiVersion: v1
+kind: PersistentVolume
+metadata:
+  name: {{ printf "data-%s-pv" (include "hpcc-nfs.fullname" $) }}
+spec:
+  capacity:
+    storage: {{ .Values.dataStorage.size }}
+  accessModes:
+    - ReadWriteMany
+  nfs:
+    server: {{ printf "%s.default.svc.cluster.local" $serverName }}
+    path: "/"
+---
+apiVersion: v1
+kind: PersistentVolumeClaim
+metadata:
+  name: {{ printf "data-%s-pvc" (include "hpcc-nfs.fullname" $) }}
+spec:
+  accessModes:
+    - ReadWriteMany
+  storageClassName: ""
+  resources:
+    requests:
+      storage: {{ .Values.dataStorage.size }}
+---
+apiVersion: v1
+kind: PersistentVolume
+metadata:
+  name: {{ printf "dali-%s-pv" (include "hpcc-nfs.fullname" $) }}
+spec:
+  capacity:
+    storage: {{ .Values.daliStorage.size }}
+  accessModes:
+    - ReadWriteMany
+  nfs:
+    server: {{ printf "%s.default.svc.cluster.local" $serverName }}
+    path: "/"
+---
+apiVersion: v1
+kind: PersistentVolumeClaim
+metadata:
+  name: {{ printf "dali-%s-pvc" (include "hpcc-nfs.fullname" $) }}
+spec:
+  accessModes:
+    - ReadWriteMany
+  storageClassName: ""
+  resources:
+    requests:
+      storage: {{ .Values.daliStorage.size }}

+ 52 - 0
dockerfiles/examples/nfs/hpcc-nfs/templates/nfs-server.yaml

@@ -0,0 +1,52 @@
+{{- $serverName := (include "hpcc-nfs.fullname" $) }}
+{{- $pvcName := $.Values.sharedStorage.existingClaim | default (printf "%s-pvc" (include "hpcc-nfs.fullname" $)) }}
+apiVersion: extensions/v1beta1
+kind: Deployment
+metadata:
+  name: {{ $serverName }}
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      server: {{ $serverName }}
+  template:
+    metadata:
+      labels:
+        server: {{ $serverName }}
+    spec:
+      securityContext:
+        fsGroup: 1000
+      containers:
+      - name: {{ $serverName }}
+        image: gcr.io/google_containers/volume-nfs:0.8
+        ports:
+          - name: nfs
+            containerPort: 2049
+          - name: mountd
+            containerPort: 20048
+          - name: rpcbind
+            containerPort: 111
+        securityContext:
+          privileged: true
+        volumeMounts:
+          - mountPath: /data
+            name: nfs-pvc
+      volumes:
+        - name: nfs-pvc
+          persistentVolumeClaim:
+            claimName: {{ $pvcName }}
+---
+apiVersion: v1
+kind: Service
+metadata:
+  name: {{ $serverName }}
+spec:
+  ports:
+    - name: nfs
+      port: 2049
+    - name: mountd
+      port: 20048
+    - name: rpcbind
+      port: 111
+  selector:
+    server: {{ $serverName }}

+ 13 - 0
dockerfiles/examples/nfs/hpcc-nfs/templates/nfs-volume.yaml

@@ -0,0 +1,13 @@
+{{- if (not $.Values.sharedStorage.existingClaim) }}
+{{- $pvcName := printf "%s-pvc" (include "hpcc-nfs.fullname" $) }}
+apiVersion: v1
+kind: PersistentVolumeClaim
+metadata:
+  name: {{ $pvcName }}
+spec:
+  accessModes:
+    - ReadWriteOnce
+  resources:
+    requests:
+      storage: {{ .Values.sharedStorage.size }}
+{{- end }}

+ 44 - 0
dockerfiles/examples/nfs/hpcc-nfs/values.schema.json

@@ -0,0 +1,44 @@
+{
+  "$schema": "https://json-schema.org/draft-07/schema#",
+  "additionalProperties": false,
+  "properties": {
+    "sharedStorage": {
+      "type": "object",
+      "properties": {
+        "size": {
+          "type": "string"
+        },
+        "existingClaim": {
+          "type": "string"
+        }
+      },
+      "additionalProperties": false
+    },
+    "dllStorage": {
+      "$ref": "#/definitions/storage"
+    },
+    "dataStorage": {
+      "$ref": "#/definitions/storage"
+    },
+    "daliStorage": {
+      "$ref": "#/definitions/storage"
+    }
+  },
+  "title": "Values",
+  "type": "object",
+  "definitions": {
+    "storage": {
+      "type": "object",
+      "required": [ "size" ],
+      "properties": {
+        "size": {
+          "type": "string"
+        },
+        "sku": {
+          "type": "string"
+        }
+      },
+      "additionalProperties": false
+    }
+  }
+}

+ 17 - 0
dockerfiles/examples/nfs/hpcc-nfs/values.yaml

@@ -0,0 +1,17 @@
+# Default values for hpcc-nfs.
+
+sharedStorage:
+  size: 2Gi 
+  #existingClaim: myexistingclaim
+
+# NB: the sum of the size's below should be <= the sharedStorage size
+
+dllStorage:
+  size: 512Mi
+
+daliStorage:
+  size: 512Mi
+
+dataStorage:
+  size: 1Gi
+

+ 20 - 0
dockerfiles/examples/nfs/values-nfs.yaml

@@ -0,0 +1,20 @@
+# Overrides for storage in hpcc hpcc, using nfs PVC's.
+# NB: The "hpcc-nfs" helm charts should be installed 1st.
+#
+# The "hpcc-nfs" helm chart provisions and creates the
+# PVC's required by HPCC.
+# The pvc names are dynamic based on the install name.
+# In this example the install name was "nfsstorage"
+
+storage:
+  dllStorage:
+    existingClaim: dll-nfsstorage-hpcc-nfs-pvc
+    forcePermissions: true
+
+  daliStorage:
+    existingClaim: dali-nfsstorage-hpcc-nfs-pvc
+    forcePermissions: true
+
+  dataStorage:
+    existingClaim: data-nfsstorage-hpcc-nfs-pvc
+    forcePermissions: true