Skip to content

Commit

Permalink
feat:support custom folder expression and annotation setting folder
Browse files Browse the repository at this point in the history
  • Loading branch information
houkunpeng committed Feb 21, 2023
1 parent 5decf72 commit b7b83ea
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 62 deletions.
40 changes: 0 additions & 40 deletions examples/custom_path/deployment.yaml

This file was deleted.

21 changes: 0 additions & 21 deletions examples/custom_path/pvc.yaml

This file was deleted.

4 changes: 4 additions & 0 deletions examples/pvc-with-custom-folder/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- pvc.yaml
13 changes: 13 additions & 0 deletions examples/pvc-with-custom-folder/pvc.yaml
Original file line number Diff line number Diff line change
@@ -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
9 changes: 8 additions & 1 deletion test/pod_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build e2e
// +build e2e

package test
Expand All @@ -6,9 +7,9 @@ import (
"fmt"
"github.com/kelseyhightower/envconfig"
"github.com/stretchr/testify/suite"
"strings"
"testing"
"time"
"strings"
)

const (
Expand Down Expand Up @@ -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)

Expand Down
10 changes: 10 additions & 0 deletions test/testdata/pod-with-custom-floder/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit b7b83ea

Please sign in to comment.