Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

NFS client provisioner #6433

Merged
merged 20 commits into from
Aug 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions stable/nfs-client-provisioner/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# 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
*~
# Various IDEs
.project
.idea/
*.tmproj
14 changes: 14 additions & 0 deletions stable/nfs-client-provisioner/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
appVersion: 2.1.1
description: nfs-client is an automatic provisioner that used your *already configured* NFS server, automatically creating Persistent Volumes.
name: nfs-client-provisioner
home: https://github.com/kubernetes-incubator/external-storage/tree/master/nfs-client
version: 0.1.0
sources:
- https://github.com/kubernetes-incubator/external-storage/tree/master/nfs-client
maintainers:
- name: verwilst
email: [email protected]
keywords:
- nfs
- storage
61 changes: 61 additions & 0 deletions stable/nfs-client-provisioner/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# nfs-client-provisioner

The [NFS client provisioner](https://github.com/kubernetes-incubator/external-storage/tree/master/nfs-client) is an automatic provisioner for Kubernetes that uses your *already configured* NFS server, automatically creating Persistent Volumes.

## TL;DR;

```console
$ helm install stable/nfs-client-provisioner
```

## Introduction

This charts installs custom [storage class](https://kubernetes.io/docs/concepts/storage/storage-classes/) into a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. It also installs a [NFS client provisioner](https://github.com/kubernetes-incubator/external-storage/tree/master/nfs-client) into the cluster which dynamically creates persistent volumes from single NFS share.

## Prerequisites

- Kubernetes 1.9+
- Existing NFS Share

## Installing the Chart

To install the chart with the release name `my-release`:

```console
$ helm install --name my-release --set nfs.server=x.x.x.x --set nfs.path=/exported/path stable/nfs-client-provisioner
```

The command deploys the given storage class in the default configuration. It can be used afterswards to provision persistent volumes. The [configuration](#configuration) section lists the parameters that can be configured during installation.

> **Tip**: List all releases using `helm list`

## Uninstalling the Chart

To uninstall/delete the `my-release` deployment:

```console
$ helm delete my-release
```

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

## Configuration

The following tables lists the configurable parameters of this chart and their default values.

| Parameter | Description | Default |
| --------------------------------- | ------------------------------------- | --------------------------------------------------------- |
| `replicaCount` | number of provisioner instances to deployed | `1` |
| `strategyType` | specifies the strategy used to replace old Pods by new ones | `Recreate` |
| `image.repository` | provisioner image | `quay.io/external_storage/nfs-client-provisioner` |
| `image.tag` | version of provisioner image | `v3.0.1-k8s1.11` |
| `image.pullPolicy` | image pull policy | `IfNotPresent` |
| `storageclass.name` | name of the storageclass | `nfs-client` |
| `storageclass.defaultClass` | Set as the default StorageClass | `false` |
| `storageclass.allowVolumeExpansion` | Allow expanding the volume | `true` |
| `storageclass.reclaimPolicy` | Method used to reclaim an obsoleted volume | `Delete` |
| `storageclass.provisionerName` | name of the provisionerName | null |
| `storageclass.archiveOnDelete` | archive pvc when deleting | `true` |
| `nfs.server` | hostname of the NFS server | null (ip or hostname) |
| `nfs.path` | basepath of the mount point to be used | `/ifs/kubernetes` |
| `resources` | Resources required (e.g. CPU, memory) | `{}` |
2 changes: 2 additions & 0 deletions stable/nfs-client-provisioner/ci/test-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
nfs:
server: 127.0.0.1
51 changes: 51 additions & 0 deletions stable/nfs-client-provisioner/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "nfs-client-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 "nfs-client-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 "nfs-client-provisioner.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{- define "nfs-client-provisioner.provisionerName" -}}
{{- if .Values.storageClass.provisionerName -}}
{{- printf .Values.storageClass.provisionerName -}}
{{- else -}}
cluster.local/{{ template "nfs-client-provisioner.fullname" . -}}
{{- end -}}
{{- end -}}

{{/*
Create the name of the service account to use
*/}}
{{- define "nfs-client-provisioner.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "nfs-client-provisioner.fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}
25 changes: 25 additions & 0 deletions stable/nfs-client-provisioner/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
labels:
app: {{ template "nfs-client-provisioner.name" . }}
chart: {{ template "nfs-client-provisioner.chart" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "nfs-client-provisioner.fullname" . }}-runner
rules:
- apiGroups: [""]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only been added 2 weeks ago so it seems kubernetes-retired/external-storage@d46083d. I can sync it though. ;-) Man I really want to get this merged. :-p

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be good - it was malfunctioning for me without it

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"]
- apiGroups: [""]
resources: ["events"]
verbs: ["create", "update", "patch"]
- apiGroups: [""]
resources: ["endpoints"]
verbs: ["get", "list", "watch", "create", "update", "patch"]
17 changes: 17 additions & 0 deletions stable/nfs-client-provisioner/templates/clusterrolebinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
labels:
app: {{ template "nfs-client-provisioner.name" . }}
chart: {{ template "nfs-client-provisioner.chart" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: run-{{ template "nfs-client-provisioner.fullname" . }}
subjects:
- kind: ServiceAccount
name: {{ template "nfs-client-provisioner.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
roleRef:
kind: ClusterRole
name: {{ template "nfs-client-provisioner.fullname" . }}-runner
apiGroup: rbac.authorization.k8s.io
43 changes: 43 additions & 0 deletions stable/nfs-client-provisioner/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "nfs-client-provisioner.fullname" . }}
labels:
app: {{ template "nfs-client-provisioner.name" . }}
chart: {{ template "nfs-client-provisioner.chart" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
spec:
replicas: {{ .Values.replicaCount }}
strategy:
type: {{ .Values.strategyType }}
selector:
matchLabels:
app: {{ template "nfs-client-provisioner.name" . }}
release: {{ .Release.Name }}
template:
metadata:
labels:
app: {{ template "nfs-client-provisioner.name" . }}
release: {{ .Release.Name }}
spec:
serviceAccountName: {{ template "nfs-client-provisioner.serviceAccountName" . }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
volumeMounts:
- name: nfs-client-root
mountPath: /persistentvolumes
env:
- name: PROVISIONER_NAME
value: {{ template "nfs-client-provisioner.provisionerName" . }}
- name: NFS_SERVER
value: {{ .Values.nfs.server }}
- name: NFS_PATH
value: {{ .Values.nfs.path }}
volumes:
- name: nfs-client-root
nfs:
server: {{ .Values.nfs.server }}
path: {{ .Values.nfs.path }}
11 changes: 11 additions & 0 deletions stable/nfs-client-provisioner/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{ if .Values.serviceAccount.create }}
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app: {{ template "nfs-client-provisioner.name" . }}
chart: {{ template "nfs-client-provisioner.chart" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "nfs-client-provisioner.serviceAccountName" . }}
{{- end -}}
20 changes: 20 additions & 0 deletions stable/nfs-client-provisioner/templates/storageclass.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{{ if .Values.storageClass.create -}}
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
labels:
app: {{ template "nfs-client-provisioner.name" . }}
chart: {{ template "nfs-client-provisioner.chart" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ .Values.storageClass.name }}
{{- if .Values.storageClass.defaultClass }}
annotations:
storageclass.kubernetes.io/is-default-class: "true"
{{- end }}
provisioner: {{ template "nfs-client-provisioner.provisionerName" . }}
allowVolumeExpansion: {{ .Values.storageClass.allowVolumeExpansion }}
reclaimPolicy: {{ .Values.storageClass.reclaimPolicy }}
parameters:
archiveOnDelete: "{{ .Values.storageClass.archiveOnDelete }}"
{{ end -}}
66 changes: 66 additions & 0 deletions stable/nfs-client-provisioner/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Default values for nfs-client-provisioner.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

replicaCount: 1
strategyType: Recreate

image:
repository: quay.io/external_storage/nfs-client-provisioner
tag: v3.0.1-k8s1.11
pullPolicy: IfNotPresent

nfs:
server:
path: /ifs/kubernetes

# For creating the StorageClass automatically:
storageClass:
create: true

# Set a provisioner name. If unset, a name will be generated.
# provisionerName:

# Set StorageClass as the default StorageClass
# Ignored if storageClass.create is false
defaultClass: false

# Set a StorageClass name
# Ignored if storageClass.create is false
name: nfs-client

# Allow volume to be expanded dynamically
allowVolumeExpansion: true

# Method used to reclaim an obsoleted volume
reclaimPolicy: Delete

# When set to false your PVs will not be archived by the provisioner upon deletion of the PVC.
archiveOnDelete: true

## For RBAC support:
rbac:
# Specifies whether RBAC resources should be created
create: true

serviceAccount:
# Specifies whether a ServiceAccount should be created
create: true

# The name of the ServiceAccount to use.
# If not set and create is true, a name is generated using the fullname template
name:

resources: {}
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi

nodeSelector: {}

tolerations: []

affinity: {}