Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deploy: set condition reason correctly for new RCs #11609

Merged
merged 1 commit into from
Oct 28, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/deploy/controller/deploymentconfig/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ func (c *DeploymentConfigController) Handle(config *deployapi.DeploymentConfig)
c.recorder.Eventf(config, kapi.EventTypeWarning, "DeploymentCleanupFailed", "Couldn't clean up deployments: %v", err)
}

cond := deployutil.NewDeploymentCondition(deployapi.DeploymentProgressing, kapi.ConditionTrue, deployutil.NewRcAvailableReason, msg)
cond := deployutil.NewDeploymentCondition(deployapi.DeploymentProgressing, kapi.ConditionTrue, deployutil.NewReplicationControllerReason, msg)
return c.updateStatus(config, existingDeployments, *cond)
}

Expand Down
42 changes: 42 additions & 0 deletions test/extended/deployments/deployments.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ var _ = g.Describe("deploymentconfigs", func() {
tagImagesFixture = exutil.FixturePath("testdata", "deployments", "tag-images-deployment.yaml")
readinessFixture = exutil.FixturePath("testdata", "deployments", "readiness-test.yaml")
envRefDeploymentFixture = exutil.FixturePath("testdata", "deployments", "deployment-with-ref-env.yaml")
ignoresDeployersFixture = exutil.FixturePath("testdata", "deployments", "deployment-ignores-deployer.yaml")
)

g.Describe("when run iteratively [Conformance]", func() {
Expand Down Expand Up @@ -302,6 +303,7 @@ var _ = g.Describe("deploymentconfigs", func() {
o.Expect(out).To(o.ContainSubstring("hello bar"))
})
})

g.Describe("with multiple image change triggers [Conformance]", func() {
g.AfterEach(func() {
failureTrap(oc, "example", g.CurrentGinkgoTestDescription().Failed)
Expand Down Expand Up @@ -782,4 +784,44 @@ var _ = g.Describe("deploymentconfigs", func() {
o.Expect(waitForLatestCondition(oc, name, deploymentRunTimeout, deploymentRunning)).NotTo(o.HaveOccurred())
})
})

g.Describe("ignores deployer and lets the config with a NewReplicationControllerCreated reason [Conformance]", func() {
g.AfterEach(func() {
failureTrap(oc, "database", g.CurrentGinkgoTestDescription().Failed)
})

g.It("should let the deployment config with a NewReplicationControllerCreated reason", func() {
_, name, err := createFixture(oc, ignoresDeployersFixture)
o.Expect(err).NotTo(o.HaveOccurred())

g.By("verifying that the deployment config is bumped to the first version")
err = wait.PollImmediate(500*time.Millisecond, 30*time.Second, func() (bool, error) {
dc, _, _, err := deploymentInfo(oc, name)
if err != nil {
return false, nil
}
return dc.Status.LatestVersion == 1, nil
})
if err == wait.ErrWaitTimeout {
err = fmt.Errorf("deployment config %q never incremented to the first version", name)
}
o.Expect(err).NotTo(o.HaveOccurred())

g.By("verifying that the deployment config has the desired condition and reason")
var conditions []deployapi.DeploymentCondition
err = wait.PollImmediate(500*time.Millisecond, 30*time.Second, func() (bool, error) {
dc, _, _, err := deploymentInfo(oc, name)
if err != nil {
return false, nil
}
conditions = dc.Status.Conditions
cond := deployutil.GetDeploymentCondition(dc.Status, deployapi.DeploymentProgressing)
return cond != nil && cond.Reason == deployutil.NewReplicationControllerReason, nil
})
if err == wait.ErrWaitTimeout {
err = fmt.Errorf("deployment config %q never updated its conditions: %#v", name, conditions)
}
o.Expect(err).NotTo(o.HaveOccurred())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as some point (and we are getting to that point now) we should split this file :-)

})
})
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: v1
kind: DeploymentConfig
metadata:
annotations:
deploy.openshift.io/deployer-pod.ignore: "true"
name: database
spec:
replicas: 1
selector:
name: database
template:
metadata:
labels:
name: database
spec:
terminationGracePeriodSeconds: 0
containers:
- image: "docker.io/centos:centos7"
imagePullPolicy: IfNotPresent
name: myapp
command:
- /bin/sleep
- "10000"