Commit 90b32c4f by Guangbo Chen

Add backup v0.2.2 nfs-provisioner

parent 380bd960
# 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
apiVersion: v1
appVersion: 1.0.9
description: nfs-server-provisioner is an out-of-tree dynamic provisioner for Kubernetes. You can use it to quickly & easily deploy shared storage that works almost anywhere.
name: nfs-provisioner
icon: file://../nfs-logo.png
version: 0.2.2
maintainers:
- name: kiall
email: kiall@macinnes.ie
home: https://github.com/kubernetes/charts/tree/master/stable/nfs-server-provisioner
sources:
- https://github.com/kubernetes-incubator/external-storage/tree/master/nfs
keywords:
- nfs
- storage
approvers:
- kiall
reviewers:
- kiall
# NFS Server Provisioner
[NFS Server Provisioner](https://github.com/kubernetes-incubator/external-storage/tree/master/nfs)
is an out-of-tree dynamic provisioner for Kubernetes. You can use it to quickly
& easily deploy shared storage that works almost anywhere.
This chart will deploy the Kubernetes [external-storage projects](https://github.com/kubernetes-incubator/external-storage)
`nfs` provisioner. This provisioner includes a built in NFS server, and is not intended for connecting to a pre-existing
NFS server. If you have a pre-existing NFS Server, please consider using the [NFS Client Provisioner](https://github.com/kubernetes-incubator/external-storage/tree/master/nfs-client)
instead.
categories:
- storage
labels:
io.rancher.certified: experimental
questions:
- variable: defaultImage
default: true
description: "Use default Docker image"
label: Use Default Image
type: boolean
group: "Container Images"
show_subquestion_if: false
subquestions:
- variable: image.repository
default: "quay.io/kubernetes_incubator/nfs-provisioner"
description: "Docker image name"
type: string
label: NFS Image Name
- variable: image.tag
default: "v1.0.9"
description: "NFS image tag"
type: string
label: Image Tag
- variable: storageClass.create
default: true
description: "Creating the StorageClass"
type: boolean
required: true
label: Creating the StorageClass
group: "StorageClass Setting"
show_subquestion_if: true
subquestions:
- variable: storageClass.defaultClass
default: true
description: "Set StorageClass as the default StorageClass"
type: boolean
label: Set StorageClass as the default StorageClass
- variable: storageClass.reclaimPolicy
default: "Delete"
description: "ReclaimPolicy of the Created StorageClass"
type: enum
label: ReclaimPolicy of the Created StorageClass
options:
- "Delete"
- "Retain"
- variable: storageClass.allowVolumeExpansion
default: true
description: "AllowVolumeExpansion shows whether the storage class allow volume expand"
type: boolean
label: AllowVolumeExpansion Shows Whether The StorageClass Allow Volume Expand
- variable: service.type
default: "ClusterIP"
description: "The type of service to create for the nfs-provisioner"
type: enum
label: nfs-provisioner Service Type
group: "Service Settings"
required: true
options:
- "ClusterIP"
- "NodePort"
show_subquestion_if: "NodePort"
subquestions:
- variable: service.nfsNodePort
default: ""
description: "Sepcify the nodePort of the NFS service"
type: int
label: NodePort of the NFS service
min: 30000
max: 32767
- variable: service.mountdNodePort
default: ""
description: "Sepcify the nodePort of the mountd service"
type: int
label: NodePort of the mountd service
min: 30000
max: 32767
- variable: service.rpcbindNodePort
default: ""
description: "Sepcify the nodePort of the RPC service"
type: int
label: NodePort of the RCP service
min: 30000
max: 32767
# persistence volume settings
- variable: persistence.enabled
default: false
description: "Enable persistent volume for the nfs-server-provisioner"
type: boolean
required: true
label: Persistent Volume Enabled for nfs-server-provisioner
show_subquestion_if: true
group: "Persistent Storage"
subquestions:
- variable: persistence.size
default: "20Gi"
description: "nfs-server-provisionner Persistent Volume Size"
type: string
label: nfs-server-provisionner Volume Size
- variable: persistence.storageClass
default: ""
description: "If undefined or null, uses the default StorageClass. Default to null"
type: storageclass
label: Default StorageClass for nfs-server-provisionner
- variable: persistence.hostPath
default: "/srv"
description: "for GKE uses /home/kubernetes/nfs/ instead, custom nfs host path read and write permission are required, default to /srv"
type: string
label: NFS Host Path
required: true
show_if: "persistence.enabled=false"
group: "Persistent Storage"
The NFS Provisioner service has now been installed.
{{ if .Values.storageClass.create -}}
A storage class named '{{ .Values.storageClass.name }}' has now been created
and is available to provision dynamic volumes.
You can use this storageclass by creating a `PersistentVolumeClaim` with the
correct storageClassName attribute. For example:
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: test-dynamic-volume-claim
spec:
storageClassName: "{{ .Values.storageClass.name }}"
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 100Mi
{{ else -}}
A storage class has NOT been created. You may create a custom `StorageClass`
resource with a `provisioner` attribute of `{{ template "nfs-provisioner.provisionerName" . }}`.
{{ end -}}
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "nfs-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-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-provisioner.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "nfs-provisioner.provisionerName" -}}
{{- if .Values.storageClass.provisionerName -}}
{{- printf .Values.storageClass.provisionerName -}}
{{- else -}}
cluster.local/{{ template "nfs-provisioner.fullname" . -}}
{{- end -}}
{{- end -}}
{{ if .Values.rbac.create -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ template "nfs-provisioner.fullname" . }}
labels:
app: {{ template "nfs-provisioner.name" . }}
chart: {{ template "nfs-provisioner.chart" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
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"]
- apiGroups: [""]
resources: ["events"]
verbs: ["list", "watch", "create", "update", "patch"]
- apiGroups: [""]
resources: ["services", "endpoints"]
verbs: ["get"]
- apiGroups: ["extensions"]
resources: ["podsecuritypolicies"]
resourceNames: ["nfs-provisioner"]
verbs: ["use"]
{{- end -}}
{{- if .Values.rbac.create }}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
labels:
app: {{ template "nfs-provisioner.name" . }}
chart: {{ template "nfs-provisioner.chart" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "nfs-provisioner.fullname" . }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ template "nfs-provisioner.fullname" . }}
subjects:
- kind: ServiceAccount
name: {{ template "nfs-provisioner.fullname" . }}
namespace: {{ .Release.Namespace }}
{{- end -}}
apiVersion: v1
kind: Service
metadata:
name: {{ template "nfs-provisioner.fullname" . }}
labels:
app: {{ template "nfs-provisioner.name" . }}
chart: {{ template "nfs-provisioner.chart" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.nfsPort }}
targetPort: nfs
protocol: TCP
name: nfs
{{- if (and (eq .Values.service.type "NodePort") (not (empty .Values.service.nfsNodePort))) }}
nodePort: {{ .Values.service.nfsNodePort }}
{{- end }}
- port: {{ .Values.service.mountdPort }}
targetPort: mountd
protocol: TCP
name: mountd
{{- if (and (eq .Values.service.type "NodePort") (not (empty .Values.service.mountdNodePort))) }}
nodePort: {{ .Values.service.mountdNodePort }}
{{- end }}
- port: {{ .Values.service.rpcbindPort }}
targetPort: rpcbind-tcp
protocol: TCP
name: rpcbind-tcp
{{- if (and (eq .Values.service.type "NodePort") (not (empty .Values.service.rpcbindNodePort))) }}
nodePort: {{ .Values.service.rpcbindNodePort }}
{{- end }}
- port: {{ .Values.service.rpcbindPort }}
targetPort: rpcbind-udp
protocol: UDP
name: rpcbind-udp
{{- if (and (eq .Values.service.type "NodePort") (not (empty .Values.service.rpcbindNodePort))) }}
nodePort: {{ .Values.service.rpcbindNodePort }}
{{- end }}
{{- if .Values.service.externalIPs }}
externalIPs:
{{ toYaml .Values.service.externalIPs | indent 4 }}
{{- end }}
selector:
app: {{ template "nfs-provisioner.name" . }}
release: {{ .Release.Name }}
{{- if .Values.rbac.create }}
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app: {{ template "nfs-provisioner.name" . }}
chart: {{ template "nfs-provisioner.chart" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "nfs-provisioner.fullname" . }}
{{- end -}}
apiVersion: apps/v1beta2
kind: StatefulSet
metadata:
name: {{ template "nfs-provisioner.fullname" . }}
labels:
app: {{ template "nfs-provisioner.name" . }}
chart: {{ template "nfs-provisioner.chart" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
spec:
# TODO: Investigate how/if nfs-provisioner can be scaled out beyond 1 replica
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: {{ template "nfs-provisioner.name" . }}
release: {{ .Release.Name }}
serviceName: {{ template "nfs-provisioner.fullname" . }}
template:
metadata:
labels:
app: {{ template "nfs-provisioner.name" . }}
chart: {{ template "nfs-provisioner.chart" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
spec:
# NOTE: This is 10 seconds longer than the default nfs-provisioner --grace-period value of 90sec
terminationGracePeriodSeconds: 100
serviceAccountName: {{ if .Values.rbac.create }}{{ template "nfs-provisioner.fullname" . }}{{ else }}{{ .Values.rbac.serviceAccountName | quote }}{{ end }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: nfs
containerPort: 2049
protocol: TCP
- name: mountd
containerPort: 20048
protocol: TCP
- name: rpcbind-tcp
containerPort: 111
protocol: TCP
- name: rpcbind-udp
containerPort: 111
protocol: UDP
securityContext:
capabilities:
add:
- DAC_READ_SEARCH
- SYS_RESOURCE
args:
- "-provisioner={{ template "nfs-provisioner.provisionerName" . }}"
env:
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: SERVICE_NAME
value: {{ template "nfs-provisioner.fullname" . }}
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
volumeMounts:
- name: data
mountPath: /export
resources:
{{- with .Values.resources }}
resources:
{{ toYaml . | indent 12 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{ toYaml . | indent 8 }}
{{- end }}
{{- if not .Values.persistence.enabled }}
volumes:
- name: data
hostPath:
path: {{ .Values.persistence.hostPath }}
{{- end }}
{{- if .Values.persistence.enabled }}
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes: [ {{ .Values.persistence.accessMode | quote }} ]
{{- if .Values.persistence.storageClass }}
{{- if (eq "-" .Values.persistence.storageClass) }}
storageClassName: ""
{{- else }}
storageClassName: {{ .Values.persistence.storageClass | quote }}
{{- end }}
{{- end }}
resources:
requests:
storage: {{ .Values.persistence.size | quote }}
{{- end }}
{{ if .Values.storageClass.create -}}
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: {{ template "nfs-provisioner.fullname" . }}
labels:
app: {{ template "nfs-provisioner.name" . }}
chart: {{ template "nfs-provisioner.chart" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
{{- if .Values.storageClass.defaultClass }}
annotations:
storageclass.kubernetes.io/is-default-class: "true"
{{- end }}
allowVolumeExpansion: {{ .Values.storageClass.allowVolumeExpansion }}
provisioner: {{ template "nfs-provisioner.provisionerName" . }}
reclaimPolicy: {{ .Values.storageClass.reclaimPolicy }}
{{ end -}}
{{- with .Values.storageClass.parameters }}
parameters:
{{ toYaml . | indent 2 }}
{{- end }}
# Default values for nfs-provisioner.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
replicaCount: 1
# imagePullSecrets:
image:
repository: quay.io/kubernetes_incubator/nfs-provisioner
tag: v1.0.9
pullPolicy: IfNotPresent
service:
type: ClusterIP
nfsPort: 2049
mountdPort: 20048
rpcbindPort: 51413
# nfsNodePort:
# mountdNodePort:
# rpcbindNodePort:
externalIPs: []
persistence:
enabled: false
## Persistent Volume Storage Class
## If defined, storageClassName: <storageClass>
## If set to "-", storageClassName: "", which disables dynamic provisioning
## If undefined (the default) or set to null, no storageClassName spec is
## set, choosing the default provisioner. (gp2 on AWS, standard on
## GKE, AWS & OpenStack)
##
# storageClass: "-"
accessMode: ReadWriteOnce
size: 1Gi
hostPath: /srv
## 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
## StorageClass parameters
parameters:
mountOptions: vers=4.1
## ReclaimPolicy field of the class, which can be either Delete or Retain
reclaimPolicy: Delete
## AllowVolumeExpansion shows whether the storage class allow volume expand
allowVolumeExpansion: true
## For RBAC support:
rbac:
create: true
## Ignored if rbac.create is true
##
serviceAccountName: default
resources: {}
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
nodeSelector: {}
tolerations: []
affinity: {}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment