Skip to content

Add fallback for rollout restart when annotations are missing (HTTP 422) #7118

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

dkaukov
Copy link
Contributor

@dkaukov dkaukov commented Jun 3, 2025

Description

This PR adds a fallback for rollout restart when patching fails with HTTP 422 (Unprocessable Entity).
If adding the kubectl.kubernetes.io/restartedAt annotation fails (e.g., because the annotations field doesn't exist), we retry the patch with one that creates the annotations map.

Fixes: #7072


Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change
  • Chore (non-breaking change which doesn't affect codebase;
    test, version modification, documentation, etc.)

Checklist

  • Code contributed by me aligns with current project license: Apache 2.0
  • I Added CHANGELOG entry regarding this change
  • I have implemented unit tests to cover my changes
  • I have added/updated the javadocs and other documentation accordingly
  • No new bugs, code smells, etc. in SonarCloud report
  • I tested my code in Kubernetes
  • I tested my code in OpenShift

This adds a retry mechanism for rollout restart when the initial JSON Patch fails with HTTP 422 due to missing annotations node.
Copy link

sonarqubecloud bot commented Jun 3, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

StatefulSet or Deployment cannot be restarted. Failure executing PATCH
1 participant