@@ -376,14 +376,12 @@ var _ = framework.KubeDescribe("Variable Expansion", func() {
376
376
}
377
377
378
378
By ("creating the pod with failed condition" )
379
- pod , err := f .ClientSet .CoreV1 ().Pods (f .Namespace .Name ).Create (pod )
380
- Expect (err ).ToNot (HaveOccurred (), "while creating pod" )
381
-
382
- err = framework .WaitTimeoutForPodRunningInNamespace (f .ClientSet , pod .Name , pod .Namespace , framework .PodStartShortTimeout )
383
- Expect (err ).To (HaveOccurred (), "while waiting for pod to be running" )
384
-
385
379
var podClient * framework.PodClient
386
380
podClient = f .PodClient ()
381
+ pod = podClient .Create (pod )
382
+
383
+ err := framework .WaitTimeoutForPodRunningInNamespace (f .ClientSet , pod .Name , pod .Namespace , framework .PodStartShortTimeout )
384
+ Expect (err ).To (HaveOccurred (), "while waiting for pod to be running" )
387
385
388
386
By ("updating the pod" )
389
387
podClient .Update (podName , func (pod * v1.Pod ) {
@@ -470,10 +468,12 @@ var _ = framework.KubeDescribe("Variable Expansion", func() {
470
468
}
471
469
472
470
By ("creating the pod" )
473
- pod , err := f .ClientSet .CoreV1 ().Pods (f .Namespace .Name ).Create (pod )
471
+ var podClient * framework.PodClient
472
+ podClient = f .PodClient ()
473
+ pod = podClient .Create (pod )
474
474
475
475
By ("waiting for pod running" )
476
- err = framework .WaitTimeoutForPodRunningInNamespace (f .ClientSet , pod .Name , pod .Namespace , framework .PodStartShortTimeout )
476
+ err : = framework .WaitTimeoutForPodRunningInNamespace (f .ClientSet , pod .Name , pod .Namespace , framework .PodStartShortTimeout )
477
477
Expect (err ).NotTo (HaveOccurred (), "while waiting for pod to be running" )
478
478
479
479
By ("creating a file in subpath" )
@@ -491,9 +491,6 @@ var _ = framework.KubeDescribe("Variable Expansion", func() {
491
491
}
492
492
493
493
By ("updating the annotation value" )
494
- var podClient * framework.PodClient
495
- podClient = f .PodClient ()
496
-
497
494
podClient .Update (podName , func (pod * v1.Pod ) {
498
495
pod .ObjectMeta .Annotations ["mysubpath" ] = "mynewpath"
499
496
})
@@ -609,17 +606,15 @@ var _ = framework.KubeDescribe("Variable Expansion", func() {
609
606
610
607
// Start pod
611
608
By (fmt .Sprintf ("Creating pod %s" , pod .Name ))
612
- pod , err := f .ClientSet .CoreV1 ().Pods (f .Namespace .Name ).Create (pod )
613
- Expect (err ).ToNot (HaveOccurred (), "while creating pod" )
609
+ var podClient * framework.PodClient
610
+ podClient = f .PodClient ()
611
+ pod = podClient .Create (pod )
614
612
defer func () {
615
613
framework .DeletePodWithWait (f , f .ClientSet , pod )
616
614
}()
617
- err = framework .WaitForPodRunningInNamespace (f .ClientSet , pod )
615
+ err : = framework .WaitForPodRunningInNamespace (f .ClientSet , pod )
618
616
Expect (err ).ToNot (HaveOccurred (), "while waiting for pod to be running" )
619
617
620
- var podClient * framework.PodClient
621
- podClient = f .PodClient ()
622
-
623
618
By ("updating the pod" )
624
619
podClient .Update (podName , func (pod * v1.Pod ) {
625
620
pod .ObjectMeta .Annotations = map [string ]string {"mysubpath" : "newsubpath" }
@@ -645,14 +640,15 @@ var _ = framework.KubeDescribe("Variable Expansion", func() {
645
640
646
641
func testPodFailSubpath (f * framework.Framework , pod * v1.Pod ) {
647
642
648
- pod , err := f .ClientSet .CoreV1 ().Pods (f .Namespace .Name ).Create (pod )
649
- Expect (err ).ToNot (HaveOccurred (), "while creating pod" )
643
+ var podClient * framework.PodClient
644
+ podClient = f .PodClient ()
645
+ pod = podClient .Create (pod )
650
646
651
647
defer func () {
652
648
framework .DeletePodWithWait (f , f .ClientSet , pod )
653
649
}()
654
650
655
- err = framework .WaitTimeoutForPodRunningInNamespace (f .ClientSet , pod .Name , pod .Namespace , framework .PodStartShortTimeout )
651
+ err : = framework .WaitTimeoutForPodRunningInNamespace (f .ClientSet , pod .Name , pod .Namespace , framework .PodStartShortTimeout )
656
652
Expect (err ).To (HaveOccurred (), "while waiting for pod to be running" )
657
653
}
658
654
0 commit comments