-
Notifications
You must be signed in to change notification settings - Fork 13
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
persist manual unpause until end of a canary deployment, and then reset #77
Conversation
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 pull request contains a valid label.
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 pull request contains a valid label.
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.
looks great, thank you for fixing it.
juste a small nit.
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 pull request contains a valid label.
7b4fd6c
to
6dff609
Compare
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 pull request contains a valid label.
6dff609
to
f90f1e1
Compare
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 pull request contains a valid label.
f90f1e1
to
6084a09
Compare
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 pull request contains a valid label.
Codecov Report
@@ Coverage Diff @@
## master #77 +/- ##
==========================================
+ Coverage 33.51% 33.67% +0.16%
==========================================
Files 41 41
Lines 2987 3005 +18
==========================================
+ Hits 1001 1012 +11
- Misses 1899 1906 +7
Partials 87 87
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
// we use the `extendedDaemonsetCopy` instance to have last version. that contains the latest metadata info (resource version) | ||
// Copy the spec part into the extendedDaemonsetCopy. | ||
extendedDaemonsetCopy.Spec = *newDaemonset.Spec.DeepCopy() | ||
extendedDaemonsetCopy.Annotations = newDaemonset.Annotations |
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.
@clamoriniere this is a key change since your review; this seemed to fix an issue of annotations not being deleted (and thus the state staying in failed
, for instance)
@@ -194,7 +196,11 @@ func manageCanaryPodFailures(pods []*v1.Pod, params *Parameters, result *Result, | |||
"MaxRestarts", autoFailMaxRestarts, | |||
"Reason", highRestartReason, | |||
) | |||
} else if !result.IsPaused && autoPauseEnabled { | |||
case result.IsUnpaused: |
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.
@clamoriniere this is also a key change made since your review. afaict we didn't have a way of updating the ERS paused
condition to false
, (once paused: true
we were in a positive cycle) so making it explicit here. i believe for failed
it doesn't matter since the ERS should drop out
keysToDelete := []string{ | ||
datadoghqv1alpha1.ExtendedDaemonSetCanaryPausedAnnotationKey, | ||
datadoghqv1alpha1.ExtendedDaemonSetCanaryPausedReasonAnnotationKey, | ||
datadoghqv1alpha1.ExtendedDaemonSetCanaryUnpausedAnnotationKey, | ||
datadoghqv1alpha1.ExtendedDaemonSetCanaryFailedAnnotationKey, | ||
datadoghqv1alpha1.ExtendedDaemonSetCanaryFailedReasonAnnotationKey, | ||
} | ||
var updated bool | ||
for _, key := range keysToDelete { | ||
if _, ok := eds.Annotations[key]; ok { | ||
delete(eds.Annotations, key) | ||
updated = true | ||
} | ||
} | ||
return updated |
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.
@xornivore will be happy about this change :)
// Unpaused annotation takes precedence | ||
isUnpaused, found := dsAnnotations[datadoghqv1alpha1.ExtendedDaemonSetCanaryUnpausedAnnotationKey] | ||
if found && isUnpaused == v1alpha1.ValueStringTrue { | ||
return false, "" | ||
} |
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.
do we still need the IsCanaryDeploymentUnpaused()
if we consider unpause annotations here?
or maybe:
// Unpaused annotation takes precedence | |
isUnpaused, found := dsAnnotations[datadoghqv1alpha1.ExtendedDaemonSetCanaryUnpausedAnnotationKey] | |
if found && isUnpaused == v1alpha1.ValueStringTrue { | |
return false, "" | |
} | |
// Unpaused annotation takes precedence | |
if IsCanaryDeploymentUnpaused(dsAnnotations) { | |
return false, "" | |
} |
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.
good question, indeed we may not. will give it a quick test
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.
removed! thanks for catching
6084a09
to
c20d8c0
Compare
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 pull request contains a valid label.
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.
👍 thank you for this fix
…et (#77) * persist manual unpause until end of a canary deployment, and then reset * fix clearCanaryAnnotations, update from feedback
…et (#77) * persist manual unpause until end of a canary deployment, and then reset * fix clearCanaryAnnotations, update from feedback
…et (#77) * persist manual unpause until end of a canary deployment, and then reset * fix clearCanaryAnnotations, update from feedback
…et (#77) * persist manual unpause until end of a canary deployment, and then reset * fix clearCanaryAnnotations, update from feedback
What does this PR do?
Previously, the ability to manually
unpause
a Canary deployment was added. However, ifAutoPause
is enabled and the Canary deployment exceeds the number ofmaxRestarts
(for instance), then the Canary will be automatically paused again following anunpause
action.This PR persists a manual
unpause
action by storing it in an annotation, and inhibits theAutoPause
feature until the Canary deployment ends and the annotation is removed.Motivation
Better user experience
Additional Notes
Note that a user cannot
unpause
to effectively disableAutoPause
, and then change their mind and re-enableAutoPause
during the ongoing Canary deployment using the plugin. (They can manually edit the unpause annotation as a workaround.) Manualpause
/unpause
actions can be executed with the plugin at will.Describe your test plan
make build
(this also builds the plugin)kind
clusterconfig/manager/manager.yaml
andconfig/manager/kustomization.yaml
to use imagetest/extendeddaemonset:test
and image pull policyNever
make install
make IMG=test/extendeddaemonset:test docker-build
kind load docker-image test/extendeddaemonset:test
make deploy
ExtendedDaemonSet
s inexamples/
to start a canary deploymentbin/kubectl-eds canary pause foo
; verify it is paused (withkubectl-eds get
and by checking the annotation)bin/kubectl-eds canary unpause foo
; verify it is unpausedcanary-unpaused
annotation is clearedbash:latest
image) andAutoPause
is enabled. Make sure that, after the canary is automatically paused,bin/kubectl-eds canary unpause foo
allows the canary deployment to finish despite the restarts.canary fail foo
,canary pause foo -> canary unpause foo