-
Notifications
You must be signed in to change notification settings - Fork 51
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
base: main
Are you sure you want to change the base?
Conversation
pkg/status/conditions.go
Outdated
return v1alpha1.Condition{}, fmt.Errorf("ERROR: condition type %v not found", t) | ||
} | ||
|
||
func getConditionsFromObject(o client.Object) ([]v1alpha1.Condition, error) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 :)
8f3f336
to
fa1a3e1
Compare
[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 |
fa1a3e1
to
5680b97
Compare
@tremes: The following test failed, say
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. |
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 forclient.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.