-
Notifications
You must be signed in to change notification settings - Fork 612
Trigger without a broker does not correctly reflect ready status #2996
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
Comments
This happens because triggers are not reconciled when their broker doesn't exist. One possible solution is to alter the reconciler so that instead of immediately returning when encountering a broker key that doesn't exist, it instantiates a new broker and reconciles anyway. The reconciler would need to be aware that if it receives a broker that has not been created yet, it should only reconcile the broker's triggers and not update the broker's status. The code handling this is generated by genreconciler so it would need to be overridden. I think @n3wscott also had thoughts about this |
It's actually more complicated than I originally thought. Triggers created before their brokers exist cannot be reconciled by any broker-classed reconciler because they aren't classified on creation. They only get a broker class indirectly by being related to an existing classified broker. In the quote above, no broker-classed reconciler can correctly be "the reconciler" that reconciles the trigger with an unsaved broker. |
I stumbled upon this one also. The trigger reconciler currently checks for the existence of a Trigger's Broker, so in the case that Broker does not exist, it should also be setting the |
yep, on my todo list, hoping to get this banged out today or tmw |
Ho hum. As discussed a couple of weeks ago, we were going to look at defaulting the status field, so started to play with that. I'm either screwing something up (most likely), or you can't update the status in the defaulter. Anyways, after trying to add that logic in the defaulter, I see the patch bytes being properly set, but they are not making it into the storage. You can see it's defaulting the spec.broker and that works. The status.observedgeneration is just a test in case I was screwing up the structs somehow. Anyways, just jotting this down here.
|
@vaikas even if you get the defaulter working, writing an inaccurate status condition is a bad idea. Even if the status lives for only a few milliseconds until the reconciler sets the correct status, other tools watching the resource will see the false status and be confused. A common pattern we've used in CLIs is to create a resource and then watch for its Ready condition to become True or False. If we see a the condition flip false, we report the error to the user. With this change, the trigger creation would always report as failed. |
Well, we could set the status to unknown if that would make it better. |
That resolves my objection, but doesn't do anything in the context of this issue |
I think the fundamental issue is that the user gets no feedback, and setting the status to Unknown with the message saying why that might not be the case seems to do something about this issue? |
right here it is valid to set the Trigger's BrokerReady status to "False": https://github.com/knative/eventing/blob/master/pkg/reconciler/trigger/trigger.go#L55 why not do it there? |
We talked about that (having a 'catch-all' reconciler for Trigger resources) and IIRC we tried this in the past with some other resource, maybe channels? where there was a controller that would modify a resource that it was not responsible for and it lead to race conditions and hilarity. @Harwayne you recall the deets here? |
I think it makes sense to use Unknown in the webhook with the message proposed above or something similar. That gives the user some idea of what the current state of the trigger is (waiting for a broker to show up). @scothis I think it mostly resolves this issue because it gives the user feedback about what would help the trigger progress to a ready state. As far as whether the trigger's status is more accurately false or unknown, we've had similar discussions before in other contexts. It seems to boil down to: is waiting for another object to exist a terminal state or an unknown state? If the object is never created, the status is effectively terminal but there's no way for the reconciler to know that. I haven't seen an answer yet that satisfies all stakeholders. |
If the catch-all Trigger reconciler is only taking responsibility when there is no Broker, then it shouldn't be competing with anything, since based on the current design of relying on the broker's annotation, the Trigger will only be managed by that Broker's reconciler once the Broker itself is available and the associated reconciler then takes over control with no overlap. As far as creating brokers by default, I've already explained why I'm not in favor here: #2970 (comment) |
There was a controller that would update a channel's status if it didn't get a provisioner after some time. Might be worth revisiting since I think we have more sophisticated ways to patch an object's status now (there was recent conversation about this somewhere). If we're using it to flip from unknown to false, we still need to decide at least part of the "when is non-existence terminal" question above. |
So, it's impossible to set the Status in defaulting webhook today, live and learn ✅ Ok, so we have couple of options here for where to set this (decouple to what we set it to):
So, I'll change track and set the Condition to Unknown with the message like I had before, sound reasonable? |
@markfisher yeah, knew there was another issue tracking that, so didn't want to lump that into here :) |
Describe the bug
apply a trigger with a missing broker, the
READY
andREASON
status fields have no infoExpected behavior
It should be stated that the trigger is not
ready
and give areason
To Reproduce
apply a trigger, but have no broker
Knative release version
Additional context
From the controller log:
and the output of the trigger:
Also, there is no status on the trigger...
The text was updated successfully, but these errors were encountered: