On a failed promotion the canary keeps serving, but the traffic may
already have been shifted to the primary by runPromotionTrafficShift
before it started failing. Route all traffic back to the canary and
report the matching canary weight instead of zeroing it.
Addresses review feedback on #1931.
Signed-off-by: Pedram Pourmohammad <eragon.pedy@gmail.com>
When the canary analysis succeeds, Flagger copies the canary pod spec
to the primary and waits for the primary rollout to finish. If the
primary fails to become ready, the non-retriable readiness error
triggered the standard analysis rollback, which routes all traffic to
the primary and scales the canary to zero.
During promotion the primary already runs the new (failing) spec while
the canary is the only healthy copy of the new revision still serving
traffic. Rolling back therefore sends all traffic to the broken primary
and deletes the working canary, taking the application down.
Halt the promotion instead: when the primary is not ready and the canary
is in the Promoting or Finalising phase, mark the rollout as failed and
alert, but keep the canary running and leave routing untouched until the
primary recovers or a corrected revision is applied.
Fixes#1898
Signed-off-by: Pedram Pourmohammad <eragon.pedy@gmail.com>
When skipAnalysis is enabled and the canary is promoted, the
post-rollout webhooks were not being executed. This fix ensures
that runPostRolloutHooks is called in shouldSkipAnalysis, matching
the behavior of the normal promotion path.
Fixesfluxcd/flagger#1195
Signed-off-by: Vishal Kumar Singh <vishal.kr.singh2021@gmail.com>
When cross-namespace references are disabled, ensure that UpstreamRef,
MetricTemplateRef, and AlertProviderRef default to the canary's namespace
if their namespace field is empty. This aligns the validation logic with
the rest of the controller and prevents false positives when the namespace
is omitted.
Fixes#1827
Signed-off-by: Barrera, Angel <angelbarrerasanchez@protonmail.com>
Implement flagger_canary_successes_total and flagger_canary_failures_total
counter metrics with deployment strategy detection and analysis status
tracking for better observability of canary deployment outcomes.
Signed-off-by: cappyzawa <cappyzawa@gmail.com>
Enhance existing scheduler tests for deployments, daemonsets, and
services by adding prometheus metrics verification using testutil.
This ensures that status metrics are correctly recorded during
canary promotion workflows and provides better test coverage for
the metrics recording functionality.
Signed-off-by: cappyzawa <cappyzawa@gmail.com>
Add a Keptn metrics provider for two resources:
* KeptnMetric: Verify the value of a single metric.
* Analysis (via AnalysisDefinition): Run a Keptn analysis over an
interval validating SLOs.
Signed-off-by: Florian Bacher <florian.bacher@dynatrace.com>
Modify `canary.IsPrimaryReady()` and `canary.Initialize()` to return a
boolean indicating if the error is retriable. Modify the scheduler to
rollback the analysis and mark the Canary object as failed if the above
two functions or `canary.IsCanaryRead()` returns false along with an
error.
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
Add a new field `.spec.webhooks[].retries` to specify the number of
retries when calling a webhook.
Signed-off-by: Joseph Kwasniewski <kwasniewski@gmail.com>
Fix the waiting logic to actually wait for the canary deployment to be
ready before continuing with the rest of the finalization logic.
Previously, the canary deployment was not being checked for a ready
status due to the the absence of the `Steps` field in the specified
backoff.
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
This adds a new Checksum field to the canary webhook body, which is a
hash of the LastAppliedSpec and TrackedConfigs.
This can be used to identify the rollout of a specific configuration,
and differentiate between webhooks being sent for different
configuration and deployment versions.
Signed-off-by: Kevin McDermott <kevin@weave.works>
Suspend, if set to true will suspend the Canary, disabling any canary runs
regardless of any changes to its target, services, etc. Note that if the
Canary is suspended during an analysis, its paused until the Canary is unsuspended.
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
Resume target scaler during finalization so that targetRef deployment
does not get stuck at 0 replicas after canary has been deleted.
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
Run the `confirm-rollout` webhook check right before scaling up the
deployment only, instead of running it on every loop.
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>