Merge pull request #116568 from pacoxu/fix-alpha-feature-ci

get pvc again to get the pv name that bound to the PVC
This commit is contained in:
Kubernetes Prow Robot 2023-03-14 10:41:09 -07:00 committed by GitHub
commit 94ed45ab4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 22 additions and 13 deletions

View File

@ -836,8 +836,8 @@ func compareCSICalls(ctx context.Context, trackedCalls []string, expectedCallSeq
// if the secret is not nil, compare it // if the secret is not nil, compare it
if expectedCall.expectedSecret != nil { if expectedCall.expectedSecret != nil {
if !reflect.DeepEqual(expectedCall.expectedSecret, c.Request.Secret) { if !reflect.DeepEqual(expectedCall.expectedSecret, c.Request.Secrets) {
return allCalls, i, fmt.Errorf("Unexpected secret: expected %v, got %v", expectedCall.expectedSecret, c.Request.Secret) return allCalls, i, fmt.Errorf("Unexpected secret: expected %v, got %v", expectedCall.expectedSecret, c.Request.Secrets)
} }
} }

View File

@ -201,7 +201,7 @@ var _ = utils.SIGDescribe("CSI Mock volume expansion", func() {
}) })
} }
}) })
ginkgo.Context("CSI online volume expansion with secret[Feature:CSINodeExpandSecret]", func() { ginkgo.Context("CSI online volume expansion with secret", func() {
var stringSecret = map[string]string{ var stringSecret = map[string]string{
"username": "admin", "username": "admin",
"password": "t0p-Secret", "password": "t0p-Secret",
@ -274,6 +274,11 @@ var _ = utils.SIGDescribe("CSI Mock volume expansion", func() {
err = e2epod.WaitForPodNameRunningInNamespace(ctx, m.cs, pod.Name, pod.Namespace) err = e2epod.WaitForPodNameRunningInNamespace(ctx, m.cs, pod.Name, pod.Namespace)
framework.ExpectNoError(err, "Failed to start pod1: %v", err) framework.ExpectNoError(err, "Failed to start pod1: %v", err)
pvc, err = m.cs.CoreV1().PersistentVolumeClaims(pvc.Namespace).Get(ctx, pvc.Name, metav1.GetOptions{})
if err != nil {
framework.Failf("failed to get pvc %s, %v", pvc.Name, err)
}
gomega.Expect(pvc.Spec.VolumeName).ShouldNot(gomega.BeEquivalentTo(""), "while provisioning a volume for resizing")
pv, err := m.cs.CoreV1().PersistentVolumes().Get(ctx, pvc.Spec.VolumeName, metav1.GetOptions{}) pv, err := m.cs.CoreV1().PersistentVolumes().Get(ctx, pvc.Spec.VolumeName, metav1.GetOptions{})
if err != nil { if err != nil {
framework.Failf("failed to get pv %s, %v", pvc.Spec.VolumeName, err) framework.Failf("failed to get pv %s, %v", pvc.Spec.VolumeName, err)
@ -281,6 +286,9 @@ var _ = utils.SIGDescribe("CSI Mock volume expansion", func() {
if pv.Spec.CSI == nil || pv.Spec.CSI.NodeExpandSecretRef == nil { if pv.Spec.CSI == nil || pv.Spec.CSI.NodeExpandSecretRef == nil {
framework.Fail("creating pv without 'NodeExpandSecretRef'") framework.Fail("creating pv without 'NodeExpandSecretRef'")
} }
if pv.Spec.CSI.NodeExpandSecretRef.Namespace != f.Namespace.Name || pv.Spec.CSI.NodeExpandSecretRef.Name != secretName {
framework.Failf("failed to set node expand secret ref, namespace: %s name: %s", pv.Spec.CSI.NodeExpandSecretRef.Namespace, pv.Spec.CSI.NodeExpandSecretRef.Name)
}
ginkgo.By("Expanding current pvc") ginkgo.By("Expanding current pvc")
newSize := resource.MustParse("6Gi") newSize := resource.MustParse("6Gi")
@ -298,9 +306,14 @@ var _ = utils.SIGDescribe("CSI Mock volume expansion", func() {
err = testsuites.WaitForControllerVolumeResize(ctx, pvc, m.cs, csiResizeWaitPeriod) err = testsuites.WaitForControllerVolumeResize(ctx, pvc, m.cs, csiResizeWaitPeriod)
framework.ExpectNoError(err, "While waiting for PV resize to finish") framework.ExpectNoError(err, "While waiting for PV resize to finish")
ginkgo.By("Waiting for PVC resize to finish")
pvc, err = testsuites.WaitForFSResize(ctx, pvc, m.cs)
framework.ExpectNoError(err, "while waiting for PVC to finish")
ginkgo.By("Waiting for all remaining expected CSI calls") ginkgo.By("Waiting for all remaining expected CSI calls")
err = wait.Poll(time.Second, csiResizeWaitPeriod, func() (done bool, err error) { err = wait.Poll(time.Second, csiResizeWaitPeriod, func() (done bool, err error) {
_, index, err := compareCSICalls(ctx, trackedCalls, test.expectedCalls, m.driver.GetCalls) var index int
_, index, err = compareCSICalls(ctx, trackedCalls, test.expectedCalls, m.driver.GetCalls)
if err != nil { if err != nil {
return true, err return true, err
} }
@ -316,10 +329,6 @@ var _ = utils.SIGDescribe("CSI Mock volume expansion", func() {
}) })
framework.ExpectNoError(err, "while waiting for all CSI calls") framework.ExpectNoError(err, "while waiting for all CSI calls")
ginkgo.By("Waiting for PVC resize to finish")
pvc, err = testsuites.WaitForFSResize(ctx, pvc, m.cs)
framework.ExpectNoError(err, "while waiting for PVC to finish")
pvcConditions := pvc.Status.Conditions pvcConditions := pvc.Status.Conditions
framework.ExpectEqual(len(pvcConditions), 0, "pvc should not have conditions") framework.ExpectEqual(len(pvcConditions), 0, "pvc should not have conditions")
}) })

View File

@ -379,7 +379,7 @@ type MockCSICall struct {
Method string Method string
Request struct { Request struct {
VolumeContext map[string]string `json:"volume_context"` VolumeContext map[string]string `json:"volume_context"`
Secret map[string]string `json:"secret"` Secrets map[string]string `json:"secrets"`
} }
FullError struct { FullError struct {
Code codes.Code `json:"code"` Code codes.Code `json:"code"`

View File

@ -39,7 +39,7 @@ spec:
- name: socket-dir - name: socket-dir
mountPath: /csi mountPath: /csi
- name: csi-provisioner - name: csi-provisioner
image: registry.k8s.io/sig-storage/csi-provisioner:v3.3.0 image: registry.k8s.io/sig-storage/csi-provisioner:v3.4.0
args: args:
- "--v=5" - "--v=5"
- "--csi-address=/csi/csi.sock" - "--csi-address=/csi/csi.sock"

View File

@ -323,7 +323,7 @@ spec:
name: socket-dir name: socket-dir
- name: csi-provisioner - name: csi-provisioner
image: registry.k8s.io/sig-storage/csi-provisioner:v3.3.0 image: registry.k8s.io/sig-storage/csi-provisioner:v3.4.0
args: args:
- -v=5 - -v=5
- --csi-address=/csi/csi.sock - --csi-address=/csi/csi.sock

View File

@ -15,7 +15,7 @@ spec:
serviceAccountName: csi-mock serviceAccountName: csi-mock
containers: containers:
- name: csi-provisioner - name: csi-provisioner
image: registry.k8s.io/sig-storage/csi-provisioner:v3.3.0 image: registry.k8s.io/sig-storage/csi-provisioner:v3.4.0
args: args:
- "--csi-address=$(ADDRESS)" - "--csi-address=$(ADDRESS)"
# Topology support is needed for the pod rescheduling test # Topology support is needed for the pod rescheduling test

View File

@ -15,7 +15,7 @@ spec:
serviceAccountName: csi-mock serviceAccountName: csi-mock
containers: containers:
- name: csi-provisioner - name: csi-provisioner
image: registry.k8s.io/sig-storage/csi-provisioner:v3.3.0 image: registry.k8s.io/sig-storage/csi-provisioner:v3.4.0
args: args:
- "--csi-address=$(ADDRESS)" - "--csi-address=$(ADDRESS)"
# Topology support is needed for the pod rescheduling test # Topology support is needed for the pod rescheduling test