diff --git a/pkg/kn/flags/podspec_helper.go b/pkg/kn/flags/podspec_helper.go index ac7bb7f62..b59f35daa 100644 --- a/pkg/kn/flags/podspec_helper.go +++ b/pkg/kn/flags/podspec_helper.go @@ -528,7 +528,7 @@ func updateVolume(volume *corev1.Volume, info *volumeSourceInfo) error { case EmptyDirVolumeSourceType: volume.EmptyDir = &corev1.EmptyDirVolumeSource{Medium: corev1.StorageMedium(info.emptyDirMemoryType), SizeLimit: info.emptyDirSize} case PVCVolumeSourceType: - volume.PersistentVolumeClaim = &corev1.PersistentVolumeClaimVolumeSource{ClaimName: info.volumeSourceName, ReadOnly: true} + volume.PersistentVolumeClaim = &corev1.PersistentVolumeClaimVolumeSource{ClaimName: info.volumeSourceName} default: return fmt.Errorf("Invalid VolumeSourceType") } diff --git a/test/e2e/service_test.go b/test/e2e/service_test.go index 1d27a4663..f2393375b 100644 --- a/test/e2e/service_test.go +++ b/test/e2e/service_test.go @@ -196,9 +196,13 @@ func serviceCreateWithMount(r *test.KnRunResultCollector) { it := r.KnTest() kubectl := test.NewKubectl("knative-serving") - _, err := kubectl.Run("patch", "cm", "config-features", "--patch={\"data\":{\"kubernetes.podspec-persistent-volume-claim\": \"enabled\", \"kubernetes.podspec-volumes-emptydir\": \"enabled\"}}") + _, err := kubectl.Run("patch", "cm", "config-features", "--patch={\"data\":{\"kubernetes.podspec-persistent-volume-claim\": \"enabled\", "+ + "\"kubernetes.podspec-persistent-volume-write\": \"enabled\", "+ + "\"kubernetes.podspec-volumes-emptydir\": \"enabled\"}}") assert.NilError(r.T(), err) - defer kubectl.Run("patch", "cm", "config-features", "--patch={\"data\":{\"kubernetes.podspec-persistent-volume-claim\": \"disabled\", \"kubernetes.podspec-volumes-emptydir\": \"disabled\"}}") + defer kubectl.Run("patch", "cm", "config-features", "--patch={\"data\":{\"kubernetes.podspec-persistent-volume-claim\": \"disabled\", "+ + "\"kubernetes.podspec-persistent-volume-write\": \"disabled\", "+ + "\"kubernetes.podspec-volumes-emptydir\": \"disabled\"}}") kubectl = test.NewKubectl(it.Namespace()) @@ -213,6 +217,7 @@ func serviceCreateWithMount(r *test.KnRunResultCollector) { r.T().Log("update the subpath in mounted cm") out = r.KnTest().Kn().Run("service", "update", "test-svc", "--mount", "/mydir=cm:test-cm/key") r.AssertNoError(out) + serviceDescribeMount(r, "test-svc", "/mydir", "key") r.T().Log("create secret test-sec") _, err = kubectl.Run("create", "secret", "generic", "test-sec", "--from-literal", "key1=val1") @@ -240,17 +245,9 @@ func serviceCreateWithMount(r *test.KnRunResultCollector) { assert.NilError(r.T(), err) r.AssertNoError(out) - _, err = kubectl.Run("wait", "--for='jsonpath={..status.phase}'=Bound", "pvc/test-pvc", "--timeout=30s") - if err == nil { - r.T().Log("update service with a new pvc mount") - out = r.KnTest().Kn().Run("service", "update", "test-svc", "--mount", "/mydir5=pvc:test-pvc") - r.AssertNoError(out) - - serviceDescribeMount(r, "test-svc", "/mydir", "key") - } else { - r.T().Log("PVC test skip due to unsatisfied PVC") - } - + r.T().Log("update service with a new pvc mount") + out = r.KnTest().Kn().Run("service", "update", "test-svc", "--mount", "/mydir5=pvc:test-pvc") + r.AssertNoError(out) } func getVolumeMountWithHostPath(svc *servingv1.Service, hostPath string) *v1.VolumeMount {