@@ -29,6 +29,7 @@ import (
29
29
"sync"
30
30
"time"
31
31
32
+ appsv1 "k8s.io/api/apps/v1"
32
33
v1 "k8s.io/api/core/v1"
33
34
apierrors "k8s.io/apimachinery/pkg/api/errors"
34
35
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -38,11 +39,10 @@ import (
38
39
clientset "k8s.io/client-go/kubernetes"
39
40
"k8s.io/client-go/transport"
40
41
"k8s.io/kubernetes/test/e2e/framework"
42
+ e2edeployment "k8s.io/kubernetes/test/e2e/framework/deployment"
41
43
e2enode "k8s.io/kubernetes/test/e2e/framework/node"
42
44
e2epod "k8s.io/kubernetes/test/e2e/framework/pod"
43
- e2erc "k8s.io/kubernetes/test/e2e/framework/rc"
44
45
"k8s.io/kubernetes/test/e2e/network/common"
45
- testutils "k8s.io/kubernetes/test/utils"
46
46
imageutils "k8s.io/kubernetes/test/utils/image"
47
47
admissionapi "k8s.io/pod-security-admission/api"
48
48
@@ -133,52 +133,95 @@ var _ = common.SIGDescribe("Proxy", func() {
133
133
}, metav1.CreateOptions {})
134
134
framework .ExpectNoError (err )
135
135
136
- // Make an RC with a single pod. The 'porter' image is
136
+ // Make a deployment with a single pod. The 'porter' image is
137
137
// a simple server which serves the values of the
138
138
// environmental variables below.
139
139
ginkgo .By ("starting an echo server on multiple ports" )
140
- pods := []* v1.Pod {}
141
- cfg := testutils.RCConfig {
142
- Client : f .ClientSet ,
143
- Image : imageutils .GetE2EImage (imageutils .Agnhost ),
144
- Command : []string {"/agnhost" , "porter" },
145
- Name : service .Name ,
146
- Namespace : f .Namespace .Name ,
147
- Replicas : 1 ,
148
- PollInterval : time .Second ,
149
- Env : map [string ]string {
150
- "SERVE_PORT_80" : `<a href="/rewriteme">test</a>` ,
151
- "SERVE_PORT_1080" : `<a href="/rewriteme">test</a>` ,
152
- "SERVE_PORT_160" : "foo" ,
153
- "SERVE_PORT_162" : "bar" ,
154
-
155
- "SERVE_TLS_PORT_443" : `<a href="/tlsrewriteme">test</a>` ,
156
- "SERVE_TLS_PORT_460" : `tls baz` ,
157
- "SERVE_TLS_PORT_462" : `tls qux` ,
158
- },
159
- Ports : map [string ]int {
160
- "dest1" : 160 ,
161
- "dest2" : 162 ,
162
140
163
- "tlsdest1" : 460 ,
164
- "tlsdest2" : 462 ,
141
+ deploymentConfig := e2edeployment .NewDeployment (service .Name ,
142
+ 1 ,
143
+ labels ,
144
+ service .Name ,
145
+ imageutils .GetE2EImage (imageutils .Agnhost ),
146
+ appsv1 .RecreateDeploymentStrategyType )
147
+ deploymentConfig .Spec .Template .Spec .Containers [0 ].Command = []string {"/agnhost" , "porter" }
148
+ deploymentConfig .Spec .Template .Spec .Containers [0 ].Env = []v1.EnvVar {
149
+ {
150
+ Name : "SERVE_PORT_80" ,
151
+ Value : `<a href="/rewriteme">test</a>` ,
165
152
},
166
- ReadinessProbe : & v1.Probe {
167
- ProbeHandler : v1.ProbeHandler {
168
- HTTPGet : & v1.HTTPGetAction {
169
- Port : intstr .FromInt32 (80 ),
170
- },
153
+ {
154
+ Name : "SERVE_PORT_1080" ,
155
+ Value : `<a href="/rewriteme">test</a>` ,
156
+ },
157
+ {
158
+ Name : "SERVE_PORT_160" ,
159
+ Value : "foo" ,
160
+ },
161
+ {
162
+ Name : "SERVE_PORT_162" ,
163
+ Value : "bar" ,
164
+ },
165
+ {
166
+ Name : "SERVE_TLS_PORT_443" ,
167
+ Value : `<a href="/tlsrewriteme">test</a>` ,
168
+ },
169
+ {
170
+ Name : "SERVE_TLS_PORT_460" ,
171
+ Value : "tls baz" ,
172
+ },
173
+ {
174
+ Name : "SERVE_TLS_PORT_462" ,
175
+ Value : "tls qux" ,
176
+ },
177
+ }
178
+ deploymentConfig .Spec .Template .Spec .Containers [0 ].Ports = []v1.ContainerPort {
179
+ {
180
+ ContainerPort : 80 ,
181
+ },
182
+ {
183
+ Name : "dest1" ,
184
+ ContainerPort : 160 ,
185
+ },
186
+ {
187
+ Name : "dest2" ,
188
+ ContainerPort : 162 ,
189
+ },
190
+ {
191
+ Name : "tlsdest1" ,
192
+ ContainerPort : 460 ,
193
+ },
194
+ {
195
+ Name : "tlsdest2" ,
196
+ ContainerPort : 462 ,
197
+ },
198
+ }
199
+ deploymentConfig .Spec .Template .Spec .Containers [0 ].ReadinessProbe = & v1.Probe {
200
+ ProbeHandler : v1.ProbeHandler {
201
+ HTTPGet : & v1.HTTPGetAction {
202
+ Port : intstr .FromInt32 (80 ),
171
203
},
172
- InitialDelaySeconds : 1 ,
173
- TimeoutSeconds : 5 ,
174
- PeriodSeconds : 10 ,
175
204
},
176
- Labels : labels ,
177
- CreatedPods : & pods ,
205
+ InitialDelaySeconds : 1 ,
206
+ TimeoutSeconds : 5 ,
207
+ PeriodSeconds : 10 ,
178
208
}
179
- err = e2erc .RunRC (ctx , cfg )
209
+
210
+ deployment , err := f .ClientSet .AppsV1 ().Deployments (f .Namespace .Name ).Create (ctx ,
211
+ deploymentConfig ,
212
+ metav1.CreateOptions {})
213
+ framework .ExpectNoError (err )
214
+
215
+ ginkgo .DeferCleanup (func (ctx context.Context , name string ) error {
216
+ return f .ClientSet .AppsV1 ().Deployments (f .Namespace .Name ).Delete (ctx , name , metav1.DeleteOptions {})
217
+ }, deployment .Name )
218
+
219
+ err = e2edeployment .WaitForDeploymentComplete (f .ClientSet , deployment )
220
+ framework .ExpectNoError (err )
221
+
222
+ podList , err := e2edeployment .GetPodsForDeployment (ctx , f .ClientSet , deployment )
180
223
framework .ExpectNoError (err )
181
- ginkgo . DeferCleanup ( e2erc . DeleteRCAndWaitForGC , f . ClientSet , f . Namespace . Name , cfg . Name )
224
+ pods := podList . Items
182
225
183
226
err = waitForEndpoint (ctx , f .ClientSet , f .Namespace .Name , service .Name )
184
227
framework .ExpectNoError (err )
0 commit comments