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

Remove stale remediated condition when in-sync #833

Merged
merged 1 commit into from
Dec 8, 2023

Conversation

darkowlzz
Copy link
Contributor

Remediation can roll back to a version that matches with the next good config. In such situation, release will be in-sync and no action will be performed. The status conditions will continue to show Remediated=True and Released=False. Check and remove stale Remediated condition and add a Released=True condition with message constructed from the latest release.

Before this change, a release could end up in the following state:

status:
  conditions:
  - lastTransitionTime: "2023-12-04T19:41:27Z"
    message: Helm rollback to previous release default/podinfo.v18 with chart [email protected]
      succeeded
    observedGeneration: 14
    reason: RollbackSucceeded
    status: "False"
    type: Ready
  - lastTransitionTime: "2023-12-04T19:41:27Z"
    message: 'Helm upgrade failed for release default/podinfo with chart [email protected]:
      context deadline exceeded'
    observedGeneration: 14
    reason: UpgradeFailed
    status: "False"
    type: Released
  - lastTransitionTime: "2023-12-04T19:41:27Z"
    message: Helm rollback to previous release default/podinfo.v18 with chart [email protected]
      succeeded
    observedGeneration: 14
    reason: RollbackSucceeded
    status: "True"
    type: Remediated

After this change:

status:
  conditions:
  - lastTransitionTime: "2023-12-07T17:58:08Z"
    message: Helm upgrade succeeded for release default/podinfo.v18 with chart [email protected]
    observedGeneration: 15
    reason: UpgradeSucceeded
    status: "True"
    type: Ready
  - lastTransitionTime: "2023-12-07T17:58:08Z"
    message: Helm upgrade succeeded for release default/podinfo.v18 with chart [email protected]
    observedGeneration: 15
    reason: UpgradeSucceeded
    status: "True"
    type: Released

@darkowlzz darkowlzz force-pushed the stale-remediated-in-sync branch 3 times, most recently from 7baedcb to e627301 Compare December 7, 2023 21:42
Copy link
Member

@hiddeco hiddeco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks a lot @darkowlzz 🥇

@darkowlzz darkowlzz force-pushed the stale-remediated-in-sync branch 2 times, most recently from 871de13 to 5a20c32 Compare December 8, 2023 12:29
Remediation can roll back to a version that matches with the next good
config. In such situation, release will be in-sync and no action will be
performed. The status conditions will continue to show Remediated=True
and Released=False. Check and remove stale Remediated condition and add
a Released=True condition with message constructed from the latest
release.

Introduce replaceCondition() to replaces target condition with a
replacement condition, retaining the transition time. This helps ensure
that the last transition time of releases don't change when a release is
marked from remediated to released.

Signed-off-by: Sunny <[email protected]>
@darkowlzz darkowlzz merged commit c4915d1 into main Dec 8, 2023
6 checks passed
@darkowlzz darkowlzz deleted the stale-remediated-in-sync branch December 8, 2023 12:58
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.

2 participants