diff --git a/examples/custom_path/deployment.yaml b/examples/custom_path/deployment.yaml deleted file mode 100644 index b18fc4d86..000000000 --- a/examples/custom_path/deployment.yaml +++ /dev/null @@ -1,40 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: local-path-rwx-example - labels: - app: local-path-rwx-example -spec: - replicas: 2 - selector: - matchLabels: - app: local-path-rwx-example - template: - metadata: - labels: - app: local-path-rwx-example - spec: - topologySpreadConstraints: - - maxSkew: 1 - topologyKey: kubernetes.io/hostname - whenUnsatisfiable: DoNotSchedule - labelSelector: - matchLabels: - app: local-path-rwx-example - containers: - - name: pause - image: busybox - imagePullPolicy: IfNotPresent - command: - - /bin/sh - - -c - - 'hostname >> /data/shared.txt; sleep 3; cat /data/shared.txt; sleep infinity' - volumeMounts: - - name: volv - mountPath: /data - ports: - - containerPort: 80 - volumes: - - name: volv - persistentVolumeClaim: - claimName: local-path-rwx-example diff --git a/examples/custom_path/pvc.yaml b/examples/custom_path/pvc.yaml deleted file mode 100644 index f2d18df4d..000000000 --- a/examples/custom_path/pvc.yaml +++ /dev/null @@ -1,21 +0,0 @@ -# Plesase note, configuration of the Local Path Provisioner should be set correspondingly -# for this to work: -# -# data: -# config.json: |- -# { -# "sharedFileSystemPath": "/shared/fs/mounted/on/the/same/path/on/all/nodes" -# } -# -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: local-path-rwx-example -spec: - accessModes: - - ReadWriteMany - resources: - requests: - storage: 1Gi - storageClassName: local-path - volumeMode: Filesystem diff --git a/examples/pvc-with-custom-folder/kustomization.yaml b/examples/pvc-with-custom-folder/kustomization.yaml new file mode 100644 index 000000000..7bfd4518a --- /dev/null +++ b/examples/pvc-with-custom-folder/kustomization.yaml @@ -0,0 +1,4 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: +- pvc.yaml diff --git a/examples/pvc-with-custom-folder/pvc.yaml b/examples/pvc-with-custom-folder/pvc.yaml new file mode 100644 index 000000000..65c0e7921 --- /dev/null +++ b/examples/pvc-with-custom-folder/pvc.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: custom-folder-pvc + annotations: + "rancher.io/customFolderName": "demo1" +spec: + accessModes: + - ReadWriteOnce + storageClassName: local-path + resources: + requests: + storage: 128Mi diff --git a/test/pod_test.go b/test/pod_test.go index f7be8106a..8061b7553 100644 --- a/test/pod_test.go +++ b/test/pod_test.go @@ -1,3 +1,4 @@ +//go:build e2e // +build e2e package test @@ -6,9 +7,9 @@ import ( "fmt" "github.com/kelseyhightower/envconfig" "github.com/stretchr/testify/suite" + "strings" "testing" "time" - "strings" ) const ( @@ -131,6 +132,12 @@ func (p *PodTestSuite) TestPodWithSubpath() { runTest(p, []string{p.config.IMAGE}, "ready", hostPathVolumeType) } +func (p *PodTestSuite) TestPodWithCustomFolder() { + p.kustomizeDir = "pod-with-custom-folder" + + runTest(p, []string{p.config.IMAGE}, "ready", hostPathVolumeType) +} + func runTest(p *PodTestSuite, images []string, waitCondition, volumeType string) { kustomizeDir := testdataFile(p.kustomizeDir) diff --git a/test/testdata/pod-with-custom-floder/kustomization.yaml b/test/testdata/pod-with-custom-floder/kustomization.yaml new file mode 100644 index 000000000..c43cb220d --- /dev/null +++ b/test/testdata/pod-with-custom-floder/kustomization.yaml @@ -0,0 +1,10 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: +- ../../../deploy +- ../../../examples/pvc-with-custom-folder +commonLabels: + app: custom-folder-provisioner +images: +- name: rancher/local-path-provisioner + newTag: dev