@@ -63,6 +63,31 @@ var _ = SIGDescribe("CloneSet", func() {
63
63
randStr = rand .String (10 )
64
64
})
65
65
66
+ framework .KruiseDescribe ("CloneSet Creating" , func () {
67
+
68
+ framework .ConformanceIt ("creates with hostNetwork pod, specified containerPort without specifying hostPort" , func () {
69
+ cs := tester .NewCloneSet ("hostnetwork-port-" + randStr , 1 , appsv1alpha1.CloneSetUpdateStrategy {})
70
+ cs .Spec .Template .Spec .HostNetwork = true
71
+ cs .Spec .Template .Spec .Containers [0 ].Ports = []v1.ContainerPort {{ContainerPort : 80 }}
72
+ cs , err := tester .CreateCloneSet (cs )
73
+ gomega .Expect (err ).NotTo (gomega .HaveOccurred (), "creation should be success" )
74
+
75
+ gomega .Eventually (func () int32 {
76
+ cs , err = tester .GetCloneSet (cs .Name )
77
+ gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
78
+ return cs .Status .ReadyReplicas
79
+ }, 120 * time .Second , 3 * time .Second ).Should (gomega .Equal (int32 (1 )))
80
+
81
+ pods , err := tester .ListPodsForCloneSet (cs .Name )
82
+ gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
83
+ for _ , pod := range pods {
84
+ ginkgo .By ("hostPort should defaults to containerPort" )
85
+ gomega .Expect (pod .Spec .Containers [0 ].Ports [0 ].HostPort ).To (gomega .Equal (pod .Spec .Containers [0 ].Ports [0 ].ContainerPort ))
86
+ }
87
+ })
88
+
89
+ })
90
+
66
91
framework .KruiseDescribe ("CloneSet Scaling" , func () {
67
92
var err error
68
93
0 commit comments