Skip to content

Commit

Permalink
test: use windows server ip address in host process deployment e2e test
Browse files Browse the repository at this point in the history
fix
  • Loading branch information
andyzhangx committed Dec 31, 2023
1 parent 5fa8e43 commit 0f00bdc
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ spec:
- --nodeid=$(KUBE_NODE_NAME)
- "--enable-get-volume-stats={{ .Values.feature.enableGetVolumeStats }}"
- "--remove-smb-mapping-during-unmount={{ .Values.windows.removeSMBMappingDuringUnmount }}"
- "--enable-windows-host-process=true"
env:
- name: CSI_ENDPOINT
value: unix://{{ .Values.windows.kubelet | replace "\\" "\\\\" }}\\plugins\\{{ .Values.driver.name }}\\csi.sock
Expand Down
19 changes: 19 additions & 0 deletions test/e2e/dynamic_provisioning_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,15 @@ package e2e

import (
"fmt"
"log"
"os/exec"
"strings"

"github.com/kubernetes-csi/csi-driver-smb/test/e2e/driver"
"github.com/kubernetes-csi/csi-driver-smb/test/e2e/testsuites"

"github.com/onsi/ginkgo/v2"
"github.com/onsi/gomega"
v1 "k8s.io/api/core/v1"
clientset "k8s.io/client-go/kubernetes"
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
Expand Down Expand Up @@ -51,6 +55,21 @@ var _ = ginkgo.Describe("Dynamic Provisioning", func() {

cs = f.ClientSet
ns = f.Namespace

if isUsingHostProcessDeployment {
log.Printf("trying to get smb-server service IP address since it's using host process deployment...")
cmd := exec.Command("kubectl", "get svc smb-server | grep smb | awk '{print $4}'")
output, err := cmd.CombinedOutput()
log.Printf("got output: %v, error: %v\n", string(output), err)
gomega.Expect(err).NotTo(gomega.HaveOccurred())

server := strings.TrimSuffix(string(output), "\n")
log.Printf("use server on Windows: %s\n", server)
newShareAddress := fmt.Sprintf("//%s/share", server)
defaultStorageClassParameters["source"] = newShareAddress
subDirStorageClassParameters["source"] = newShareAddress
noProvisionerSecretStorageClassParameters["source"] = newShareAddress
}
})

testDriver = driver.InitSMBDriver()
Expand Down
1 change: 1 addition & 0 deletions test/e2e/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const (
var (
smbDriver *smb.Driver
isWindowsCluster = os.Getenv(testWindowsEnvVar) != ""
isUsingHostProcessDeployment = os.Getenv("WINDOWS_USE_HOST_PROCESS_CONTAINERS") == "true"
defaultStorageClassParameters = map[string]string{
"source": "//smb-server.default.svc.cluster.local/share",
"csi.storage.k8s.io/provisioner-secret-name": "smbcreds",
Expand Down

0 comments on commit 0f00bdc

Please sign in to comment.