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

Fail requests when READY and STOPPED canary update fails and reverts … #39

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,21 @@ public ProgressEvent<ResourceModel, CallbackContext> handleRequest() {
private ProgressEvent<ResourceModel, CallbackContext> handleCanaryInStateReadyOrStopped(Canary canary) {
log(String.format("Canary is in state %s.", canary.status().stateAsString()));

/* After an update, If canary is in READY or STOPPED state with stateReason message, it indicates that update has failed.
1. If the canary was initially in READY or STOPPED state and there was an error
during provisioning, then it will be set to READY or STOPPED state again and the message
will be in the StateReason field.
2. A canary initially in Running state can also be set to state STOPPED if it was a run once canary and update failed but meanwhile canary execution has come to an end.
*/
if (!Strings.isNullOrEmpty(canary.status().stateReason())) {
log(String.format("Update failed: %s", canary.status().stateReason()));
return ProgressEvent.failed(
model,
context,
HandlerErrorCode.GeneralServiceException,
canary.status().stateReason());
}

if (model.getStartCanaryAfterCreation()) {
// There is a race condition here. We will get an exception if someone calls
// DeleteCanary, StartCanary, or UpdateCanary before we call StartCanary.
Expand Down Expand Up @@ -191,7 +206,7 @@ private ProgressEvent<ResourceModel, CallbackContext> updateCanary(Canary canary
log("Updating memory");
memoryInMB = model.getRunConfig().getMemoryInMB();
}

if (model.getRunConfig().getActiveTracing() != null && !Objects.equals(activeTracing, model.getRunConfig().getActiveTracing())) {
log("Updating active tracing");
activeTracing = Boolean.TRUE.equals(model.getRunConfig().getActiveTracing());
Expand Down