mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	updated test/e2e/pvutil.go to use c.CoreV1()
This commit is contained in:
		@@ -100,7 +100,7 @@ func PVPVCMapCleanup(c clientset.Interface, ns string, pvols PVMap, claims PVCMa
 | 
				
			|||||||
func DeletePersistentVolume(c clientset.Interface, pvName string) {
 | 
					func DeletePersistentVolume(c clientset.Interface, pvName string) {
 | 
				
			||||||
	if c != nil && len(pvName) > 0 {
 | 
						if c != nil && len(pvName) > 0 {
 | 
				
			||||||
		Logf("Deleting PersistentVolume %v", pvName)
 | 
							Logf("Deleting PersistentVolume %v", pvName)
 | 
				
			||||||
		err := c.Core().PersistentVolumes().Delete(pvName, nil)
 | 
							err := c.CoreV1().PersistentVolumes().Delete(pvName, nil)
 | 
				
			||||||
		if err != nil && !apierrs.IsNotFound(err) {
 | 
							if err != nil && !apierrs.IsNotFound(err) {
 | 
				
			||||||
			Expect(err).NotTo(HaveOccurred())
 | 
								Expect(err).NotTo(HaveOccurred())
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -111,7 +111,7 @@ func DeletePersistentVolume(c clientset.Interface, pvName string) {
 | 
				
			|||||||
func DeletePersistentVolumeClaim(c clientset.Interface, pvcName string, ns string) {
 | 
					func DeletePersistentVolumeClaim(c clientset.Interface, pvcName string, ns string) {
 | 
				
			||||||
	if c != nil && len(pvcName) > 0 {
 | 
						if c != nil && len(pvcName) > 0 {
 | 
				
			||||||
		Logf("Deleting PersistentVolumeClaim %v", pvcName)
 | 
							Logf("Deleting PersistentVolumeClaim %v", pvcName)
 | 
				
			||||||
		err := c.Core().PersistentVolumeClaims(ns).Delete(pvcName, nil)
 | 
							err := c.CoreV1().PersistentVolumeClaims(ns).Delete(pvcName, nil)
 | 
				
			||||||
		if err != nil && !apierrs.IsNotFound(err) {
 | 
							if err != nil && !apierrs.IsNotFound(err) {
 | 
				
			||||||
			Expect(err).NotTo(HaveOccurred())
 | 
								Expect(err).NotTo(HaveOccurred())
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -128,7 +128,7 @@ func DeletePVCandValidatePV(c clientset.Interface, ns string, pvc *v1.Persistent
 | 
				
			|||||||
	DeletePersistentVolumeClaim(c, pvc.Name, ns)
 | 
						DeletePersistentVolumeClaim(c, pvc.Name, ns)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Check that the PVC is really deleted.
 | 
						// Check that the PVC is really deleted.
 | 
				
			||||||
	pvc, err := c.Core().PersistentVolumeClaims(ns).Get(pvc.Name, metav1.GetOptions{})
 | 
						pvc, err := c.CoreV1().PersistentVolumeClaims(ns).Get(pvc.Name, metav1.GetOptions{})
 | 
				
			||||||
	Expect(apierrs.IsNotFound(err)).To(BeTrue())
 | 
						Expect(apierrs.IsNotFound(err)).To(BeTrue())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Wait for the PV's phase to return to be `expectPVPhase`
 | 
						// Wait for the PV's phase to return to be `expectPVPhase`
 | 
				
			||||||
@@ -137,7 +137,7 @@ func DeletePVCandValidatePV(c clientset.Interface, ns string, pvc *v1.Persistent
 | 
				
			|||||||
	Expect(err).NotTo(HaveOccurred())
 | 
						Expect(err).NotTo(HaveOccurred())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// examine the pv's ClaimRef and UID and compare to expected values
 | 
						// examine the pv's ClaimRef and UID and compare to expected values
 | 
				
			||||||
	pv, err = c.Core().PersistentVolumes().Get(pv.Name, metav1.GetOptions{})
 | 
						pv, err = c.CoreV1().PersistentVolumes().Get(pv.Name, metav1.GetOptions{})
 | 
				
			||||||
	Expect(err).NotTo(HaveOccurred())
 | 
						Expect(err).NotTo(HaveOccurred())
 | 
				
			||||||
	cr := pv.Spec.ClaimRef
 | 
						cr := pv.Spec.ClaimRef
 | 
				
			||||||
	if expectPVPhase == v1.VolumeAvailable {
 | 
						if expectPVPhase == v1.VolumeAvailable {
 | 
				
			||||||
@@ -162,7 +162,7 @@ func DeletePVCandValidatePVGroup(c clientset.Interface, ns string, pvols PVMap,
 | 
				
			|||||||
	var boundPVs, deletedPVCs int
 | 
						var boundPVs, deletedPVCs int
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for pvName := range pvols {
 | 
						for pvName := range pvols {
 | 
				
			||||||
		pv, err := c.Core().PersistentVolumes().Get(pvName, metav1.GetOptions{})
 | 
							pv, err := c.CoreV1().PersistentVolumes().Get(pvName, metav1.GetOptions{})
 | 
				
			||||||
		Expect(apierrs.IsNotFound(err)).To(BeFalse())
 | 
							Expect(apierrs.IsNotFound(err)).To(BeFalse())
 | 
				
			||||||
		cr := pv.Spec.ClaimRef
 | 
							cr := pv.Spec.ClaimRef
 | 
				
			||||||
		// if pv is bound then delete the pvc it is bound to
 | 
							// if pv is bound then delete the pvc it is bound to
 | 
				
			||||||
@@ -173,7 +173,7 @@ func DeletePVCandValidatePVGroup(c clientset.Interface, ns string, pvols PVMap,
 | 
				
			|||||||
			pvcKey := makePvcKey(ns, cr.Name)
 | 
								pvcKey := makePvcKey(ns, cr.Name)
 | 
				
			||||||
			_, found := claims[pvcKey]
 | 
								_, found := claims[pvcKey]
 | 
				
			||||||
			Expect(found).To(BeTrue())
 | 
								Expect(found).To(BeTrue())
 | 
				
			||||||
			pvc, err := c.Core().PersistentVolumeClaims(ns).Get(cr.Name, metav1.GetOptions{})
 | 
								pvc, err := c.CoreV1().PersistentVolumeClaims(ns).Get(cr.Name, metav1.GetOptions{})
 | 
				
			||||||
			Expect(apierrs.IsNotFound(err)).To(BeFalse())
 | 
								Expect(apierrs.IsNotFound(err)).To(BeFalse())
 | 
				
			||||||
			DeletePVCandValidatePV(c, ns, pvc, pv, expectPVPhase)
 | 
								DeletePVCandValidatePV(c, ns, pvc, pv, expectPVPhase)
 | 
				
			||||||
			delete(claims, pvcKey)
 | 
								delete(claims, pvcKey)
 | 
				
			||||||
@@ -186,7 +186,7 @@ func DeletePVCandValidatePVGroup(c clientset.Interface, ns string, pvols PVMap,
 | 
				
			|||||||
// create the PV resource. Fails test on error.
 | 
					// create the PV resource. Fails test on error.
 | 
				
			||||||
func createPV(c clientset.Interface, pv *v1.PersistentVolume) *v1.PersistentVolume {
 | 
					func createPV(c clientset.Interface, pv *v1.PersistentVolume) *v1.PersistentVolume {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pv, err := c.Core().PersistentVolumes().Create(pv)
 | 
						pv, err := c.CoreV1().PersistentVolumes().Create(pv)
 | 
				
			||||||
	Expect(err).NotTo(HaveOccurred())
 | 
						Expect(err).NotTo(HaveOccurred())
 | 
				
			||||||
	return pv
 | 
						return pv
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -194,7 +194,7 @@ func createPV(c clientset.Interface, pv *v1.PersistentVolume) *v1.PersistentVolu
 | 
				
			|||||||
// create the PVC resource. Fails test on error.
 | 
					// create the PVC resource. Fails test on error.
 | 
				
			||||||
func CreatePVC(c clientset.Interface, ns string, pvc *v1.PersistentVolumeClaim) *v1.PersistentVolumeClaim {
 | 
					func CreatePVC(c clientset.Interface, ns string, pvc *v1.PersistentVolumeClaim) *v1.PersistentVolumeClaim {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pvc, err := c.Core().PersistentVolumeClaims(ns).Create(pvc)
 | 
						pvc, err := c.CoreV1().PersistentVolumeClaims(ns).Create(pvc)
 | 
				
			||||||
	Expect(err).NotTo(HaveOccurred())
 | 
						Expect(err).NotTo(HaveOccurred())
 | 
				
			||||||
	return pvc
 | 
						return pvc
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -316,11 +316,11 @@ func WaitOnPVandPVC(c clientset.Interface, ns string, pv *v1.PersistentVolume, p
 | 
				
			|||||||
	Expect(err).NotTo(HaveOccurred())
 | 
						Expect(err).NotTo(HaveOccurred())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Re-get the pv and pvc objects
 | 
						// Re-get the pv and pvc objects
 | 
				
			||||||
	pv, err = c.Core().PersistentVolumes().Get(pv.Name, metav1.GetOptions{})
 | 
						pv, err = c.CoreV1().PersistentVolumes().Get(pv.Name, metav1.GetOptions{})
 | 
				
			||||||
	Expect(err).NotTo(HaveOccurred())
 | 
						Expect(err).NotTo(HaveOccurred())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Re-get the pvc and
 | 
						// Re-get the pvc and
 | 
				
			||||||
	pvc, err = c.Core().PersistentVolumeClaims(ns).Get(pvc.Name, metav1.GetOptions{})
 | 
						pvc, err = c.CoreV1().PersistentVolumeClaims(ns).Get(pvc.Name, metav1.GetOptions{})
 | 
				
			||||||
	Expect(err).NotTo(HaveOccurred())
 | 
						Expect(err).NotTo(HaveOccurred())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// The pv and pvc are both bound, but to each other?
 | 
						// The pv and pvc are both bound, but to each other?
 | 
				
			||||||
@@ -354,7 +354,7 @@ func WaitAndVerifyBinds(c clientset.Interface, ns string, pvols PVMap, claims PV
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
		Expect(err).NotTo(HaveOccurred())
 | 
							Expect(err).NotTo(HaveOccurred())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		pv, err := c.Core().PersistentVolumes().Get(pvName, metav1.GetOptions{})
 | 
							pv, err := c.CoreV1().PersistentVolumes().Get(pvName, metav1.GetOptions{})
 | 
				
			||||||
		Expect(err).NotTo(HaveOccurred())
 | 
							Expect(err).NotTo(HaveOccurred())
 | 
				
			||||||
		if cr := pv.Spec.ClaimRef; cr != nil && len(cr.Name) > 0 {
 | 
							if cr := pv.Spec.ClaimRef; cr != nil && len(cr.Name) > 0 {
 | 
				
			||||||
			// Assert bound pvc is a test resource. Failing assertion could
 | 
								// Assert bound pvc is a test resource. Failing assertion could
 | 
				
			||||||
@@ -391,7 +391,7 @@ func DeletePodWithWait(f *Framework, c clientset.Interface, pod *v1.Pod) {
 | 
				
			|||||||
		return
 | 
							return
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	Logf("Deleting pod %v", pod.Name)
 | 
						Logf("Deleting pod %v", pod.Name)
 | 
				
			||||||
	err := c.Core().Pods(pod.Namespace).Delete(pod.Name, nil)
 | 
						err := c.CoreV1().Pods(pod.Namespace).Delete(pod.Name, nil)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		if apierrs.IsNotFound(err) {
 | 
							if apierrs.IsNotFound(err) {
 | 
				
			||||||
			return // assume pod was deleted already
 | 
								return // assume pod was deleted already
 | 
				
			||||||
@@ -418,7 +418,7 @@ func CreateWaitAndDeletePod(f *Framework, c clientset.Interface, ns string, clai
 | 
				
			|||||||
	pod := MakeWritePod(ns, claimName)
 | 
						pod := MakeWritePod(ns, claimName)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Instantiate pod (Create)
 | 
						// Instantiate pod (Create)
 | 
				
			||||||
	runPod, err := c.Core().Pods(ns).Create(pod)
 | 
						runPod, err := c.CoreV1().Pods(ns).Create(pod)
 | 
				
			||||||
	Expect(err).NotTo(HaveOccurred())
 | 
						Expect(err).NotTo(HaveOccurred())
 | 
				
			||||||
	Expect(runPod).NotTo(BeNil())
 | 
						Expect(runPod).NotTo(BeNil())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -575,13 +575,13 @@ func MakePod(ns string, pvcName string, isPrivileged bool, command string) *v1.P
 | 
				
			|||||||
// Define and create a pod with a mounted PV.  Pod runs infinite loop until killed.
 | 
					// Define and create a pod with a mounted PV.  Pod runs infinite loop until killed.
 | 
				
			||||||
func CreateClientPod(c clientset.Interface, ns string, pvc *v1.PersistentVolumeClaim) *v1.Pod {
 | 
					func CreateClientPod(c clientset.Interface, ns string, pvc *v1.PersistentVolumeClaim) *v1.Pod {
 | 
				
			||||||
	clientPod := MakePod(ns, pvc.Name, true, "")
 | 
						clientPod := MakePod(ns, pvc.Name, true, "")
 | 
				
			||||||
	clientPod, err := c.Core().Pods(ns).Create(clientPod)
 | 
						clientPod, err := c.CoreV1().Pods(ns).Create(clientPod)
 | 
				
			||||||
	Expect(err).NotTo(HaveOccurred())
 | 
						Expect(err).NotTo(HaveOccurred())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Verify the pod is running before returning it
 | 
						// Verify the pod is running before returning it
 | 
				
			||||||
	err = WaitForPodRunningInNamespace(c, clientPod)
 | 
						err = WaitForPodRunningInNamespace(c, clientPod)
 | 
				
			||||||
	Expect(err).NotTo(HaveOccurred())
 | 
						Expect(err).NotTo(HaveOccurred())
 | 
				
			||||||
	clientPod, err = c.Core().Pods(ns).Get(clientPod.Name, metav1.GetOptions{})
 | 
						clientPod, err = c.CoreV1().Pods(ns).Get(clientPod.Name, metav1.GetOptions{})
 | 
				
			||||||
	Expect(apierrs.IsNotFound(err)).To(BeFalse())
 | 
						Expect(apierrs.IsNotFound(err)).To(BeFalse())
 | 
				
			||||||
	return clientPod
 | 
						return clientPod
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user