Skip to content

Commit 0e4e10c

Browse files
committed
feat: add feature flag for inline volume support
1 parent 8105a9d commit 0e4e10c

File tree

7 files changed

+24
-2
lines changed

7 files changed

+24
-2
lines changed
34 Bytes
Binary file not shown.

charts/latest/csi-driver-smb/templates/csi-smb-driver.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@ spec:
88
podInfoOnMount: true
99
volumeLifecycleModes:
1010
- Persistent
11+
{{- if .Values.feature.enableInlineVolume }}
1112
- Ephemeral
13+
{{- end }}

charts/latest/csi-driver-smb/templates/rbac-csi-smb.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ roleRef:
9898
name: {{ .Values.rbac.name }}-external-resizer-role
9999
apiGroup: rbac.authorization.k8s.io
100100
---
101+
{{- if .Values.feature.enableInlineVolume }}
101102
kind: ClusterRole
102103
apiVersion: rbac.authorization.k8s.io/v1
103104
metadata:
@@ -107,7 +108,6 @@ rules:
107108
- apiGroups: [""]
108109
resources: ["secrets"]
109110
verbs: ["get"]
110-
111111
---
112112
kind: ClusterRoleBinding
113113
apiVersion: rbac.authorization.k8s.io/v1
@@ -122,4 +122,5 @@ roleRef:
122122
kind: ClusterRole
123123
name: csi-{{ .Values.rbac.name }}-node-secret-role
124124
apiGroup: rbac.authorization.k8s.io
125+
{{- end }}
125126
{{ end }}

charts/latest/csi-driver-smb/values.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ driver:
3939

4040
feature:
4141
enableGetVolumeStats: true
42+
enableInlineVolume: true
4243

4344
controller:
4445
name: csi-smb-controller

test/e2e/dynamic_provisioning_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,12 @@ var _ = ginkgo.Describe("Dynamic Provisioning", func() {
535535
})
536536

537537
ginkgo.It("should create an CSI inline volume", func(ctx ginkgo.SpecContext) {
538+
secretName := "smbcreds"
539+
ginkgo.By(fmt.Sprintf("creating secret %s in namespace %s", secretName, ns.Name))
540+
tsecret := testsuites.CopyTestSecret(ctx, cs, "default", ns, defaultSmbSecretName)
541+
tsecret.Create(ctx)
542+
defer tsecret.Cleanup(ctx)
543+
538544
pods := []testsuites.PodDetails{
539545
{
540546
Cmd: convertToPowershellCommandIfNecessary("echo 'hello world' > /mnt/test-1/data && grep 'hello world' /mnt/test-1/data"),

test/e2e/suite_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ const (
5050
defaultSmbSource = "//smb-server.default.svc.cluster.local/share"
5151
defaultSmbSecretName = "smbcreds"
5252
defaultSmbSecretNamespace = "default"
53+
accountNameForTest = "YW5keXNzZGZpbGUK"
5354
)
5455

5556
var (
@@ -173,7 +174,7 @@ var _ = ginkgo.BeforeSuite(func() {
173174
}
174175

175176
if isWindowsHostProcessDeployment {
176-
decodedBytes, err := base64.StdEncoding.DecodeString("YW5keXNzZGZpbGUK")
177+
decodedBytes, err := base64.StdEncoding.DecodeString(accountNameForTest)
177178
if err != nil {
178179
log.Printf("Error decoding base64 string: %v\n", err)
179180
return

test/e2e/testsuites/testsuites.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -717,6 +717,17 @@ func NewTestSecret(c clientset.Interface, ns *v1.Namespace, name string, data ma
717717
}
718718
}
719719

720+
func CopyTestSecret(ctx context.Context, c clientset.Interface, sourceNamespace string, targetNamespace *v1.Namespace, secretName string) *TestSecret {
721+
secret, err := c.CoreV1().Secrets(sourceNamespace).Get(ctx, secretName, metav1.GetOptions{})
722+
framework.ExpectNoError(err)
723+
724+
return &TestSecret{
725+
client: c,
726+
namespace: targetNamespace,
727+
secret: secret,
728+
}
729+
}
730+
720731
func (t *TestSecret) Create(ctx context.Context) {
721732
var err error
722733
t.secret, err = t.client.CoreV1().Secrets(t.namespace.Name).Create(ctx, t.secret, metav1.CreateOptions{})

0 commit comments

Comments
 (0)