From 4d1ae3c61dcd49f170aba6fdae87e2178339c632 Mon Sep 17 00:00:00 2001 From: Svetomir Smiljkovic Date: Tue, 31 Mar 2020 14:08:33 +0200 Subject: [PATCH] Add chart eks-local-disk-provisioner (#7) * Add chart eks-local-disk-provisioner * Update README * Fix trailing spaces --- README.md | 2 + charts/eks-local-disk-provisioner/.helmignore | 23 ++++ charts/eks-local-disk-provisioner/Chart.yaml | 20 ++++ charts/eks-local-disk-provisioner/README.md | 102 ++++++++++++++++++ .../templates/NOTES.txt | 1 + .../templates/_helpers.tpl | 63 +++++++++++ .../templates/daemonset.yaml | 71 ++++++++++++ .../templates/serviceaccount.yaml | 8 ++ charts/eks-local-disk-provisioner/values.yaml | 51 +++++++++ 9 files changed, 341 insertions(+) create mode 100644 charts/eks-local-disk-provisioner/.helmignore create mode 100644 charts/eks-local-disk-provisioner/Chart.yaml create mode 100644 charts/eks-local-disk-provisioner/README.md create mode 100644 charts/eks-local-disk-provisioner/templates/NOTES.txt create mode 100644 charts/eks-local-disk-provisioner/templates/_helpers.tpl create mode 100644 charts/eks-local-disk-provisioner/templates/daemonset.yaml create mode 100644 charts/eks-local-disk-provisioner/templates/serviceaccount.yaml create mode 100644 charts/eks-local-disk-provisioner/values.yaml diff --git a/README.md b/README.md index 21fdee2..532e725 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ This repo contains Ethersphere Helm Charts: * bee +* eks-local-disk-provisioner +* geth-swap ## Enabling Ethersphere Helm repository diff --git a/charts/eks-local-disk-provisioner/.helmignore b/charts/eks-local-disk-provisioner/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/eks-local-disk-provisioner/.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/ diff --git a/charts/eks-local-disk-provisioner/Chart.yaml b/charts/eks-local-disk-provisioner/Chart.yaml new file mode 100644 index 0000000..63c5b4c --- /dev/null +++ b/charts/eks-local-disk-provisioner/Chart.yaml @@ -0,0 +1,20 @@ +apiVersion: v1 +appVersion: 0.1.0 +name: eks-local-disk-provisioner +version: 0.1.0 +description: AWS eks-local-disk-provisioner Helm chart for Kubernetes +home: https://swarm.ethereum.org +icon: https://swarm-guide.readthedocs.io/en/latest/_images/swarm.png +keywords: + - aws + - kubernetes + - eks + - local disk provisioner + - local persistent volume + - sig-storage-local-static-provisioner +maintainers: + - name: svetomir + email: svetomir@ethereum.org +sources: + - https://github.com/ethersphere/eks-local-disk-provisioner +type: application diff --git a/charts/eks-local-disk-provisioner/README.md b/charts/eks-local-disk-provisioner/README.md new file mode 100644 index 0000000..f8c76ef --- /dev/null +++ b/charts/eks-local-disk-provisioner/README.md @@ -0,0 +1,102 @@ +# AWS EKS local-disk-provisioner Helm Chart + +## QuickStart + +```bash +$ helm install --generate-name ethersphere/eks-local-disk-provisioner +``` + +## Introduction + +This chart deploys a [eks-local-disk-provisioner](https://github.com/ethersphere/eks-local-disk-provisioner) onto a Kubernetes cluster using the Helm package manager. It creates DaemonSet Kubernetes object, while ServiceAccount is optional. + +## Prerequisites + +* Kubernetes 1.15 +* Helm 3.0 + +## Installing the Chart + +To install the chart with the release name `my-release`: + +```bash +$ helm install --name my-release ethersphere/eks-local-disk-provisioner +``` + +The command deploys eks-local-disk-provisioner on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation. + +## Uninstalling the Chart + +To uninstall/delete the `my-release` deployment: + +```bash +$ helm delete my-release +``` + +The command removes all the Kubernetes components associated with the chart and deletes the release. + +## Configuration + +The default configuration values for this chart are listed in **values.yaml**. + +eks-local-disk-provisioner specific configuration parameters can be configured in **provisionerConfig** section. + +Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, + +```bash +$ helm install --name my-release \ + --set serviceAccount.create=true \ + ethersphere/eks-local-disk-provisioner +``` + +The above command creates ServiceAccount for the DaemonSet. + +Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example, + +```bash +$ helm install --name my-release -f values.yaml ethersphere/eks-local-disk-provisioner +``` + +## Helmsman Usage + +### Prerequisites + +* Kubernetes 1.15 +* Helm 3.0 +* Helmsman 3.0 + +### Installing + +Create eks-local-disk-provisioner.yaml file as shown bellow: + +```yaml +namespaces: + kube-system: + +helmRepos: + ethersphere: "https://ethersphere.github.io/helm" + +apps: + eks-local-disk-provisioner: + name: eks-local-disk-provisioner + namespace: kube-system + description: "AWS EKS Local Disk Provisioner" + chart: "ethersphere/eks-local-disk-provisioner" + version: "0.1.0" + enabled: true + wait: true + timeout: 120 + +``` + +Execute following command: +```bash +$ helmsman -apply -f eks-local-disk-provisioner.yaml +``` + +### Uninstalling + +Execute following command: +```bash +$ helmsman -destroy -f eks-local-disk-provisioner.yaml +``` diff --git a/charts/eks-local-disk-provisioner/templates/NOTES.txt b/charts/eks-local-disk-provisioner/templates/NOTES.txt new file mode 100644 index 0000000..08b5ffc --- /dev/null +++ b/charts/eks-local-disk-provisioner/templates/NOTES.txt @@ -0,0 +1 @@ +eks-local-disk-provisioner installed diff --git a/charts/eks-local-disk-provisioner/templates/_helpers.tpl b/charts/eks-local-disk-provisioner/templates/_helpers.tpl new file mode 100644 index 0000000..84b025d --- /dev/null +++ b/charts/eks-local-disk-provisioner/templates/_helpers.tpl @@ -0,0 +1,63 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "eks-local-disk-provisioner.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +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 "eks-local-disk-provisioner.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 -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "eks-local-disk-provisioner.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Common labels +*/}} +{{- define "eks-local-disk-provisioner.labels" -}} +helm.sh/chart: {{ include "eks-local-disk-provisioner.chart" . }} +{{ include "eks-local-disk-provisioner.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} + +{{/* +Selector labels +*/}} +{{- define "eks-local-disk-provisioner.selectorLabels" -}} +app.kubernetes.io/name: {{ include "eks-local-disk-provisioner.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end -}} + +{{/* +Create the name of the service account to use +*/}} +{{- define "eks-local-disk-provisioner.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (include "eks-local-disk-provisioner.fullname" .) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} diff --git a/charts/eks-local-disk-provisioner/templates/daemonset.yaml b/charts/eks-local-disk-provisioner/templates/daemonset.yaml new file mode 100644 index 0000000..075abf3 --- /dev/null +++ b/charts/eks-local-disk-provisioner/templates/daemonset.yaml @@ -0,0 +1,71 @@ +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: {{ include "eks-local-disk-provisioner.fullname" . }} + labels: + {{- include "eks-local-disk-provisioner.labels" . | nindent 4 }} + namespace: {{ .Values.namespace }} +spec: + selector: + matchLabels: + {{- include "eks-local-disk-provisioner.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + {{- include "eks-local-disk-provisioner.selectorLabels" . | nindent 8 }} + {{- if .Values.podAnnotations }} + annotations: + {{ toYaml .Values.podAnnotations | indent 8 }} + {{- end }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + automountServiceAccountToken: {{ .Values.automountServiceAccountToken }} + priorityClassName: {{ .Values.priorityClassName }} + serviceAccountName: {{ include "eks-local-disk-provisioner.serviceAccountName" . }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + env: + - name: PARTED_SCRIPT + value: "{{ .Values.provisionerConfig.parted_script }}" + resources: + {{- toYaml .Values.resources | nindent 12 }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + volumeMounts: + - name: host-dev + mountPath: /dev + mountPropagation: "Bidirectional" + - name: host-disks + mountPath: /mnt/disks + mountPropagation: "Bidirectional" + - name: host-etc-fstab + mountPath: /etc/fstab + subPath: fstab + mountPropagation: "Bidirectional" + volumes: + - name: host-dev + hostPath: + path: /dev + - name: host-disks + hostPath: + path: /mnt/disks + - name: host-etc-fstab + hostPath: + path: /etc diff --git a/charts/eks-local-disk-provisioner/templates/serviceaccount.yaml b/charts/eks-local-disk-provisioner/templates/serviceaccount.yaml new file mode 100644 index 0000000..84643c6 --- /dev/null +++ b/charts/eks-local-disk-provisioner/templates/serviceaccount.yaml @@ -0,0 +1,8 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "eks-local-disk-provisioner.serviceAccountName" . }} + labels: + {{- include "eks-local-disk-provisioner.labels" . | nindent 4 }} +{{- end -}} diff --git a/charts/eks-local-disk-provisioner/values.yaml b/charts/eks-local-disk-provisioner/values.yaml new file mode 100644 index 0000000..8d04abc --- /dev/null +++ b/charts/eks-local-disk-provisioner/values.yaml @@ -0,0 +1,51 @@ +# Default values for eks-local-disk-provisioner. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +image: + repository: ethersphere/eks-local-disk-provisioner + tag: latest + pullPolicy: IfNotPresent + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +namespace: kube-system + +serviceAccount: + # Specifies whether a service account should be created + create: false + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: + +automountServiceAccountToken: false +priorityClassName: system-node-critical + +securityContext: + privileged: true + +resources: {} + # If you do want to specify resources, uncomment the following lines, + # adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +podAnnotations: {} + +nodeSelector: {} + +affinity: {} + +tolerations: [] + +provisionerConfig: + # Parted script for disk partitioning. For more info, see: https://www.gnu.org/software/parted/ + # Variable will be passed to the command 'parted --script ' for every NVME SSD disk. + # Example: "mklabel gpt mkpart logical 0% 50% mkpart logical 50% 100%" + parted_script: ""