-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Pause the deployment config before deleting #9893
Conversation
|
||
type updateDeploymentConfigFunc func(d *deployapi.DeploymentConfig) | ||
|
||
func (reaper *DeploymentConfigReaper) updateDeploymentWithRetries(namespace, name string, applyUpdate updateDeploymentFunc) (deployment *deployapi.DeploymentConfig, err error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the named returns
8475a9c
to
087d85a
Compare
@Kargakis thanks! all fixed. |
[test] |
Actually can you also update the extended test for the reaper to run in the conformance suite (if it's not already updated) ? |
@Kargakis will do |
8d8d381
to
14cc49a
Compare
@@ -39,8 +66,8 @@ func (reaper *DeploymentConfigReaper) Stop(namespace, name string, timeout time. | |||
// effect which can cause the deployment to be re-triggered upon the | |||
// config's deletion. See https://github.com/openshift/origin/issues/2721 | |||
// for more details. | |||
err := reaper.oc.DeploymentConfigs(namespace).Delete(name) | |||
configNotFound := kerrors.IsNotFound(err) | |||
err = reaper.oc.DeploymentConfigs(namespace).Delete(name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The deletion of the dc needs to move in the end
|
3dedeef
to
53cb77d
Compare
@@ -26,26 +29,44 @@ type DeploymentConfigReaper struct { | |||
pollInterval, timeout time.Duration | |||
} | |||
|
|||
// pause marks the deployment configuration as paused to avoid triggering new | |||
// deployments. | |||
func (reaper *DeploymentConfigReaper) pause(namespace, name string) (*deployapi.DeploymentConfig, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Kargakis I would love to have Pause()
func in deployment utils ;-)
53cb77d
to
4203345
Compare
// Apply the update, then attempt to push it to the apiserver. | ||
applyUpdate(config) | ||
config, err = deploymentConfigs.Update(config) | ||
if err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should retry only on update conflicts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Kargakis this is from upstream, if we want that I will fix this in upstream as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we should probably fix it there too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed (here)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And the upstream portion: kubernetes/kubernetes#29188
377970e
to
4436fef
Compare
LGTM [merge] |
4436fef
to
0f733dd
Compare
// If we failed to pause the deployment config, it means we are talking to | ||
// old API that does not support pausing. In that case, we delete the | ||
// deployment config to stay backward compatible. | ||
if !isPaused { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Kargakis backward compatibility should be saved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sup
0f733dd
to
38bef7d
Compare
for _, rc := range deployments { | ||
if err = rcReaper.Stop(rc.Namespace, rc.Name, timeout, gracePeriod); err != nil { | ||
// Better not error out here... | ||
glog.Infof("Cannot delete ReplicationController %s/%s: %v", rc.Namespace, rc.Name, err) | ||
glog.Infof("Cannot delete ReplicationController %s/%s for deployment %s/%s: %v", rc.Namespace, rc.Name, namespace, name, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for deployment config
ed5c015
to
bd19c29
Compare
bd19c29
to
f349944
Compare
@Kargakis this now need re-review
|
f349944
to
51c2eac
Compare
[test] |
Evaluated for origin test up to 51c2eac |
err error | ||
) | ||
deploymentConfigs := reaper.oc.DeploymentConfigs(namespace) | ||
resultErr := wait.Poll(10*time.Millisecond, 1*time.Minute, func() (bool, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't poll too fast - make this 500ms.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was copied from upstream :)
One comment, LGTM otherwise |
continuous-integration/openshift-jenkins/test ABORTED (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/6547/) |
LGTM [merge] |
[merge] |
continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/6689/) (Image: devenv-rhel7_4642) |
[merge] (RH registry flake) |
Evaluated for origin merge up to 51c2eac |
Fixes: #9532