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

PoC for general processing of status conditions for multiple operands #447

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

Conversation

tremes
Copy link
Contributor

@tremes tremes commented Mar 26, 2024

This is just a proposal (maybe too many unstructured and type converting) for more general processing of status conditions for multiple operands. Only one shared Condition type is assumed (see #434 (comment)).

The idea is based on the Operand type (see here), which is a wrapper for client.Object, but also introduces flags that tell what it affects in terms of status conditions.

The disadvantage is that the condition is overwritten (see here, it also means that the order of the operands matters) and we could probably think about some more sophisticated "aggregating" approach.

Question is how to calculate or aggregate the observedGeneration value when a stack has more than operand.

@tremes tremes requested a review from a team as a code owner March 26, 2024 09:59
@tremes tremes requested review from simonpasquier and slashpai and removed request for a team March 26, 2024 09:59
@openshift-ci openshift-ci bot requested a review from sthaha March 26, 2024 09:59
return v1alpha1.Condition{}, fmt.Errorf("ERROR: condition type %v not found", t)
}

func getConditionsFromObject(o client.Object) ([]v1alpha1.Condition, error) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Perhaps we could avoid this function by using some interface like:

type StatusReporting interface {
	Conditions() []Condition
	Geeneration() int64
}

And require types like MonitoringStack to implement this interface.

Copy link
Contributor Author

@tremes tremes May 2, 2024

Choose a reason for hiding this comment

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

@jan--f I was updating this PR this morning a bit (locally so far) and I think this ^^ can probably make few things more simple here.
What do you think about this idea? The Operand type introduced here can then use this StatusReporting type instead of client.Object (but it's just theory. I haven't tried yet)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hm actually the theory was not correct :) I guess it won't help much with the conditions reading from the operands.

Copy link
Collaborator

Choose a reason for hiding this comment

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

yeah I see.
Could we perhaps use generics to implement the update* functions? The idea would be to simply provide a helper function that implements what's described in https://docs.google.com/presentation/d/1f-0UtZB8RvIlw49pBYCLfLfWeRflUYo2bJvkKpL2sRo/edit#slide=id.g28d2c6c7c1e_0_10
wdyt?

we certainly could make do without this, but maybe this is nice chance to testdrive golang generics :)

Copy link

openshift-ci bot commented May 3, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: tremes

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

@tremes tremes force-pushed the conditions-universal-qmark branch from fa1a3e1 to 5680b97 Compare May 3, 2024 11:03
Copy link

openshift-ci bot commented May 3, 2024

@tremes: 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/observability-operator-e2e 5680b97 link true /test observability-operator-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/test-infra repository. I understand the commands that are listed here.

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

Successfully merging this pull request may close these issues.

None yet

3 participants