Skip to content

Commit 5693bd4

Browse files
Merge pull request #28957 from ingvagabund/dc-to-deployments
WRKLDS-1431: e2e: migrate DCs to Deployments
2 parents fd6fe36 + c7d34f8 commit 5693bd4

28 files changed

+1231
-673
lines changed

examples/sample-app/application-template-stibuild.json

+14-119
Original file line numberDiff line numberDiff line change
@@ -164,75 +164,24 @@
164164
}
165165
},
166166
{
167-
"kind": "DeploymentConfig",
168-
"apiVersion": "apps.openshift.io/v1",
167+
"kind": "Deployment",
168+
"apiVersion": "apps/v1",
169169
"metadata": {
170170
"name": "frontend",
171171
"annotations": {
172-
"template.alpha.openshift.io/wait-for-ready": "true"
172+
"template.alpha.openshift.io/wait-for-ready": "true",
173+
"image.openshift.io/triggers": "[{\"from\":{\"kind\":\"ImageStreamTag\",\"name\":\"origin-ruby-sample:latest\"},\"fieldPath\": \"spec.template.spec.containers[0].image\"}]"
173174
}
174175
},
175176
"spec": {
176177
"strategy": {
177-
"type": "Rolling",
178-
"rollingParams": {
179-
"updatePeriodSeconds": 1,
180-
"intervalSeconds": 1,
181-
"timeoutSeconds": 120,
182-
"pre": {
183-
"failurePolicy": "Abort",
184-
"execNewPod": {
185-
"command": [
186-
"/bin/true"
187-
],
188-
"env": [
189-
{
190-
"name": "CUSTOM_VAR1",
191-
"value": "custom_value1"
192-
}
193-
],
194-
"containerName": "ruby-helloworld"
195-
}
196-
},
197-
"post": {
198-
"failurePolicy": "Ignore",
199-
"execNewPod": {
200-
"command": [
201-
"/bin/true"
202-
],
203-
"env": [
204-
{
205-
"name": "CUSTOM_VAR2",
206-
"value": "custom_value2"
207-
}
208-
],
209-
"containerName": "ruby-helloworld"
210-
}
211-
}
212-
},
213-
"resources": {}
178+
"type": "RollingUpdate"
214179
},
215-
"triggers": [
216-
{
217-
"type": "ImageChange",
218-
"imageChangeParams": {
219-
"automatic": true,
220-
"containerNames": [
221-
"ruby-helloworld"
222-
],
223-
"from": {
224-
"kind": "ImageStreamTag",
225-
"name": "origin-ruby-sample:latest"
226-
}
227-
}
228-
},
229-
{
230-
"type": "ConfigChange"
231-
}
232-
],
233180
"replicas": 2,
234181
"selector": {
235-
"name": "frontend"
182+
"matchLabels": {
183+
"name": "frontend"
184+
}
236185
},
237186
"template": {
238187
"metadata": {
@@ -317,8 +266,8 @@
317266
}
318267
},
319268
{
320-
"kind": "DeploymentConfig",
321-
"apiVersion": "apps.openshift.io/v1",
269+
"kind": "Deployment",
270+
"apiVersion": "apps/v1",
322271
"metadata": {
323272
"name": "database",
324273
"annotations": {
@@ -327,67 +276,13 @@
327276
},
328277
"spec": {
329278
"strategy": {
330-
"type": "Recreate",
331-
"recreateParams": {
332-
"pre": {
333-
"failurePolicy": "Abort",
334-
"execNewPod": {
335-
"command": [
336-
"/bin/true"
337-
],
338-
"env": [
339-
{
340-
"name": "CUSTOM_VAR1",
341-
"value": "custom_value1"
342-
}
343-
],
344-
"containerName": "ruby-helloworld-database",
345-
"volumes": ["ruby-helloworld-data"]
346-
}
347-
},
348-
"mid": {
349-
"failurePolicy": "Abort",
350-
"execNewPod": {
351-
"command": [
352-
"/bin/true"
353-
],
354-
"env": [
355-
{
356-
"name": "CUSTOM_VAR2",
357-
"value": "custom_value2"
358-
}
359-
],
360-
"containerName": "ruby-helloworld-database",
361-
"volumes": ["ruby-helloworld-data"]
362-
}
363-
},
364-
"post": {
365-
"failurePolicy": "Ignore",
366-
"execNewPod": {
367-
"command": [
368-
"/bin/true"
369-
],
370-
"env": [
371-
{
372-
"name": "CUSTOM_VAR2",
373-
"value": "custom_value2"
374-
}
375-
],
376-
"containerName": "ruby-helloworld-database",
377-
"volumes": ["ruby-helloworld-data"]
378-
}
379-
}
380-
},
381-
"resources": {}
279+
"type": "Recreate"
382280
},
383-
"triggers": [
384-
{
385-
"type": "ConfigChange"
386-
}
387-
],
388281
"replicas": 1,
389282
"selector": {
390-
"name": "database"
283+
"matchLabels": {
284+
"name": "database"
285+
}
391286
},
392287
"template": {
393288
"metadata": {

test/extended/builds/volumes.go

+28-24
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,27 @@ package builds
22

33
import (
44
"path/filepath"
5-
"time"
65

76
g "github.com/onsi/ginkgo/v2"
87
o "github.com/onsi/gomega"
98

109
admissionapi "k8s.io/pod-security-admission/api"
1110

12-
deploymentutil "github.com/openshift/origin/test/extended/deployments"
1311
exutil "github.com/openshift/origin/test/extended/util"
1412
)
1513

1614
var _ = g.Describe("[sig-builds][Feature:Builds][volumes] build volumes", func() {
1715
var (
18-
oc = exutil.NewCLIWithPodSecurityLevel("build-volumes", admissionapi.LevelBaseline)
19-
baseDir = exutil.FixturePath("testdata", "builds", "volumes")
20-
secret = filepath.Join(baseDir, "secret.yaml")
21-
configmap = filepath.Join(baseDir, "configmap.yaml")
22-
s2iImageStream = filepath.Join(baseDir, "s2i-imagestream.yaml")
23-
s2iBuildConfig = filepath.Join(baseDir, "s2i-buildconfig.yaml")
24-
s2iDeploymentConfig = filepath.Join(baseDir, "s2i-deploymentconfig.yaml")
25-
dockerImageStream = filepath.Join(baseDir, "docker-imagestream.yaml")
26-
dockerBuildConfig = filepath.Join(baseDir, "docker-buildconfig.yaml")
27-
dockerDeploymentConfig = filepath.Join(baseDir, "docker-deploymentconfig.yaml")
16+
oc = exutil.NewCLIWithPodSecurityLevel("build-volumes", admissionapi.LevelBaseline)
17+
baseDir = exutil.FixturePath("testdata", "builds", "volumes")
18+
secret = filepath.Join(baseDir, "secret.yaml")
19+
configmap = filepath.Join(baseDir, "configmap.yaml")
20+
s2iImageStream = filepath.Join(baseDir, "s2i-imagestream.yaml")
21+
s2iBuildConfig = filepath.Join(baseDir, "s2i-buildconfig.yaml")
22+
s2iDeployment = filepath.Join(baseDir, "s2i-deployment.yaml")
23+
dockerImageStream = filepath.Join(baseDir, "docker-imagestream.yaml")
24+
dockerBuildConfig = filepath.Join(baseDir, "docker-buildconfig.yaml")
25+
dockerDeployment = filepath.Join(baseDir, "docker-deployment.yaml")
2826
)
2927

3028
g.Context("", func() {
@@ -51,7 +49,7 @@ var _ = g.Describe("[sig-builds][Feature:Builds][volumes] build volumes", func()
5149
}
5250
})
5351

54-
g.It("should mount given secrets and configmaps into the build pod for source strategy builds [apigroup:image.openshift.io][apigroup:build.openshift.io][apigroup:apps.openshift.io]", func() {
52+
g.It("should mount given secrets and configmaps into the build pod for source strategy builds [apigroup:image.openshift.io][apigroup:build.openshift.io]", func() {
5553
g.By("creating an imagestream")
5654
err := oc.Run("create").Args("-f", s2iImageStream).Execute()
5755
o.Expect(err).NotTo(o.HaveOccurred())
@@ -70,26 +68,29 @@ var _ = g.Describe("[sig-builds][Feature:Builds][volumes] build volumes", func()
7068
o.Expect(buildPodLogs).To(o.ContainSubstring("my-secret-value"))
7169
o.Expect(buildPodLogs).To(o.ContainSubstring("my-configmap-value"))
7270

73-
g.By("creating a deployment config")
74-
err = oc.Run("create").Args("-f", s2iDeploymentConfig).Execute()
71+
g.By("creating a deployment")
72+
err = oc.Run("create").Args("-f", s2iDeployment).Execute()
73+
o.Expect(err).NotTo(o.HaveOccurred())
74+
75+
projectName, err := oc.Run("project").Args("-q").Output()
7576
o.Expect(err).NotTo(o.HaveOccurred())
7677

7778
g.By("waiting for the deployment to complete")
78-
_, err = deploymentutil.WaitForDeployerToComplete(oc, "mys2itest-1", 5*time.Minute)
79+
err = exutil.WaitForDeploymentReady(oc, "mys2itest", projectName, -1)
7980
o.Expect(err).NotTo(o.HaveOccurred())
8081

8182
g.By("ensuring that the secret does not exist in the build image")
82-
out, err := oc.Run("rsh").Args("dc/mys2itest", "cat", "/var/run/secrets/some-secret/key").Output()
83+
out, err := oc.Run("rsh").Args("deployment/mys2itest", "cat", "/var/run/secrets/some-secret/key").Output()
8384
o.Expect(err).To(o.HaveOccurred())
8485
o.Expect(out).To(o.ContainSubstring("cat: /var/run/secrets/some-secret/key: No such file or directory"))
8586

8687
g.By("ensuring that the configmap does not exist in the build image")
87-
out, err = oc.Run("rsh").Args("dc/mys2itest", "cat", "/var/run/configmaps/some-configmap/key").Output()
88+
out, err = oc.Run("rsh").Args("deployment/mys2itest", "cat", "/var/run/configmaps/some-configmap/key").Output()
8889
o.Expect(err).To(o.HaveOccurred())
8990
o.Expect(out).To(o.ContainSubstring("cat: /var/run/configmaps/some-configmap/key: No such file or directory"))
9091
})
9192

92-
g.It("should mount given secrets and configmaps into the build pod for docker strategy builds [apigroup:image.openshift.io][apigroup:build.openshift.io][apigroup:apps.openshift.io]", func() {
93+
g.It("should mount given secrets and configmaps into the build pod for docker strategy builds [apigroup:image.openshift.io][apigroup:build.openshift.io]", func() {
9394
g.By("creating an imagestream")
9495
err := oc.Run("create").Args("-f", dockerImageStream).Execute()
9596
o.Expect(err).NotTo(o.HaveOccurred())
@@ -108,21 +109,24 @@ var _ = g.Describe("[sig-builds][Feature:Builds][volumes] build volumes", func()
108109
o.Expect(buildPodLogs).To(o.ContainSubstring("my-secret-value"))
109110
o.Expect(buildPodLogs).To(o.ContainSubstring("my-configmap-value"))
110111

111-
g.By("creating a deployment config")
112-
err = oc.Run("create").Args("-f", dockerDeploymentConfig).Execute()
112+
g.By("creating a deployment")
113+
err = oc.Run("create").Args("-f", dockerDeployment).Execute()
114+
o.Expect(err).NotTo(o.HaveOccurred())
115+
116+
projectName, err := oc.Run("project").Args("-q").Output()
113117
o.Expect(err).NotTo(o.HaveOccurred())
114118

115119
g.By("waiting for the deployment to complete")
116-
_, err = deploymentutil.WaitForDeployerToComplete(oc, "mydockertest-1", 5*time.Minute)
120+
err = exutil.WaitForDeploymentReady(oc, "mydockertest", projectName, -1)
117121
o.Expect(err).NotTo(o.HaveOccurred())
118122

119123
g.By("ensuring that the secret does not exist in the build image")
120-
out, err := oc.Run("rsh").Args("dc/mydockertest", "cat", "/var/run/secrets/some-secret/key").Output()
124+
out, err := oc.Run("rsh").Args("deployment/mydockertest", "cat", "/var/run/secrets/some-secret/key").Output()
121125
o.Expect(err).To(o.HaveOccurred())
122126
o.Expect(out).To(o.ContainSubstring("cat: /var/run/secrets/some-secret/key: No such file or directory"))
123127

124128
g.By("ensuring that the configmap does not exist in the build image")
125-
out, err = oc.Run("rsh").Args("dc/mydockertest", "cat", "/var/run/configmaps/some-configmap/key").Output()
129+
out, err = oc.Run("rsh").Args("deployment/mydockertest", "cat", "/var/run/configmaps/some-configmap/key").Output()
126130
o.Expect(err).To(o.HaveOccurred())
127131
o.Expect(out).To(o.ContainSubstring("cat: /var/run/configmaps/some-configmap/key: No such file or directory"))
128132
})

test/extended/cli/admin.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ var _ = g.Describe("[sig-cli] oc adm", func() {
443443
o.Expect(out).To(o.ContainSubstring("createuser2"))
444444
})
445445

446-
g.It("build-chain [apigroup:build.openshift.io][apigroup:image.openshift.io][apigroup:project.openshift.io][apigroup:apps.openshift.io]", func() {
446+
g.It("build-chain [apigroup:build.openshift.io][apigroup:image.openshift.io][apigroup:project.openshift.io]", func() {
447447
// Test building a dependency tree
448448
s2iBuildPath := exutil.FixturePath("..", "..", "examples", "sample-app", "application-template-stibuild.json")
449449
out, _, err := ocns.Run("process").Args("-f", s2iBuildPath, "-l", "build=sti").Outputs()

test/extended/cli/builds.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ var _ = g.Describe("[sig-cli] oc builds", func() {
226226
o.Expect(err).NotTo(o.HaveOccurred())
227227
})
228228

229-
g.It("webhooks CRUD [apigroup:build.openshift.io][apigroup:apps.openshift.io]", func() {
229+
g.It("webhooks CRUD [apigroup:build.openshift.io]", func() {
230230
g.By("check bc webhooks")
231231
out, err := oc.Run("describe").Args("buildConfigs", "ruby-sample-build").Output()
232232
o.Expect(err).NotTo(o.HaveOccurred())
@@ -284,7 +284,7 @@ var _ = g.Describe("[sig-cli] oc builds", func() {
284284
))
285285
})
286286

287-
g.It("start-build [apigroup:build.openshift.io][apigroup:apps.openshift.io]", func() {
287+
g.It("start-build [apigroup:build.openshift.io]", func() {
288288
g.By("valid build")
289289
out, err := oc.Run("start-build").Args("--from-webhook", getTriggerURL("secret101", "generic")).Output()
290290
o.Expect(err).NotTo(o.HaveOccurred())

0 commit comments

Comments
 (0)