-
Notifications
You must be signed in to change notification settings - Fork 973
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
Crossplane custom resources status should be compatible with kstatus #2672
Comments
I'm not sure about compatibility with all of That said, if tooling like FluxCD is starting to treat Breadcrumbs to crossplane/crossplane-runtime#198, which is proposing we remove the |
Conditions are intended to be machine parseable, so renaming would be a breaking change. I think we'd need to add a My thinking is that duplicate conditions with the same meaning (e.g. |
To not break compatibility, I'll suggest adding a |
@erikgb I'm on board with adding a |
FWIW, Config Sync and kpt also assume kstatus. |
Crossplane does not currently have enough maintainers to address every issue and pull request. This issue has been automatically marked as |
/fresh Still relevant. |
Crossplane does not currently have enough maintainers to address every issue and pull request. This issue has been automatically marked as |
/fresh kstatus compatibility would be very much desirable for us as well. Especially the lack of observedGeneration on claims is problematic since it means we can't really determine if an object is truly "up-to-date" or if Crossplane is just slow/down. |
@negz seems like marking the issue as fresh does not re-open it. Could you maybe open it again? |
/reopen |
Is this just a "do"-task at this moment, no design or unknowns? In that case maybe a "good first issue"? |
Well, I would say no to your question. The resources will NOT be compatible with KStatus with the current |
There's actually a bit of discussion about Feel free to weigh in with opinions there too 🙇♂️ |
Would it be a good idea to handle some core crossplane resource types Provider, Function, Configuration, here? And keep the proposal is specifically about managed resources? At least I can check if it seems "doable" if you're OK with that, independent of the proposal. My goal here is simply to detect that provider and function upgrades are ready in our CI cluster before we actually run the CI, and since we use flux, that would work almost automatically if we fix Provider and Function objects. |
I just verified how kstatus would interpret different conditions if we add func TestKStatusCompatibility(t *testing.T) {
observedGenerationNotUpdated := &v1.Configuration{}
observedGenerationNotUpdated.SetGeneration(2)
observedGenerationNotUpdated.SetObservedGeneration(1)
observedGenerationNotUpdated.SetConditions(v1.Ready())
ready := &v1.Configuration{}
ready.SetGeneration(1)
ready.SetObservedGeneration(1)
ready.SetConditions(v1.Ready())
notReady := &v1.Configuration{}
notReady.SetGeneration(1)
notReady.SetObservedGeneration(1)
notReady.SetConditions(v1.NotReady())
unknown := &v1.Configuration{}
unknown.SetGeneration(1)
unknown.SetObservedGeneration(1)
unknown.SetConditions(v1.UnknownReady())
/* available kstatus Status-es:
InProgressStatus Status = "InProgress"
FailedStatus Status = "Failed"
CurrentStatus Status = "Current"
TerminatingStatus Status = "Terminating"
NotFoundStatus Status = "NotFound"
UnknownStatus Status = "Unknown"
*/
type args struct {
obj *v1.Configuration
}
type want struct {
status status.Status
}
cases := map[string]struct {
reason string
args args
want want
}{
"ObservedGenerationNotUpdated": {
reason: "The condition should not be used when the observed generation is not updated",
args: args{
obj: observedGenerationNotUpdated,
},
want: want{
status: status.InProgressStatus,
},
},
"Ready": {
reason: "Ready -> Current",
args: args{
obj: ready,
},
want: want{
status: status.CurrentStatus,
},
},
"NotReady": {
reason: "NotReady -> InProgress",
args: args{
obj: notReady,
},
want: want{
status: status.InProgressStatus,
},
},
"Unknown": {
reason: "unknown -> InProgress",
args: args{
obj: unknown,
},
want: want{
status: status.InProgressStatus,
},
},
}
for name, tc := range cases {
t.Run(name, func(t *testing.T) {
unstructuredBody, err := runtime.DefaultUnstructuredConverter.ToUnstructured(&tc.args.obj)
if err != nil {
t.Fatal(err)
}
u := &unstructured.Unstructured{Object: unstructuredBody}
kstatus, err := status.Compute(u)
if err != nil {
t.Fatal(err)
}
if kstatus.Status != tc.want.status {
t.Errorf("expected status %s, got %s", tc.want.status, kstatus.Status)
}
})
}
} |
Thanks for that practical example to explore how the There would be more consideration here across all the core crossplane types and MRs so we have a complete defined experience for everything, but so far this is informative. Some more areas to consider:
I wonder if we should take the full matrix of what |
Sounds good! Implementing I have mostly been thinking about managed resources. Of course, I would always vote for consistency, but I don't know enough about other Crossplane resources to say what it would mean to make them compliant too. |
Sadly, I don't think this is possible. |
Integrating kstatus compatibility would be really nice. I'm currently working with FluxCD kustomization health checks to receive notifications not just from FluxCD CRDs, but from the entire environment |
I could see adding the |
Could you explain what you don't like about it, @bobh66? We have events in Kubernetes to report important state changes. And what's the point of keeping old conditions? If we need more permanent status information on resources, we should add fields for it IMO. And following a standard, that will allow tools to integrate more easily is much better than not following a standard. Even if you think the standard is wrong. 😉 |
Mostly I don't like the fact that I can't know whether a particular condition being set is good or bad without analyzing the content of the condition. I have no problem with extra conditions to expose internal state, but for consistency they should all evaluate to True in the "good" case, and False in the "failed" case. Clients should not need to implement custom logic to analyze a list of conditions to determine readiness. The spec mentions:
but provides no method of classifying/ranking/prioritizing conditions to know which ones are the top-level and which are the details. In many cases I have seen a list of possible failure conditions listed as condition types, possibly along with a If I thought it was valid to assume that when Abnormal conditions can be reported as |
What problem are you facing?
We are attempting to provision crossplane custom resources (i.e. providers) with FluxCD, and seem to have issues enabling health assessment for crossplane custom resources. And it seems like the problem is related to the following requirement for custom resources:
And for crossplane providers, it seems like the status conditions are not compatible:
The workaround is to disable health checks for crossplane resources in FluxCD - which is far from optimal.
How could Crossplane help solve your problem?
It would be convenient if all crossplane custom resources had status conditions compatible with kstatus.
I raised this question on Slack, and got a reply from @muvaf:
The text was updated successfully, but these errors were encountered: