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

[ACM-10812]: retry status update on conflict #1427

Merged
merged 4 commits into from
May 14, 2024

Conversation

thibaultmg
Copy link
Contributor

@thibaultmg thibaultmg commented May 3, 2024

In some cases, while the metrics collector is well deployed in the spoke, the addon status remains in progressing state on the hub. After having modified the part that reflects the local observability addon state to the hub in #1420, this PR modifies the code that updates the local observability addon on the spoke:

  • Adds retry logic in case of conflicts
  • Avoids overriding the whole the status.Conditions list with the latest one
  • Limits the number of status.Conditions to 10.

It also removes some weird stuff like the reportStatus bool function parameter in the reportStatus function 😅

Signed-off-by: Thibault Mange <[email protected]>
thibaultmg added 2 commits May 6, 2024 10:01
Signed-off-by: Thibault Mange <[email protected]>
Signed-off-by: Thibault Mange <[email protected]>

// shouldAppendCondition checks if the new condition should be appended to the status conditions
// based on the last condition in the slice.
func shouldAppendCondition(conditions []oav1beta1.StatusCondition, newCondition *oav1beta1.StatusCondition) bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

So it stops from changing the condition, if the condition is the same?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The idea is to avoid adding duplicated status. If it is available, I don't need to report available again.
But I assume here that statuses are sorted by date, which is not necessarily the case IIRC. Probably have to change this! Having a look.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated.


obsAddon.Status.Conditions = append(obsAddon.Status.Conditions, *newCondition)

if len(obsAddon.Status.Conditions) > MaxStatusConditionsCount {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this just for convenience, or why do we want only 10?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's an arbitrary number to limit the list size... You think we need more than 10? Previously we were overriding the whole list with the last element, so 10 is better than before already.

Copy link
Contributor

Choose a reason for hiding this comment

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

I mostly just wondered if there was a specific reason for such a limit. Couldn't we just keep adding? Not sure if there is some best practice on this area.

Anything, this should be fine for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I want to avoid an ever increasing list... And potential associated bugs... Maybe it's over engineered

Signed-off-by: Thibault Mange <[email protected]>
Copy link

Copy link
Contributor

@jacobbaungard jacobbaungard left a comment

Choose a reason for hiding this comment

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

/lgtm

Copy link

openshift-ci bot commented May 13, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jacobbaungard, thibaultmg

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link

openshift-ci bot commented May 13, 2024

@thibaultmg: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/test-e2e 46a5c02 link true /test test-e2e

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@thibaultmg thibaultmg merged commit 7c4a1f1 into stolostron:main May 14, 2024
12 of 14 checks passed
@thibaultmg thibaultmg deleted the ACM_10812_2 branch May 14, 2024 14:35
coleenquadros pushed a commit to coleenquadros/multicluster-observability-operator that referenced this pull request May 23, 2024
* retry status update on conflict

Signed-off-by: Thibault Mange <[email protected]>

* add maxConditions handling

Signed-off-by: Thibault Mange <[email protected]>

* return err

Signed-off-by: Thibault Mange <[email protected]>

* sort status condition

Signed-off-by: Thibault Mange <[email protected]>

---------

Signed-off-by: Thibault Mange <[email protected]>
thibaultmg added a commit to thibaultmg/multicluster-observability-operator that referenced this pull request May 28, 2024
* retry status update on conflict

Signed-off-by: Thibault Mange <[email protected]>

* add maxConditions handling

Signed-off-by: Thibault Mange <[email protected]>

* return err

Signed-off-by: Thibault Mange <[email protected]>

* sort status condition

Signed-off-by: Thibault Mange <[email protected]>

---------

Signed-off-by: Thibault Mange <[email protected]>
thibaultmg added a commit that referenced this pull request May 30, 2024
* [ACM-10812]: fix addon status not reported in hub (#1420)

* init version

Signed-off-by: Thibault Mange <[email protected]>

* fix

Signed-off-by: Thibault Mange <[email protected]>

* env test

Signed-off-by: Thibault Mange <[email protected]>

* change withReload naming

Signed-off-by: Thibault Mange <[email protected]>

---------

Signed-off-by: Thibault Mange <[email protected]>

* [ACM-10812]: retry status update on conflict (#1427)

* retry status update on conflict

Signed-off-by: Thibault Mange <[email protected]>

* add maxConditions handling

Signed-off-by: Thibault Mange <[email protected]>

* return err

Signed-off-by: Thibault Mange <[email protected]>

* sort status condition

Signed-off-by: Thibault Mange <[email protected]>

---------

Signed-off-by: Thibault Mange <[email protected]>

* fix

Signed-off-by: Thibault Mange <[email protected]>

---------

Signed-off-by: Thibault Mange <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants