Skip to content

Commit e5d212a

Browse files
committed
e2e: migrate DCs to Deployments
1 parent bbe6ad9 commit e5d212a

File tree

11 files changed

+128
-137
lines changed

11 files changed

+128
-137
lines changed

test/extended/idling/idling.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ var _ = g.Describe("[sig-network-edge][Feature:Idling]", func() {
237237
})
238238
})
239239

240-
g.Describe("Unidling [apigroup:apps.openshift.io][apigroup:route.openshift.io]", func() {
240+
g.Describe("Unidling [apigroup:route.openshift.io]", func() {
241241
g.BeforeEach(func() {
242242
fixture = echoServerFixture
243243
})

test/extended/image_ecosystem/s2i_perl.go

Lines changed: 37 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,12 @@ func archHasModPerl(oc *exutil.CLI) bool {
3939
var _ = g.Describe("[sig-devex][Feature:ImageEcosystem][perl][Slow] hot deploy for openshift perl image", func() {
4040
defer g.GinkgoRecover()
4141
var (
42-
appSource = exutil.FixturePath("testdata", "image_ecosystem", "perl-hotdeploy")
43-
perlTemplate = exutil.FixturePath("testdata", "image_ecosystem", "perl-hotdeploy", "perl.json")
44-
oc = exutil.NewCLI("s2i-perl")
45-
modifyCommand = []string{"sed", "-ie", `s/initial value/modified value/`, "lib/My/Test.pm"}
46-
dcName = "perl"
47-
rcNameOne = fmt.Sprintf("%s-1", dcName)
48-
rcNameTwo = fmt.Sprintf("%s-2", dcName)
49-
dcLabelOne = exutil.ParseLabelsOrDie(fmt.Sprintf("deployment=%s", rcNameOne))
50-
dcLabelTwo = exutil.ParseLabelsOrDie(fmt.Sprintf("deployment=%s", rcNameTwo))
42+
appSource = exutil.FixturePath("testdata", "image_ecosystem", "perl-hotdeploy")
43+
perlTemplate = exutil.FixturePath("testdata", "image_ecosystem", "perl-hotdeploy", "perl.json")
44+
oc = exutil.NewCLI("s2i-perl")
45+
modifyCommand = []string{"sed", "-ie", `s/initial value/modified value/`, "lib/My/Test.pm"}
46+
deploymentName = "perl"
47+
buildName = fmt.Sprintf("%s-1", deploymentName)
5148
)
5249

5350
g.Context("", func() {
@@ -63,7 +60,7 @@ var _ = g.Describe("[sig-devex][Feature:ImageEcosystem][perl][Slow] hot deploy f
6360
})
6461

6562
g.Describe("hot deploy test", func() {
66-
g.It("should work [apigroup:image.openshift.io][apigroup:operator.openshift.io][apigroup:config.openshift.io][apigroup:build.openshift.io][apigroup:apps.openshift.io]", func() {
63+
g.It("should work [apigroup:image.openshift.io][apigroup:operator.openshift.io][apigroup:config.openshift.io][apigroup:build.openshift.io]", func() {
6764
// This image-ecosystem test fails on ARM because it depends on behaviour specific to mod_perl,
6865
// which is only included in the RHSCL (RHEL 7) perl images which are not available on ARM.
6966
if !archHasModPerl(oc) {
@@ -79,56 +76,68 @@ var _ = g.Describe("[sig-devex][Feature:ImageEcosystem][perl][Slow] hot deploy f
7976
br.AssertSuccess()
8077

8178
g.By("waiting for build to finish")
82-
err = exutil.WaitForABuild(oc.BuildClient().BuildV1().Builds(oc.Namespace()), rcNameOne, nil, nil, nil)
79+
err = exutil.WaitForABuild(oc.BuildClient().BuildV1().Builds(oc.Namespace()), buildName, nil, nil, nil)
8380
if err != nil {
84-
exutil.DumpBuildLogs(dcName, oc)
81+
exutil.DumpBuildLogs(deploymentName, oc)
8582
}
8683
o.Expect(err).NotTo(o.HaveOccurred())
8784

88-
err = exutil.WaitForDeploymentConfig(oc.KubeClient(), oc.AppsClient().AppsV1(), oc.Namespace(), dcName, 1, true, oc)
85+
err = exutil.WaitForDeploymentReady(oc, deploymentName, oc.Namespace(), 2)
8986
o.Expect(err).NotTo(o.HaveOccurred())
9087

9188
g.By("waiting for endpoint")
92-
err = exutil.WaitForEndpoint(oc.KubeFramework().ClientSet, oc.Namespace(), dcName)
89+
err = exutil.WaitForEndpoint(oc.KubeFramework().ClientSet, oc.Namespace(), deploymentName)
9390
o.Expect(err).NotTo(o.HaveOccurred())
94-
oldEndpoint, err := oc.KubeFramework().ClientSet.CoreV1().Endpoints(oc.Namespace()).Get(context.Background(), dcName, metav1.GetOptions{})
91+
oldEndpoint, err := oc.KubeFramework().ClientSet.CoreV1().Endpoints(oc.Namespace()).Get(context.Background(), deploymentName, metav1.GetOptions{})
9592
o.Expect(err).NotTo(o.HaveOccurred())
9693

9794
checkPage := func(expected string, dcLabel labels.Selector) {
9895
_, err := exutil.WaitForPods(oc.KubeClient().CoreV1().Pods(oc.Namespace()), dcLabel, exutil.CheckPodIsRunning, 1, 4*time.Minute)
9996
o.ExpectWithOffset(1, err).NotTo(o.HaveOccurred())
100-
result, err := CheckPageContains(oc, dcName, "", expected)
97+
result, err := CheckPageContains(oc, deploymentName, "", expected)
10198
o.ExpectWithOffset(1, err).NotTo(o.HaveOccurred())
10299
o.ExpectWithOffset(1, result).To(o.BeTrue())
103100
}
104101

105-
checkPage("initial value", dcLabelOne)
102+
hash, err := exutil.GetDeploymentRSPodTemplateHash(oc, deploymentName, oc.Namespace(), 2)
103+
o.Expect(err).NotTo(o.HaveOccurred())
104+
ReplicaSetRev2Label := exutil.ParseLabelsOrDie(fmt.Sprintf("pod-template-hash=%s", hash))
105+
checkPage("initial value", ReplicaSetRev2Label)
106106

107107
g.By("modifying the source code with disabled hot deploy")
108-
err = RunInPodContainer(oc, dcLabelOne, modifyCommand)
108+
err = RunInPodContainer(oc, ReplicaSetRev2Label, modifyCommand)
109109
o.Expect(err).NotTo(o.HaveOccurred())
110-
checkPage("initial value", dcLabelOne)
110+
checkPage("initial value", ReplicaSetRev2Label)
111111

112112
g.By("turning on hot-deploy")
113-
err = oc.Run("set", "env").Args("dc", dcName, "PERL_APACHE2_RELOAD=true").Execute()
113+
err = oc.Run("set", "env").Args("deployment", deploymentName, "PERL_APACHE2_RELOAD=true").Execute()
114114
o.Expect(err).NotTo(o.HaveOccurred())
115-
err = exutil.WaitForDeploymentConfig(oc.KubeClient(), oc.AppsClient().AppsV1(), oc.Namespace(), dcName, 2, true, oc)
115+
err = exutil.WaitForDeploymentReady(oc, deploymentName, oc.Namespace(), 3)
116116
o.Expect(err).NotTo(o.HaveOccurred())
117117

118118
g.By("waiting for a new endpoint")
119-
err = exutil.WaitForEndpoint(oc.KubeFramework().ClientSet, oc.Namespace(), dcName)
119+
err = exutil.WaitForEndpoint(oc.KubeFramework().ClientSet, oc.Namespace(), deploymentName)
120+
o.Expect(err).NotTo(o.HaveOccurred())
121+
122+
hash, err = exutil.GetDeploymentRSPodTemplateHash(oc, deploymentName, oc.Namespace(), 3)
120123
o.Expect(err).NotTo(o.HaveOccurred())
124+
ReplicaSetRev3Label := exutil.ParseLabelsOrDie(fmt.Sprintf("pod-template-hash=%s", hash))
121125

122126
// Ran into an issue where we'd try to hit the endpoint before it was updated, resulting in
123127
// request timeouts against the previous pod's ip. So make sure the endpoint is pointing to the
124128
// new pod before hitting it.
129+
podList, err := exutil.GetDeploymentPods(oc, deploymentName, oc.Namespace(), fmt.Sprintf("pod-template-hash=%s", hash))
130+
o.Expect(err).NotTo(o.HaveOccurred())
131+
if len(podList.Items) != 1 {
132+
o.Expect(fmt.Errorf("Expected one RS pod for %v, got %d instead", ReplicaSetRev3Label, len(podList.Items))).NotTo(o.HaveOccurred())
133+
}
125134
err = wait.Poll(1*time.Second, 1*time.Minute, func() (bool, error) {
126-
newEndpoint, err := oc.KubeFramework().ClientSet.CoreV1().Endpoints(oc.Namespace()).Get(context.Background(), dcName, metav1.GetOptions{})
135+
newEndpoint, err := oc.KubeFramework().ClientSet.CoreV1().Endpoints(oc.Namespace()).Get(context.Background(), deploymentName, metav1.GetOptions{})
127136
if err != nil {
128137
return false, err
129138
}
130-
if !strings.Contains(newEndpoint.Subsets[0].Addresses[0].TargetRef.Name, rcNameTwo) {
131-
e2e.Logf("waiting on endpoint address ref %s to contain %s", newEndpoint.Subsets[0].Addresses[0].TargetRef.Name, rcNameTwo)
139+
if !strings.Contains(newEndpoint.Subsets[0].Addresses[0].TargetRef.Name, podList.Items[0].Name) {
140+
e2e.Logf("waiting on endpoint address ref %s to contain %s", newEndpoint.Subsets[0].Addresses[0].TargetRef.Name, podList.Items[0].Name)
132141
return false, nil
133142
}
134143
e2e.Logf("old endpoint was %#v, new endpoint is %#v", oldEndpoint, newEndpoint)
@@ -137,10 +146,10 @@ var _ = g.Describe("[sig-devex][Feature:ImageEcosystem][perl][Slow] hot deploy f
137146
o.Expect(err).NotTo(o.HaveOccurred())
138147

139148
g.By("modifying the source code with enabled hot deploy")
140-
checkPage("initial value", dcLabelTwo)
141-
err = RunInPodContainer(oc, dcLabelTwo, modifyCommand)
149+
checkPage("initial value", ReplicaSetRev3Label)
150+
err = RunInPodContainer(oc, ReplicaSetRev3Label, modifyCommand)
142151
o.Expect(err).NotTo(o.HaveOccurred())
143-
checkPage("modified value", dcLabelTwo)
152+
checkPage("modified value", ReplicaSetRev3Label)
144153
})
145154
})
146155

test/extended/scheduling/pods.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ var _ = g.Describe("[sig-scheduling][Early]", func() {
136136
})
137137
})
138138

139-
g.Describe("The openshift-apiserver pods [apigroup:apps.openshift.io][apigroup:authorization.openshift.io][apigroup:build.openshift.io][apigroup:image.openshift.io][apigroup:project.openshift.io][apigroup:quota.openshift.io][apigroup:route.openshift.io][apigroup:security.openshift.io][apigroup:template.openshift.io]", func() {
139+
g.Describe("The openshift-apiserver pods [apigroup:authorization.openshift.io][apigroup:build.openshift.io][apigroup:image.openshift.io][apigroup:project.openshift.io][apigroup:quota.openshift.io][apigroup:route.openshift.io][apigroup:security.openshift.io][apigroup:template.openshift.io]", func() {
140140
g.It("should be scheduled on different nodes", func() {
141141
requirePodsOnDifferentNodesTest{namespace: "openshift-apiserver", deployment: "apiserver"}.run(oc)
142142
})

test/extended/storage/csi_snapshot_controller_operator.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ var _ = g.Describe("[sig-storage][Feature:Cluster-CSI-Snapshot-Controller-Operat
5050

5151
g.By("# Modify the csi-snapshot-webhook-secret expiry annotation")
5252
defer func() {
53-
if exutil.WaitForDeploymentReady(oc, snapshotWebhookDeployName, clusterCSISnapshotOperatorNs) != nil {
53+
if exutil.WaitForDeploymentReady(oc, snapshotWebhookDeployName, clusterCSISnapshotOperatorNs, -1) != nil {
5454
e2e.Failf("The csiSnapshotWebhook was not recovered ready")
5555
}
5656
}()
@@ -71,7 +71,7 @@ var _ = g.Describe("[sig-storage][Feature:Cluster-CSI-Snapshot-Controller-Operat
7171

7272
g.By("# Delete the csi-snapshot-webhook-secret")
7373
defer func() {
74-
if exutil.WaitForDeploymentReady(oc, snapshotWebhookDeployName, clusterCSISnapshotOperatorNs) != nil {
74+
if exutil.WaitForDeploymentReady(oc, snapshotWebhookDeployName, clusterCSISnapshotOperatorNs, -1) != nil {
7575
e2e.Failf("The csiSnapshotWebhook was not recovered ready")
7676
}
7777
}()

test/extended/templates/templateinstance_readiness.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@ import (
99
g "github.com/onsi/ginkgo/v2"
1010
o "github.com/onsi/gomega"
1111

12+
appsv1 "k8s.io/api/apps/v1"
1213
corev1 "k8s.io/api/core/v1"
1314
v1 "k8s.io/api/core/v1"
1415
kerrors "k8s.io/apimachinery/pkg/api/errors"
1516
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1617
"k8s.io/apimachinery/pkg/util/wait"
18+
deploymentutil "k8s.io/kubernetes/pkg/controller/deployment/util"
1719
admissionapi "k8s.io/pod-security-admission/api"
1820

19-
appsv1 "github.com/openshift/api/apps/v1"
2021
buildv1 "github.com/openshift/api/build/v1"
2122
templatev1 "github.com/openshift/api/template/v1"
22-
"github.com/openshift/library-go/pkg/apps/appsutil"
2323

2424
exutil "github.com/openshift/origin/test/extended/util"
2525
)
@@ -38,7 +38,7 @@ var _ = g.Describe("[sig-devex][Feature:Templates] templateinstance readiness te
3838
waitSettle := func() (bool, error) {
3939
var err error
4040

41-
// must read the templateinstance before the build/dc
41+
// must read the templateinstance before the build/deployment
4242
templateinstance, err = cli.TemplateClient().TemplateV1().TemplateInstances(cli.Namespace()).Get(context.Background(), templateinstance.Name, metav1.GetOptions{})
4343
if err != nil {
4444
return false, err
@@ -52,7 +52,7 @@ var _ = g.Describe("[sig-devex][Feature:Templates] templateinstance readiness te
5252
return false, err
5353
}
5454

55-
dc, err := cli.AppsClient().AppsV1().DeploymentConfigs(cli.Namespace()).Get(context.Background(), "simple-example", metav1.GetOptions{})
55+
deploymentObj, err := cli.AdminKubeClient().AppsV1().Deployments(cli.Namespace()).Get(context.Background(), "simple-example", metav1.GetOptions{})
5656
if err != nil {
5757
if kerrors.IsNotFound(err) {
5858
err = nil
@@ -67,19 +67,19 @@ var _ = g.Describe("[sig-devex][Feature:Templates] templateinstance readiness te
6767

6868
case buildv1.BuildPhaseComplete:
6969
var progressing, available *appsv1.DeploymentCondition
70-
for i, condition := range dc.Status.Conditions {
70+
for i, condition := range deploymentObj.Status.Conditions {
7171
switch condition.Type {
7272
case appsv1.DeploymentProgressing:
73-
progressing = &dc.Status.Conditions[i]
73+
progressing = &deploymentObj.Status.Conditions[i]
7474

7575
case appsv1.DeploymentAvailable:
76-
available = &dc.Status.Conditions[i]
76+
available = &deploymentObj.Status.Conditions[i]
7777
}
7878
}
7979

8080
if (progressing != nil &&
8181
progressing.Status == corev1.ConditionTrue &&
82-
progressing.Reason == appsutil.NewRcAvailableReason &&
82+
progressing.Reason == deploymentutil.NewRSAvailableReason &&
8383
available != nil &&
8484
available.Status == corev1.ConditionTrue) ||
8585
(progressing != nil &&
@@ -122,7 +122,7 @@ var _ = g.Describe("[sig-devex][Feature:Templates] templateinstance readiness te
122122
}
123123
})
124124

125-
g.It("should report ready soon after all annotated objects are ready [apigroup:template.openshift.io][apigroup:build.openshift.io][apigroup:apps.openshift.io]", func() {
125+
g.It("should report ready soon after all annotated objects are ready [apigroup:template.openshift.io][apigroup:build.openshift.io]", func() {
126126
var err error
127127

128128
templateinstance = &templatev1.TemplateInstance{
@@ -171,7 +171,7 @@ var _ = g.Describe("[sig-devex][Feature:Templates] templateinstance readiness te
171171
o.Expect(err).NotTo(o.HaveOccurred())
172172
})
173173

174-
g.It("should report failed soon after an annotated objects has failed [apigroup:template.openshift.io][apigroup:build.openshift.io][apigroup:apps.openshift.io]", func() {
174+
g.It("should report failed soon after an annotated objects has failed [apigroup:template.openshift.io][apigroup:build.openshift.io]", func() {
175175
var err error
176176

177177
secret, err := cli.KubeClient().CoreV1().Secrets(cli.Namespace()).Create(context.Background(), &v1.Secret{

test/extended/testdata/bindata.go

Lines changed: 22 additions & 42 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/extended/testdata/idling-echo-server.yaml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,18 @@ apiVersion: v1
22
kind: List
33
metadata: {}
44
items:
5-
- apiVersion: apps.openshift.io/v1
6-
kind: DeploymentConfig
5+
- apiVersion: apps/v1
6+
kind: Deployment
77
metadata:
88
name: idling-echo
99
spec:
1010
replicas: 2
1111
selector:
12-
app: idling-echo
13-
deploymentconfig: idling-echo
12+
matchLabels:
13+
app: idling-echo
14+
deploymentconfig: idling-echo
1415
strategy:
15-
type: Rolling
16+
type: RollingUpdate
1617
template:
1718
metadata:
1819
labels:

0 commit comments

Comments
 (0)