RunOperatorAsync breaks hosting lifecycle ? #345
Replies: 1 comment 2 replies
-
I think you are missing some of the fundamentals of how the CommandLineUtils package works, as
Furthermore, there is no simple way that doing this in a background service could function, as the command line arguments are parsed and used to make decisions such as the namespace to register in and whether to wholly boot the application or just do basic setup to do things like generate CRDs. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
As StartAsync is never called on the IHost, doesn't this mean that the dotnet Hosting model is ignored?
For examples:
if an IHostedService is added, it will never be started.
none of the IApplicationLifetime events are fired.
when the app stops none of the normal tidy up is executed.
etc
What if the contents of
RunOperatorAsync
were added to a BackgroundService? Which could be added viaOperatorBuilder.AddOperatorBase
.Then no changes would be required to the normal Program template.
Something like:
It is unfortunate that the command line args cannot be grabbed in a more elegant way 🙄
Beta Was this translation helpful? Give feedback.
All reactions