Skip to content

Commit

Permalink
chore(chart): initial helm chart for dynamic-nfs-provisioner (#20)
Browse files Browse the repository at this point in the history
This commit setups the required templates. 

Needs further refactoring in terms of directory structure and optimizations. 
Renaming from `nfspv` to `nfs`

Signed-off-by: Rahul krishnan R A <[email protected]>
Co-authored-by: Niladri Halder <[email protected]>
  • Loading branch information
rahulkrishnanfs and niladrih authored May 14, 2021
1 parent 1020198 commit dc9c5c0
Show file tree
Hide file tree
Showing 11 changed files with 545 additions and 0 deletions.
28 changes: 28 additions & 0 deletions deploy/helm/charts/nfspv-provisioner/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
apiVersion: v2
name: nfspv-provisioner
description: Helm chart for OpenEBS Dynamic NFS PV. For instructions to install OpenEBS Dynamic NFS PV using helm chart, refer to https://openebs.github.io/dynamic-nfs-provisioner.
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
version: 0.2.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application.
appVersion: 0.2.0
icon: https://raw.githubusercontent.com/cncf/artwork/master/projects/openebs/icon/color/openebs-icon-color.png
home: http://www.openebs.io/
keywords:
- storage
- nfs
- dynamic-nfspv
sources:
- https://github.com/openebs/dynamic-nfs-provisioner

maintainers:
- name: akhilerm
email: [email protected]
- name: kiranmova
email: [email protected]
- name: prateekpandey14
email: [email protected]
- name: rahulkrishnanra
email: [email protected]
93 changes: 93 additions & 0 deletions deploy/helm/charts/nfspv-provisioner/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# OpenEBS NFSPV Provisioner

[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

A Helm chart for openebs dynamic nfspv provisioner. This chart bootstraps OpenEBS Dynamic NFSPV provisioner deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.


**Homepage:** <http://www.openebs.io/>

## Maintainers

| Name | Email | Url |
| ---- | ------ | --- |
| akhilerm | [email protected] | |
| kiranmova | [email protected] | |
| prateekpandey14 | [email protected] | |
| rahulkrishnanra | [email protected] | |


## Get Repo Info

```console
helm repo add openebs-nfspv https://openebs.github.io/dynamic-nfspv-provisioner
helm repo update
```

_See [helm repo](https://helm.sh/docs/helm/helm_repo/) for command documentation._

## Install Chart

Please visit the [link](https://openebs.github.io/dynamic-nfspv-provisioner/) for install instructions via helm3.

```console
# Helm
$ helm install [RELEASE_NAME] openebs-nfspv/nfspv-provisioner
```

_See [configuration](#configuration) below._

_See [helm install](https://helm.sh/docs/helm/helm_install/) for command documentation._


## Uninstall Chart

```console
# Helm
$ helm uninstall [RELEASE_NAME]
```

This removes all the Kubernetes components associated with the chart and deletes the release.

_See [helm uninstall](https://helm.sh/docs/helm/helm_uninstall/) for command documentation._

## Upgrading Chart

```console
# Helm
$ helm upgrade [RELEASE_NAME] [CHART] --install
```


## Configuration

The following table lists the configurable parameters of the OpenEBS NFSPV Provisioner chart and their default values.

| Parameter | Description | Default |
| ------------------------------------------- | --------------------------------------------- | ----------------------------------------- |
| `analytics.enabled` | Enable sending stats to Google Analytics | `true` |
| `imagePullSecrets` | Provides image pull secret | `""` |
| `nfspv.enabled` | Enable NFSPV Provisioner | `true` |
| `nfspv.image.registry` | Registry for NFSPV Provisioner image | `""` |
| `nfspv.image.repository` | Image repository for NFSPV Provisioner | `openebs/provisioner-nfs-amd64` |
| `nfspv.image.tag` | Image tag for NFSPV Provisioner | `0.2.0` |
| `nfspv.image.pullPolicy` | Image pull policy for NFSPV Provisioner | `IfNotPresent` |
| `nfspv.annotations` | Annotations for NFSPV Provisioner metadata | `""` |
| `nfspv.nodeSelector` | Nodeselector for NFSPV Provisioner pods | `""` |
| `nfspv.tolerations` | NFSPV Provisioner pod toleration values | `""` |
| `nfspv.securityContext` | Seurity context for container | `""` |
| `nfspv.healthCheck.initialDelaySeconds` | Delay before liveness probe is initiated | `30` |
| `nfspv.healthCheck.periodSeconds` | How often to perform the liveness probe | `60` |
| `nfspv.enableLeaderElection` | Enable leader election | `true` |
| `rbac.create` | Enable RBAC Resources | `true` |
| `rbac.pspEnabled` | Create pod security policy resources | `false` |
| `nfspv.affinity` | NFSPV Provisioner pod affinity | `{}` |
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`.

Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,

```bash
helm install <release-name> -f values.yaml ----namespace openebs nfspv-provisioner
```

> **Tip**: You can use the default [values.yaml](values.yaml)
9 changes: 9 additions & 0 deletions deploy/helm/charts/nfspv-provisioner/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Thank you for installing {{ .Chart.Name }} 😀

Your release is named {{ .Release.Name }} and it's installed to namespace: {{ .Release.Namespace }}.

The OpenEBS NFSPV Provisioner has been installed check its status by running:
$ kubectl get pods -n {{ .Release.Namespace }}

For more information, visit our Slack at https://openebs.io/community or view
the documentation online at https://github.com/openebs/dynamic-nfs-provisioner/.
77 changes: 77 additions & 0 deletions deploy/helm/charts/nfspv-provisioner/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "nfspv.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 "nfspv.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 the name of the service account to use
*/}}
{{- define "nfspv.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "nfspv.fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "nfspv.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Meta labels
*/}}
{{- define "nfspv.common.metaLabels" -}}
chart: {{ include "nfspv.chart" . }}
heritage: {{ .Release.Service }}
openebs.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}

{{/*
Selector Labels
*/}}
{{- define "nfspv.selectorLabels" -}}
app: {{ include "nfspv.name" . }}
release: {{ .Release.Name }}
component: {{ .Values.nfspv.name }}
{{- end }}

{{/*
Component labels
*/}}
{{- define "nfspv.componentLabels" -}}
openebs.io/component-name: openebs-{{ .Values.nfspv.name }}
{{- end -}}

{{/*
Common labels
*/}}
{{- define "nfspv.labels" -}}
{{ include "nfspv.common.metaLabels" . }}
{{ include "nfspv.selectorLabels" . }}
{{ include "nfspv.componentLabels" . }}
{{- end -}}
58 changes: 58 additions & 0 deletions deploy/helm/charts/nfspv-provisioner/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Define Role that allows operations on K8s pods/deployments
{{- if .Values.rbac.create }}
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ include "nfspv.fullname" . }}
{{- with .Values.nfspv.annotations }}
annotations: {{ toYaml . | nindent 4 }}
{{- end }}
labels:
{{- include "nfspv.labels" . | nindent 4 }}
rules:
- apiGroups: ["*"]
resources: ["nodes", "nodes/proxy"]
verbs: ["*"]
- apiGroups: ["*"]
resources: ["namespaces", "services", "pods", "pods/exec", "deployments", "deployments/finalizers", "replicationcontrollers", "replicasets", "events", "endpoints", "configmaps", "secrets", "jobs", "cronjobs"]
verbs: ["*"]
- apiGroups: ["*"]
resources: ["statefulsets", "daemonsets"]
verbs: ["*"]
- apiGroups: ["*"]
resources: ["resourcequotas", "limitranges"]
verbs: ["list", "watch"]
- apiGroups: ["*"]
resources: ["ingresses", "horizontalpodautoscalers", "verticalpodautoscalers", "poddisruptionbudgets", "certificatesigningrequests"]
verbs: ["list", "watch"]
- apiGroups: ["*"]
resources: ["storageclasses", "persistentvolumeclaims", "persistentvolumes"]
verbs: ["*"]
- apiGroups: ["apiextensions.k8s.io"]
resources: ["customresourcedefinitions"]
verbs: [ "get", "list", "create", "update", "delete", "patch"]
- apiGroups: ["openebs.io"]
resources: [ "*"]
verbs: ["*"]
- nonResourceURLs: ["/metrics"]
verbs: ["get"]

{{- if .Values.rbac.pspEnabled}}}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ include "nfspv.fullname" . }}-psp
{{- with .Values.nfspv.annotations }}
annotations: {{ toYaml . | nindent 4 }}
{{- end }}
labels:
{{- include "nfspv.labels" . | nindent 4 }}
rules:
- apiGroups: ['policy']
resources: ['podsecuritypolicies']
verbs: ['use']
resourceNames:
- {{ include "nfspv.fullname" . }}-psp
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Bind the Service Account with the Role Privileges.
{{- if .Values.rbac.create }}
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ include "nfspv.fullname" . }}
{{- with .Values.nfspv.annotations }}
annotations: {{ toYaml . | nindent 4 }}
{{- end }}
labels:
{{- include "nfspv.labels" . | nindent 4 }}
roleRef:
kind: ClusterRole
name: {{ include "nfspv.fullname" . }}
apiGroup: rbac.authorization.k8s.io
subjects:
- kind: ServiceAccount
name: {{ include "nfspv.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}

{{- if .Values.rbac.pspEnabled }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ include "nfspv.fullname" . }}-psp
{{- with .Values.nfspv.annotations }}
annotations: {{ toYaml . | nindent 4 }}
{{- end }}
labels:
{{- include "nfspv.labels" . | nindent 4 }}
roleRef:
kind: ClusterRole
name: {{ include "nfspv.fullname" . }}-psp
apiGroup: rbac.authorization.k8s.io
subjects:
# Authorize specific service accounts:
- kind: ServiceAccount
name: {{ include "nfspv.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
{{- end }}
{{- end }}
Loading

0 comments on commit dc9c5c0

Please sign in to comment.