Compare commits
16 Commits
nfs-subdir
...
nfs-subdir
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f491425b8b | ||
|
|
b7b4412004 | ||
|
|
487b9092a6 | ||
|
|
a99f3dafb1 | ||
|
|
571aadd47e | ||
|
|
9b9ac9aa8d | ||
|
|
6b7372c8cd | ||
|
|
5f8f90d71a | ||
|
|
f4f3c572b2 | ||
|
|
8da26f952b | ||
|
|
f716044142 | ||
|
|
54ea552d39 | ||
|
|
0a66252619 | ||
|
|
11566f6795 | ||
|
|
8903a7c073 | ||
|
|
099ddce5cc |
2
Makefile
2
Makefile
@@ -17,4 +17,4 @@ all: build
|
||||
|
||||
include release-tools/build.make
|
||||
|
||||
BUILD_PLATFORMS=linux amd64; linux arm64 -arm64; linux ppc64le -ppc64le; linux s390x -s390x
|
||||
BUILD_PLATFORMS=linux amd64; linux arm -arm; linux arm64 -arm64; linux ppc64le -ppc64le; linux s390x -s390x
|
||||
|
||||
@@ -120,7 +120,7 @@ To disable leader election, define an env variable named ENABLE_LEADER_ELECTION
|
||||
| --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------: |
|
||||
| onDelete | If it exists and has a delete value, delete the directory, if it exists and has a retain value, save the directory. | will be archived with name on the share: `archived-<volume.Name>` |
|
||||
| archiveOnDelete | If it exists and has a false value, delete the directory. if `onDelete` exists, `archiveOnDelete` will be ignored. | will be archived with name on the share: `archived-<volume.Name>` |
|
||||
| pathPattern | Specifies a template for creating a directory path via PVC metadata's such as labels, annotations, name or namespace. To specify metadata use `${.PVC.}`: `${PVC.namespace}` | n/a |
|
||||
| pathPattern | Specifies a template for creating a directory path via PVC metadata's such as labels, annotations, name or namespace. To specify metadata use `${.PVC.<metadata>}`. Example: If folder should be named like `<pvc-namespace>-<pvc-name>`, use `${.PVC.namespace}-${.PVC.name}` as pathPattern. | n/a |
|
||||
|
||||
This is `deploy/class.yaml` which defines the NFS subdir external provisioner's Kubernetes Storage Class:
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ appVersion: 4.0.0
|
||||
description: nfs-subdir-external-provisioner is an automatic provisioner that used your *already configured* NFS server, automatically creating Persistent Volumes.
|
||||
name: nfs-subdir-external-provisioner
|
||||
home: https://github.com/kubernetes-sigs/nfs-subdir-external-provisioner
|
||||
version: 4.0.0
|
||||
version: 4.0.3
|
||||
kubeVersion: ">=1.9.0-0"
|
||||
sources:
|
||||
- https://github.com/kubernetes-sigs/nfs-subdir-external-provisioner
|
||||
|
||||
@@ -61,7 +61,9 @@ The following tables lists the configurable parameters of this chart and their d
|
||||
| `storageClass.reclaimPolicy` | Method used to reclaim an obsoleted volume | `Delete` |
|
||||
| `storageClass.provisionerName` | Name of the provisionerName | null |
|
||||
| `storageClass.archiveOnDelete` | Archive pvc when deleting | `true` |
|
||||
| `storageClass.pathPattern` | Specifies a template for the directory name | null |
|
||||
| `storageClass.accessModes` | Set access mode for PV | `ReadWriteOnce` |
|
||||
| `leaderElection.enabled` | Enables or disables leader election | `true` |
|
||||
| `nfs.server` | Hostname of the NFS server (required) | null (ip or hostname) |
|
||||
| `nfs.path` | Basepath of the mount point to be used | `/nfs-storage` |
|
||||
| `nfs.mountOptions` | Mount options (e.g. 'nfsvers=3') | null |
|
||||
|
||||
@@ -55,6 +55,10 @@ spec:
|
||||
value: {{ .Values.nfs.server }}
|
||||
- name: NFS_PATH
|
||||
value: {{ .Values.nfs.path }}
|
||||
{{- if eq .Values.leaderElection.enabled false }}
|
||||
- name: ENABLE_LEADER_ELECTION
|
||||
value: "false"
|
||||
{{- end }}
|
||||
{{- with .Values.resources }}
|
||||
resources:
|
||||
{{ toYaml . | indent 12 }}
|
||||
|
||||
@@ -17,6 +17,9 @@ allowVolumeExpansion: {{ .Values.storageClass.allowVolumeExpansion }}
|
||||
reclaimPolicy: {{ .Values.storageClass.reclaimPolicy }}
|
||||
parameters:
|
||||
archiveOnDelete: "{{ .Values.storageClass.archiveOnDelete }}"
|
||||
{{- if .Values.storageClass.pathPattern }}
|
||||
pathPattern: "{{ .Values.storageClass.pathPattern }}"
|
||||
{{- end }}
|
||||
{{- if .Values.nfs.mountOptions }}
|
||||
mountOptions:
|
||||
{{- range .Values.nfs.mountOptions }}
|
||||
|
||||
@@ -35,9 +35,17 @@ storageClass:
|
||||
# When set to false your PVs will not be archived by the provisioner upon deletion of the PVC.
|
||||
archiveOnDelete: true
|
||||
|
||||
# Specifies a template for creating a directory path via PVC metadata's such as labels, annotations, name or namespace.
|
||||
# Ignored if value not set.
|
||||
pathPattern:
|
||||
|
||||
# Set access mode - ReadWriteOnce, ReadOnlyMany or ReadWriteMany
|
||||
accessModes: ReadWriteOnce
|
||||
|
||||
leaderElection:
|
||||
# When set to false leader election will be disabled
|
||||
enabled: true
|
||||
|
||||
## For RBAC support:
|
||||
rbac:
|
||||
# Specifies whether RBAC resources should be created
|
||||
|
||||
@@ -139,8 +139,8 @@ func (p *nfsProvisioner) Provision(ctx context.Context, options controller.Provi
|
||||
|
||||
func (p *nfsProvisioner) Delete(ctx context.Context, volume *v1.PersistentVolume) error {
|
||||
path := volume.Spec.PersistentVolumeSource.NFS.Path
|
||||
relativePath := strings.Replace(path, p.path, "", 1)
|
||||
oldPath := filepath.Join(mountPath, relativePath)
|
||||
basePath := filepath.Base(path)
|
||||
oldPath := filepath.Join(mountPath, basePath)
|
||||
|
||||
if _, err := os.Stat(oldPath); os.IsNotExist(err) {
|
||||
glog.Warningf("path %s does not exist, deletion skipped", oldPath)
|
||||
@@ -179,7 +179,7 @@ func (p *nfsProvisioner) Delete(ctx context.Context, volume *v1.PersistentVolume
|
||||
}
|
||||
}
|
||||
|
||||
archivePath := filepath.Join(mountPath, "archived-"+volume.Name)
|
||||
archivePath := filepath.Join(mountPath, "archived-"+basePath)
|
||||
glog.V(4).Infof("archiving path %s to %s", oldPath, archivePath)
|
||||
return os.Rename(oldPath, archivePath)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user