Skip to content

Commit edafd7f

Browse files
authored
Merge pull request #27 from kir4h/local-path-provisioner
Sync local-path-provisioner Helm chart to version 0.0.31
2 parents 9e5f4a6 + 3dc901f commit edafd7f

14 files changed

+679
-0
lines changed
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: v1
2+
description: Use HostPath for persistent local storage with Kubernetes
3+
name: local-path-provisioner
4+
version: 0.0.31
5+
appVersion: "v0.0.31"
6+
keywords:
7+
- storage
8+
- hostpath
9+
kubeVersion: ">=1.12.0-r0"
10+
home: https://github.com/rancher/local-path-provisioner
11+
sources:
12+
- https://github.com/rancher/local-path-provisioner.git
+119
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
# Local Path Provisioner
2+
3+
[Local Path Provisioner](https://github.com/rancher/local-path-provisioner) provides a way for the Kubernetes users to
4+
utilize the local storage in each node. Based on the user configuration, the Local Path Provisioner will create
5+
`hostPath` based persistent volume on the node automatically. It utilizes the features introduced by Kubernetes [Local
6+
Persistent Volume feature](https://kubernetes.io/blog/2018/04/13/local-persistent-volumes-beta/), but make it a simpler
7+
solution than the built-in `local` volume feature in Kubernetes.
8+
9+
## TL;DR;
10+
11+
```console
12+
$ git clone https://github.com/rancher/local-path-provisioner.git
13+
$ cd local-path-provisioner
14+
$ helm install --name local-path-storage --namespace local-path-storage ./deploy/chart/local-path-provisioner
15+
```
16+
17+
## Introduction
18+
19+
This chart bootstraps a [Local Path Provisioner](https://github.com/rancher/local-path-provisioner) deployment on a
20+
[Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.
21+
22+
## Prerequisites
23+
24+
- Kubernetes 1.12+ with Beta APIs enabled
25+
26+
## Installing the Chart
27+
28+
To install the chart with the release name `local-path-storage`:
29+
30+
```console
31+
$ git clone https://github.com/rancher/local-path-provisioner.git
32+
$ cd local-path-provisioner
33+
$ helm install local-path-storage --create-namespace --namespace local-path-storage ./deploy/chart/local-path-provisioner/
34+
```
35+
36+
The command deploys Local Path Provisioner on the Kubernetes cluster in the default configuration. The
37+
[configuration](#configuration) section lists the parameters that can be configured during installation.
38+
39+
> **Tip**: List all releases using `helm list`
40+
41+
## Uninstalling the Chart
42+
43+
To uninstall/delete the `local-path-storage` deployment:
44+
45+
```console
46+
$ helm uninstall local-path-storage
47+
```
48+
49+
The command removes all the Kubernetes components associated with the chart and deletes the release.
50+
51+
## Configuration
52+
53+
The following table lists the configurable parameters of the Local Path Provisioner for Kubernetes chart and their
54+
default values.
55+
56+
| Parameter | Description | Default |
57+
| ----------------------------------- | ------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- |
58+
| `commonLabels` | Custom labels to apply to all resources | `{}` |
59+
| `image.repository` | Local Path Provisioner image name | `rancher/local-path-provisioner` |
60+
| `image.tag` | Local Path Provisioner image tag | `v0.0.31` . |
61+
| `image.pullPolicy` | Image pull policy | `IfNotPresent` |
62+
| `storageClass.create` | If true, create a `StorageClass` | `true` |
63+
| `storageClass.provisionerName` | The provisioner name for the storage class | `nil` |
64+
| `storageClass.defaultClass` | If true, set the created `StorageClass` as the cluster's default `StorageClass` | `false` |
65+
| `storageClass.defaultVolumeType` | The default volume type this storage class creates | `hostPath` |
66+
| `storageClass.name` | The name to assign the created StorageClass | local-path |
67+
| `storageClass.reclaimPolicy` | ReclaimPolicy field of the class | Delete |
68+
| `storageClass.pathPattern` | Template for the volume directory name | `nil` |
69+
| `nodePathMap` | Configuration of where to store the data on each node | `[{node: DEFAULT_PATH_FOR_NON_LISTED_NODES, paths: [/opt/local-path-provisioner]}]` |
70+
| `resources` | Local Path Provisioner resource requests & limits | `{}` |
71+
| `rbac.create` | If true, create & use RBAC resources | `true` |
72+
| `serviceAccount.create` | If true, create the Local Path Provisioner service account | `true` |
73+
| `serviceAccount.name` | Name of the Local Path Provisioner service account to use or create | `nil` |
74+
| `nodeSelector` | Node labels for Local Path Provisioner pod assignment | `{}` |
75+
| `tolerations` | Node taints to tolerate | `[]` |
76+
| `affinity` | Pod affinity | `{}` |
77+
| `configmap.setup` | Configuration of script to execute setup operations on each node | #!/bin/sh<br>while getopts "m:s:p:" opt<br>do<br>&emsp;case $opt in <br>&emsp;&emsp;p)<br>&emsp;&emsp;absolutePath=$OPTARG<br>&emsp;&emsp;;;<br>&emsp;&emsp;s)<br>&emsp;&emsp;sizeInBytes=$OPTARG<br>&emsp;&emsp;;;<br>&emsp;&emsp;m)<br>&emsp;&emsp;volMode=$OPTARG<br>&emsp;&emsp;;;<br>&emsp;esac<br>done<br>mkdir -m 0777 -p ${absolutePath} |
78+
| `configmap.teardown` | Configuration of script to execute teardown operations on each node | #!/bin/sh<br>while getopts "m:s:p:" opt<br>do<br>&emsp;case $opt in <br>&emsp;&emsp;p)<br>&emsp;&emsp;absolutePath=$OPTARG<br>&emsp;&emsp;;;<br>&emsp;&emsp;s)<br>&emsp;&emsp;sizeInBytes=$OPTARG<br>&emsp;&emsp;;;<br>&emsp;&emsp;m)<br>&emsp;&emsp;volMode=$OPTARG<br>&emsp;&emsp;;;<br>&emsp;esac<br>done<br>rm -rf ${absolutePath} |
79+
| `configmap.name` | configmap name | `local-path-config` |
80+
| `configmap.helperPod` | helper pod yaml file | apiVersion: v1<br>kind: Pod<br>metadata:<br>&emsp;name: helper-pod<br>spec:<br>&emsp;containers:<br>&emsp;- name: helper-pod<br>&emsp;&emsp;image: busybox |
81+
82+
83+
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
84+
85+
```console
86+
$ helm install ./deploy/chart/local-path-provisioner --name local-path-storage --namespace local-path-storage --set storageClass.provisionerName=rancher.io/local-path
87+
```
88+
89+
Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the
90+
chart. For example,
91+
92+
```console
93+
$ helm install --name local-path-storage --namespace local-path-storage ./deploy/chart/local-path-provisioner -f values.yaml
94+
```
95+
96+
> **Tip**: You can use the default [values.yaml](values.yaml)
97+
98+
## RBAC
99+
100+
By default the chart will install the recommended RBAC roles and rolebindings.
101+
102+
You need to have the flag `--authorization-mode=RBAC` on the api server. See the following document for how to enable
103+
[RBAC](https://kubernetes.io/docs/admin/authorization/rbac/).
104+
105+
To determine if your cluster supports RBAC, run the following command:
106+
107+
```console
108+
$ kubectl api-versions | grep rbac
109+
```
110+
111+
If the output contains "beta", you may install the chart with RBAC enabled (see below).
112+
113+
### Enable RBAC role/rolebinding creation
114+
115+
To enable the creation of RBAC resources (On clusters with RBAC). Do the following:
116+
117+
```console
118+
$ helm install ./deploy/chart/local-path-provisioner --name local-path-storage --namespace local-path-storage --set rbac.create=true
119+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
You can create a hostpath-backed persistent volume with a persistent volume claim like this:
2+
3+
apiVersion: v1
4+
kind: PersistentVolumeClaim
5+
metadata:
6+
name: local-path-pvc
7+
spec:
8+
accessModes:
9+
- ReadWriteOnce
10+
storageClassName: {{ .Values.storageClass.name }}
11+
resources:
12+
requests:
13+
storage: 2Gi
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
{{/* vim: set filetype=mustache: */}}
2+
{{/*
3+
Expand the name of the chart.
4+
*/}}
5+
{{- define "local-path-provisioner.name" -}}
6+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
7+
{{- end -}}
8+
9+
{{/*
10+
Create a default fully qualified app name.
11+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
12+
If release name contains chart name it will be used as a full name.
13+
*/}}
14+
{{- define "local-path-provisioner.fullname" -}}
15+
{{- if .Values.fullnameOverride -}}
16+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
17+
{{- else -}}
18+
{{- $name := default .Chart.Name .Values.nameOverride -}}
19+
{{- if contains $name .Release.Name -}}
20+
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
21+
{{- else -}}
22+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
23+
{{- end -}}
24+
{{- end -}}
25+
{{- end -}}
26+
27+
{{/*
28+
Create chart name and version as used by the chart label.
29+
*/}}
30+
{{- define "local-path-provisioner.chart" -}}
31+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
32+
{{- end -}}
33+
34+
{{- define "local-path-provisioner.namespace" -}}
35+
{{- if .Values.namespaceOverride }}
36+
{{- .Values.namespaceOverride }}
37+
{{- else }}
38+
{{- .Release.Namespace }}
39+
{{- end }}
40+
{{- end -}}
41+
42+
{{/*
43+
Common labels
44+
*/}}
45+
{{- define "local-path-provisioner.labels" -}}
46+
app.kubernetes.io/name: {{ include "local-path-provisioner.name" . }}
47+
helm.sh/chart: {{ include "local-path-provisioner.chart" . }}
48+
app.kubernetes.io/instance: {{ .Release.Name }}
49+
{{- if .Chart.AppVersion }}
50+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
51+
{{- end }}
52+
app.kubernetes.io/managed-by: {{ .Release.Service }}
53+
{{- if .Values.commonLabels}}
54+
{{ toYaml .Values.commonLabels }}
55+
{{- end }}
56+
{{- end -}}
57+
58+
{{/*
59+
Create the name of the service account to use.
60+
*/}}
61+
{{- define "local-path-provisioner.serviceAccountName" -}}
62+
{{- if .Values.serviceAccount.create -}}
63+
{{ default (include "local-path-provisioner.fullname" .) .Values.serviceAccount.name }}
64+
{{- else -}}
65+
{{ default "default" .Values.serviceAccount.name }}
66+
{{- end -}}
67+
{{- end -}}
68+
69+
{{/*
70+
Create the name of the provisioner to use.
71+
*/}}
72+
{{- define "local-path-provisioner.provisionerName" -}}
73+
{{- if .Values.storageClass.provisionerName -}}
74+
{{- printf .Values.storageClass.provisionerName -}}
75+
{{- else -}}
76+
cluster.local/{{ template "local-path-provisioner.fullname" . -}}
77+
{{- end -}}
78+
{{- end -}}
79+
80+
{{- define "local-path-provisioner.secret" }}
81+
{{- printf "{\"auths\": {\"%s\": {\"auth\": \"%s\"}}}" .Values.privateRegistry.registryUrl (printf "%s:%s" .Values.privateRegistry.registryUser .Values.privateRegistry.registryPasswd | b64enc) | b64enc }}
82+
{{- end }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{{- if .Values.rbac.create -}}
2+
apiVersion: rbac.authorization.k8s.io/v1
3+
kind: ClusterRole
4+
metadata:
5+
name: {{ include "local-path-provisioner.fullname" . }}
6+
labels:
7+
{{ include "local-path-provisioner.labels" . | indent 4 }}
8+
rules:
9+
- apiGroups: [""]
10+
resources: ["nodes", "persistentvolumeclaims", "configmaps", "pods", "pods/log"]
11+
verbs: ["get", "list", "watch"]
12+
- apiGroups: [""]
13+
resources: ["persistentvolumes"]
14+
verbs: ["get", "list", "watch", "create", "patch", "update", "delete"]
15+
- apiGroups: [""]
16+
resources: ["events"]
17+
verbs: ["create", "patch"]
18+
- apiGroups: ["storage.k8s.io"]
19+
resources: ["storageclasses"]
20+
verbs: ["get", "list", "watch"]
21+
{{- end -}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{{- if .Values.rbac.create -}}
2+
apiVersion: rbac.authorization.k8s.io/v1
3+
kind: ClusterRoleBinding
4+
metadata:
5+
name: {{ include "local-path-provisioner.fullname" . }}
6+
labels:
7+
{{ include "local-path-provisioner.labels" . | indent 4 }}
8+
roleRef:
9+
apiGroup: rbac.authorization.k8s.io
10+
kind: ClusterRole
11+
name: {{ template "local-path-provisioner.fullname" . }}
12+
subjects:
13+
- kind: ServiceAccount
14+
name: {{ template "local-path-provisioner.serviceAccountName" . }}
15+
namespace: {{ .Release.Namespace }}
16+
{{- end -}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: {{ .Values.configmap.name }}
5+
namespace: {{ include "local-path-provisioner.namespace" . }}
6+
labels:
7+
{{ include "local-path-provisioner.labels" . | indent 4 }}
8+
data:
9+
config.json: |-
10+
{{- $config := dict }}
11+
{{- with .Values.nodePathMap }}
12+
{{- $config = set $config "nodePathMap" . }}
13+
{{- end }}
14+
{{- with .Values.sharedFileSystemPath }}
15+
{{- $config = set $config "sharedFileSystemPath" . }}
16+
{{- end }}
17+
{{- with .Values.storageClassConfigs }}
18+
{{- $configs := dict }}
19+
{{- range $key, $value := . }}
20+
{{- $configValue := dict }}
21+
{{- with $value.nodePathMap }}
22+
{{- $configValue = set $configValue "nodePathMap" . }}
23+
{{- end }}
24+
{{- with $value.sharedFileSystemPath }}
25+
{{- $configValue = set $configValue "sharedFileSystemPath" . }}
26+
{{- end }}
27+
{{- $configs = set $configs $key $configValue }}
28+
{{- end }}
29+
{{- $config = set $config "storageClassConfigs" $configs }}
30+
{{- end }}
31+
{{- $config | toPrettyJson | nindent 4 }}
32+
setup: |-
33+
{{- .Values.configmap.setup | nindent 4 }}
34+
teardown: |-
35+
{{- .Values.configmap.teardown | nindent 4 }}
36+
helperPod.yaml: |-
37+
apiVersion: v1
38+
kind: Pod
39+
metadata:
40+
name: {{ .Values.configmap.helperPod.name }}
41+
namespace: {{ default (include "local-path-provisioner.namespace" .) .Values.configmap.helperPod.namespaceOverride }}
42+
{{- with .Values.configmap.helperPod.annotations }}
43+
annotations:
44+
{{- toYaml . | nindent 8 }}
45+
{{- end }}
46+
spec:
47+
priorityClassName: system-node-critical
48+
tolerations:
49+
- key: node.kubernetes.io/disk-pressure
50+
operator: Exists
51+
effect: NoSchedule
52+
containers:
53+
- name: helper-pod
54+
{{- if .Values.privateRegistry.registryUrl }}
55+
image: {{ .Values.privateRegistry.registryUrl }}/{{ .Values.helperImage.repository }}:{{ .Values.helperImage.tag }}
56+
{{- else }}
57+
image: {{ .Values.helperImage.repository }}:{{ .Values.helperImage.tag }}
58+
{{- end }}
59+
imagePullPolicy: {{ .Values.image.pullPolicy }}
60+
resources:
61+
{{- toYaml .Values.helperPod.resources | nindent 12 }}

0 commit comments

Comments
 (0)