浏览代码

Merge pull request #13844 from xwang2713/HPCC-23901-add-efs-helm-chart-example

HPCC-23901 add an efs example helm chart

Reviewed-By: Jake Smith <jake.smith@lexisnexis.com>
Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 5 年之前
父节点
当前提交
77bca429a1

+ 30 - 0
helm/examples/efs/README.md

@@ -0,0 +1,30 @@
+# HPCC Elastic File System (EFS) Storage
+Make sure an EFS is available or create one before using this chart.
+The chart requires <EFS region> and <EFS ID>
+The <EFS ID> can be found in AWS Console EFS service or from AWS Cli:
+```console
+  aws efs describe-file-systems --region <EFS region> | grep "^FILESYSTEMS" |  awk -F $'\t' '{print $8, $5}'
+```
+The output will display EFS name and ID.
+
+
+## Directory contents
+
+### hpcc-efs/
+The hpcc-efs helm chart will provision an EFS Server Pod. It will also create a Persistent Volume Claim for each of the required HPCC storage types.
+
+EFS Server should be created on AWS EFS service first.  The hpcc-efs helm chart needs an EFS region and id to configure the deployment. The default region is us-east-1.
+
+Example use:
+
+helm install efsstorage examples/efs/hpcc-efs --set efs.region=<EFS region>  --set efs.id=<EFS ID>
+helm install myhpcc hpcc/ --set global.image.version=latest -f examples/efs/values-efs.yaml
+
+
+### values-efs.yaml
+An example values file to be supplied when installing the HPCC chart.
+NB: Either use the output auto-generated when installing the "hpcc-efs" helm chart, or ensure the names in your values files for the storage types match the PVC names created.
+
+
+### Notes
+helm uninstall will not delete EFS persistant volumes. You can either run "kubectl delete pv <pv name> or --all".

+ 6 - 0
helm/examples/efs/hpcc-efs/Chart.yaml

@@ -0,0 +1,6 @@
+apiVersion: v2
+description: An example Helm chart for launching a EFS cluster using Kubernetes
+name: hpcc-efs
+type: application
+version: 0.1.0
+appVersion: 0.1.0

+ 19 - 0
helm/examples/efs/hpcc-efs/templates/_helpers.tpl

@@ -0,0 +1,19 @@
+{{/* 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-efs.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 -}}

+ 11 - 0
helm/examples/efs/hpcc-efs/templates/dalistorage-pvc.yaml

@@ -0,0 +1,11 @@
+apiVersion: v1
+kind: PersistentVolumeClaim
+metadata:
+  name: {{ printf "dali-%s-pvc" (include "hpcc-efs.fullname" $) }}
+spec:
+  accessModes:
+    - ReadWriteOnce
+  resources:
+    requests:
+      storage: {{ .Values.daliStorage.size }}
+  storageClassName: {{ printf "dali-%s-sc" (include "hpcc-efs.fullname" $) }}

+ 6 - 0
helm/examples/efs/hpcc-efs/templates/dalistorage-sc.yaml

@@ -0,0 +1,6 @@
+kind: StorageClass
+apiVersion: storage.k8s.io/v1
+metadata:
+  name: {{ printf "dali-%s-sc" (include "hpcc-efs.fullname" $) }}
+
+provisioner: aws.io/aws-efs

+ 11 - 0
helm/examples/efs/hpcc-efs/templates/datastorage-pvc.yaml

@@ -0,0 +1,11 @@
+apiVersion: v1
+kind: PersistentVolumeClaim
+metadata:
+  name: {{ printf "data-%s-pvc" (include "hpcc-efs.fullname" $) }}
+spec:
+  accessModes:
+    - ReadWriteMany
+  resources:
+    requests:
+      storage: {{ .Values.dataStorage.size }}
+  storageClassName: {{ printf "data-%s-sc" (include "hpcc-efs.fullname" $) }}

+ 6 - 0
helm/examples/efs/hpcc-efs/templates/datastorage-sc.yaml

@@ -0,0 +1,6 @@
+kind: StorageClass
+apiVersion: storage.k8s.io/v1
+metadata:
+  name: {{ printf "data-%s-sc" (include "hpcc-efs.fullname" $) }}
+
+provisioner: aws.io/aws-efs

+ 11 - 0
helm/examples/efs/hpcc-efs/templates/dllstorage-pvc.yaml

@@ -0,0 +1,11 @@
+apiVersion: v1
+kind: PersistentVolumeClaim
+metadata:
+  name: {{ printf "dll-%s-pvc" (include "hpcc-efs.fullname" $) }}
+spec:
+  accessModes:
+    - ReadWriteMany  # accessed from dali and sasha
+  resources:
+    requests:
+      storage: {{ .Values.dllStorage.size }}
+  storageClassName: {{ printf "dll-%s-sc" (include "hpcc-efs.fullname" $) }}

+ 6 - 0
helm/examples/efs/hpcc-efs/templates/dllstorage-sc.yaml

@@ -0,0 +1,6 @@
+kind: StorageClass
+apiVersion: storage.k8s.io/v1
+metadata:
+  name: {{ printf "dll-%s-sc" (include "hpcc-efs.fullname" $) }}
+
+provisioner: aws.io/aws-efs

+ 52 - 0
helm/examples/efs/hpcc-efs/templates/hpcc-efs-rbac.yaml

@@ -0,0 +1,52 @@
+kind: Role
+apiVersion: rbac.authorization.k8s.io/v1
+metadata:
+  name: {{ printf "%s-rbac" (include "hpcc-efs.fullname" $) }}
+
+rules:
+  - apiGroups: [""]
+    resources: ["endpoints"]
+    verbs: ["get", "list", "watch", "create", "update", "patch"]
+---
+kind: RoleBinding
+apiVersion: rbac.authorization.k8s.io/v1
+metadata:
+  name: {{ printf "%s-rbac-binding" (include "hpcc-efs.fullname" $) }}
+subjects:
+  - kind: ServiceAccount
+    name: {{ .Values.efs.serviceaccount | default "default" }}
+    # replace with namespace where provisioner is deployed
+    namespace: {{ .Values.efs.namespace | default "default" }}
+roleRef:
+  kind: Role
+  name: {{ printf "%s-rbac" (include "hpcc-efs.fullname" $) }}
+  apiGroup: rbac.authorization.k8s.io
+---
+
+kind: ClusterRole
+apiVersion: rbac.authorization.k8s.io/v1
+metadata:
+  name: {{ printf "%s-role" (include "hpcc-efs.fullname" $) }}
+rules:
+- apiGroups: [""]
+  resources: ["persistentvolumes"]
+  verbs: ["get", "list", "watch", "create", "delete"]
+- apiGroups: [""]
+  resources: ["persistentvolumeclaims"]
+  verbs: ["get", "list", "watch", "update"]
+- apiGroups: ["storage.k8s.io"]
+  resources: ["storageclasses"]
+  verbs: ["get", "list", "watch"]
+---
+kind: ClusterRoleBinding
+apiVersion: rbac.authorization.k8s.io/v1
+metadata:
+  name: {{ printf "%s-crb" (include "hpcc-efs.fullname" $) }}
+subjects:
+- kind: ServiceAccount
+  name: {{ .Values.efs.serviceaccount | default "default" }}
+  namespace: {{ .Values.efs.namespace | default "default" }}
+roleRef:
+  kind: ClusterRole
+  name: {{ printf "%s-role" (include "hpcc-efs.fullname" $) }}
+  apiGroup: rbac.authorization.k8s.io

+ 59 - 0
helm/examples/efs/hpcc-efs/templates/hpcc-efs-server.yaml

@@ -0,0 +1,59 @@
+---
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: {{ printf "efs-provisioner-%s" (include "hpcc-efs.fullname" $) }}
+data:
+  file.system.id: {{ .Values.efs.id }}
+  aws.region: {{ .Values.efs.region }}
+  provisioner.name: aws.io/aws-efs
+  dns.name: ""
+---
+kind: Deployment
+#apiVersion: extensions/v1beta1
+apiVersion: apps/v1
+metadata:
+  name: {{ printf "efs-provisioner-%s" (include "hpcc-efs.fullname" $) }}
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      app: {{ printf "efs-provisioner-%s" (include "hpcc-efs.fullname" $) }}
+  template:
+    metadata:
+      labels:
+        app: {{ printf "efs-provisioner-%s" (include "hpcc-efs.fullname" $) }}
+    spec:
+      containers:
+        - name: {{ printf "efs-provisioner-%s" (include "hpcc-efs.fullname" $) }}
+          image: {{ .Values.efs.image }}
+          env:
+            - name: FILE_SYSTEM_ID
+              valueFrom:
+                configMapKeyRef:
+                  name: {{ printf "efs-provisioner-%s" (include "hpcc-efs.fullname" $) }}
+                  key: file.system.id
+            - name: AWS_REGION
+              valueFrom:
+                configMapKeyRef:
+                  name: {{ printf "efs-provisioner-%s" (include "hpcc-efs.fullname" $) }}
+                  key: aws.region
+            - name: DNS_NAME
+              valueFrom:
+                configMapKeyRef:
+                  name: {{ printf "efs-provisioner-%s" (include "hpcc-efs.fullname" $) }}
+                  key: dns.name
+                  optional: true
+            - name: PROVISIONER_NAME
+              valueFrom:
+                configMapKeyRef:
+                  name: {{ printf "efs-provisioner-%s" (include "hpcc-efs.fullname" $) }}
+                  key: provisioner.name
+          volumeMounts:
+            - name: pv-volume
+              mountPath: /persistentvolumes
+      volumes:
+        - name: pv-volume
+          nfs:
+            server: {{ .Values.efs.id }}.efs.{{ .Values.efs.region }}.amazonaws.com
+            path: /

+ 55 - 0
helm/examples/efs/hpcc-efs/values.schema.json

@@ -0,0 +1,55 @@
+{
+  "$schema": "https://json-schema.org/draft-07/schema#",
+  "additionalProperties": false,
+  "properties": {
+    "efs": {
+      "$ref": "#/definitions/efs"
+    },
+    "dllStorage": {
+      "$ref": "#/definitions/storage"
+    },
+    "dataStorage": {
+      "$ref": "#/definitions/storage"
+    },
+    "daliStorage": {
+      "$ref": "#/definitions/storage"
+    }
+  },
+  "definitions": {
+    "efs": {
+      "type": "object",
+      "required": [ "id", "region", "image" ],
+      "properties": {
+        "namespace": {
+          "type": "string"
+        },
+        "serviceaccount": {
+          "type": "string"
+        },
+        "region": {
+          "type": "string"
+	},
+        "id": {
+          "type": "string"
+	},
+        "image": {
+          "type": "string"
+	}
+      },
+      "additionalProperties": false
+    },
+    "storage": {
+      "type": "object",
+      "required": [ "size" ],
+      "properties": {
+        "size": {
+          "type": "string"
+        },
+        "sku": {
+          "type": "string"
+        }
+      },
+      "additionalProperties": false
+    }
+  }
+}

+ 23 - 0
helm/examples/efs/hpcc-efs/values.yaml

@@ -0,0 +1,23 @@
+efs:
+  #namespace: default
+  #serviceaccount: default
+
+  #region: <EFS region>
+  region: us-east-1
+
+  # This must be provided. It can be found from AWS Console EFS service or from AWS Cli:
+  # aws efs describe-file-systems --region <EFS region> | grep "^FILESYSTEMS" |  awk -F $'\t' '{print $8, $5}'
+  #id: <set to EFS id>
+  #
+
+  # EFS Docker image
+  image: quay.io/external_storage/efs-provisioner:v2.2.0-k8s1.12
+
+dllStorage:
+  size: 1Mi
+
+daliStorage:
+ size: 1Mi
+
+dataStorage:
+ size: 5Mi

+ 17 - 0
helm/examples/efs/values-efs.yaml

@@ -0,0 +1,17 @@
+# Overrides for storage in hpcc hpcc, using efs PVC's.
+# NB: The "hpcc-efs" helm charts should be installed 1st.
+#
+# The "hpcc-efs" 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 "efsstorage"
+
+storage:
+  dllStorage:
+    existingClaim: dll-efsstorage-hpcc-efs-pvc
+
+  daliStorage:
+    existingClaim: dali-efsstorage-hpcc-efs-pvc
+
+  dataStorage:
+    existingClaim: data-efsstorage-hpcc-efs-pvc