Retry conflict when updating RC in DC controller faster#10507
Retry conflict when updating RC in DC controller faster#10507openshift-bot merged 2 commits intoopenshift:masterfrom
Conversation
|
@Kargakis PTAL |
| var updatedDeployment *kapi.ReplicationController | ||
| if err := kclient.RetryOnConflict(wait.Backoff{Steps: 5}, func() error { | ||
| var err error | ||
| updatedDeployment, err = c.rn.ReplicationControllers(copied.Namespace).Update(copied) |
There was a problem hiding this comment.
huh? Doesn't this just ensure that you fail 5 times? If copied's resourceVersion doesn't change, you'll just conflict over and over.
There was a problem hiding this comment.
Correct - @mfojtik you need to pull and apply the annotations on top
There was a problem hiding this comment.
@deads2k will need Get() func in cache to re-get the rc
There was a problem hiding this comment.
@deads2k will need Get() func in cache to re-get the rc
Listers already have a get function.
There was a problem hiding this comment.
not RC listers...
On Thu, Aug 18, 2016 at 5:15 PM, David Eads notifications@github.com
wrote:
In pkg/deploy/controller/deploymentconfig/controller.go
#10507 (comment):@@ -118,8 +119,13 @@ func (c *DeploymentConfigController) Handle(config *deployapi.DeploymentConfig)
copied.Annotations[deployapi.DeploymentCancelledAnnotation] = deployapi.DeploymentCancelledAnnotationValue
copied.Annotations[deployapi.DeploymentStatusReasonAnnotation] = deployapi.DeploymentCancelledNewerDeploymentExists
updatedDeployment, err := c.rn.ReplicationControllers(copied.Namespace).Update(copied)if err != nil {// Retry faster on conflictsvar updatedDeployment *kapi.ReplicationControllerif err := kclient.RetryOnConflict(wait.Backoff{Steps: 5}, func() error {var err errorupdatedDeployment, err = c.rn.ReplicationControllers(copied.Namespace).Update(copied)@deads2k https://github.com/deads2k will need Get() func in cache to
re-get the rcListers already have a get function.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/openshift/origin/pull/10507/files/095b81adcf1aeb4f3f928f95f9e5fc1ebf91588f#r75327857,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AACsaONbQSMzSUok8fR-5utg6oF7wixiks5qhHb-gaJpZM4JnlAW
.
Michal Fojtik <mi@mifo.sk mfojtik@mifo.sk>
Red Hat OpenShift, Engineering
There was a problem hiding this comment.
upstream pull that adds it to all the upstream listers plz:)
On Thu, Aug 18, 2016 at 5:15 PM, Michal Fojtik notifications@github.com
wrote:
In pkg/deploy/controller/deploymentconfig/controller.go
#10507 (comment):@@ -118,8 +119,13 @@ func (c *DeploymentConfigController) Handle(config *deployapi.DeploymentConfig)
copied.Annotations[deployapi.DeploymentCancelledAnnotation] = deployapi.DeploymentCancelledAnnotationValue
copied.Annotations[deployapi.DeploymentStatusReasonAnnotation] = deployapi.DeploymentCancelledNewerDeploymentExists
updatedDeployment, err := c.rn.ReplicationControllers(copied.Namespace).Update(copied)if err != nil {// Retry faster on conflictsvar updatedDeployment *kapi.ReplicationControllerif err := kclient.RetryOnConflict(wait.Backoff{Steps: 5}, func() error {var err errorupdatedDeployment, err = c.rn.ReplicationControllers(copied.Namespace).Update(copied)not RC listers...
… <#m_-8974691536388745868_>
On Thu, Aug 18, 2016 at 5:15 PM, David Eads _@_.***> wrote: In
pkg/deploy/controller/deploymentconfig/controller.go <#10507 (comment)
https://github.com/openshift/origin/pull/10507#discussion_r75327857>: >
@@ -118,8 +119,13 @@ func (c *DeploymentConfigController) Handle(config
*deployapi.DeploymentConfig) > copied.Annotations[deployapi.DeploymentCancelledAnnotation]
= deployapi.DeploymentCancelledAnnotationValue >
copied.Annotations[deployapi.DeploymentStatusReasonAnnotation] =
deployapi.DeploymentCancelledNewerDeploymentExists > > -
updatedDeployment, err := c.rn.ReplicationControllers(
copied.Namespace).Update(copied) > - if err != nil { > + // Retry faster
on conflicts > + var updatedDeployment *kapi.ReplicationController > + if
err := kclient.RetryOnConflict(wait.Backoff{Steps: 5}, func() error { > +
var err error > + updatedDeployment, err = c.rn.ReplicationControllers(
copied.Namespace).Update(copied) @deads2k https://github.com/deads2k <
https://github.com/deads2k> will need Get() func in cache to re-get the
rc Listers already have a get function. — You are receiving this because
you were mentioned. Reply to this email directly, view it on GitHub <
https://github.com/openshift/origin/pull/10507/files/
095b81a#r75327857>, or mute the thread <
https://github.com/notifications/unsubscribe-auth/AACsaONbQSMzSUok8fR-
5utg6oF7wixiks5qhHb-gaJpZM4JnlAW> .
-- ----------------------------------------------- Michal Fojtik <
mi@mifo.sk mfojtik@mifo.sk> Red Hat OpenShift, Engineering—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/openshift/origin/pull/10507/files/095b81adcf1aeb4f3f928f95f9e5fc1ebf91588f#r75328007,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ADuFf2kSJbvmQmB94THvfmDwvUjb2l4eks5qhHcngaJpZM4JnlAW
.
There was a problem hiding this comment.
not RC listers...
Figures. Let's do it with an upstream patch. We'll want it upstream too.
095b81a to
7694172
Compare
|
@Kargakis re-check before I go add Get() upstream |
It's fine but while you are here, add it in all the listers. |
7694172 to
2d36b20
Compare
|
[test] @Kargakis upstream PR opened. I added Get() into all listers that have namespace which are only three atm. |
|
Fine with me for now On Thu, Aug 18, 2016 at 6:22 PM, Michal Fojtik notifications@github.com
|
|
what is the upstream PR? |
|
@Kargakis that failure is interesting :-/ |
d63d688 to
7dceeed
Compare
|
[test] Michal Fojtik On 18 August 2016 at 22:13:23, OpenShift Bot (notifications@github.com)
|
| // replace the current deployment with the updated copy so that a future update has a chance at working | ||
| existingDeployments[i] = *updatedDeployment | ||
| c.recorder.Eventf(config, kapi.EventTypeNormal, "DeploymentCancelled", "Cancelled deployment %q superceded by version %d", deployment.Name, config.Status.LatestVersion) | ||
| if updatedDeployment != nil { |
There was a problem hiding this comment.
Is there any case this will be nil?
There was a problem hiding this comment.
yes, RC was deleted between retry.
Welcome into the world of updating deployment controller tests |
| if err != nil { | ||
| return err | ||
| } | ||
| if kapierrors.IsNotFound(err) { |
There was a problem hiding this comment.
you missed this! :-) this should upper.
e2df1a2 to
8ad6eef
Compare
|
@Kargakis we are green! I will squash this for merge if you're ready. |
| delete(deployment.Annotations, deployapi.DesiredReplicasAnnotation) | ||
| } | ||
| deployment.Spec.Replicas = d.replicas | ||
| deployment.Namespace = "test" |
There was a problem hiding this comment.
No need for this since you have it in the util
127f61a to
9f26be4
Compare
|
@Kargakis sneaked one more commit here which should fix the ugly event in web console and in the describe output: 1h 1h 1 {deploymentconfig-controller } Warning DeploymentScaleFailed Failed to scale deployment "ruby-ex-4" from 0 to 0: Operation cannot be fulfilled on replicationcontrollers "ruby-ex-4": the object has been modified; please apply your changes to the latest version and try againWe fast-retry on conflict using the shared cache so we can also scale faster. |
|
[test] |
|
@Kargakis ptal, we are green Michal Fojtik On 23 August 2016 at 21:03:10, OpenShift Bot (notifications@github.com)
|
| if err != nil { | ||
| // Retry faster on conflicts | ||
| var updatedDeployment *kapi.ReplicationController | ||
| if err := kclient.RetryOnConflict(wait.Backoff{Steps: 5}, func() error { |
|
Two more comments, LGTM otherwise |
caa5780 to
f550e74
Compare
|
@Kargakis fixed, thanks! [merge] |
|
Evaluated for origin test up to f550e74 |
|
continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/8388/) (Image: devenv-rhel7_4917) |
|
Evaluated for origin merge up to f550e74 |
|
continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/8387/) |
No description provided.