@@ -38,11 +38,15 @@ import (
38
38
imageutils "k8s.io/kubernetes/test/utils/image"
39
39
40
40
"github.com/onsi/ginkgo"
41
+
41
42
// ensure libs have a chance to initialize
42
43
_ "github.com/stretchr/testify/assert"
43
44
)
44
45
45
- const maxNumberOfPods int64 = 10
46
+ const (
47
+ maxNumberOfPods int64 = 10
48
+ defaultTimeout = 3 * time .Minute
49
+ )
46
50
47
51
var localStorageVersion = utilversion .MustParseSemantic ("v1.8.0-beta.0" )
48
52
@@ -807,6 +811,27 @@ func CreateHostPortPods(f *framework.Framework, id string, replicas int, expectR
807
811
}
808
812
}
809
813
814
+ // CreateNodeSelectorPods creates RC with host port 4321 and defines node selector
815
+ func CreateNodeSelectorPods (f * framework.Framework , id string , replicas int , nodeSelector map [string ]string , expectRunning bool ) error {
816
+ ginkgo .By (fmt .Sprintf ("Running RC which reserves host port and defines node selector" ))
817
+
818
+ config := & testutils.RCConfig {
819
+ Client : f .ClientSet ,
820
+ Name : id ,
821
+ Namespace : f .Namespace .Name ,
822
+ Timeout : defaultTimeout ,
823
+ Image : imageutils .GetPauseImageName (),
824
+ Replicas : replicas ,
825
+ HostPorts : map [string ]int {"port1" : 4321 },
826
+ NodeSelector : nodeSelector ,
827
+ }
828
+ err := framework .RunRC (* config )
829
+ if expectRunning {
830
+ return err
831
+ }
832
+ return nil
833
+ }
834
+
810
835
// create pod which using hostport on the specified node according to the nodeSelector
811
836
func createHostPortPodOnNode (f * framework.Framework , podName , ns , hostIP string , port int32 , protocol v1.Protocol , nodeSelector map [string ]string , expectScheduled bool ) {
812
837
hostIP = framework .TranslateIPv4ToIPv6 (hostIP )
0 commit comments