-
Notifications
You must be signed in to change notification settings - Fork 747
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
fix: added controller config validation #2103
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
won't this error always throw in case u are using just STAN?
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.
The controller crashes because there's no
EventBusConfig.NATS
orEventBusConfig.JetStream
isnil
, I feel like we only need to add some check along with error returning - the error should be displayed in the EventBus status field. WDYT?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.
@whynowy As I see it, there are 2 approaches we can go with: either fail the controller on startup or reflect the error somehow during reconcile. I'm ok with both approaches but I think it would probably make more sense to fail on startup when the controller is provided with an invalid config (as any service would fail when provided with an invalid config) because it would simply prevent the controller from functioning properly. Also, today we face an invalid
eventbus
config which prevents the controller from reconciling eventbuses but in the future it might be some other config that would make the controller pod crash or prevent it from reconciling other components as well. For that reason I think it might be better to have a general place where we validate the global configuration instead of spreading those checks across different places, and to run the validation as part of the "readiness" requirements.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.
@whynowy btw, checking if either
EventBusConfig.NATS
orEventBusConfig.JetStream
arenil
would also do the trick and prevent the nil deference crash that we have atm butversions
is still a mandatory field for both nats streaming and jestream, and withoutversions
the controller would still fail on every reconcile attempt with afailed to get jetstream/nats streaming version, err: jetstream/nats streaming version configuration not found
error. From a user's perspective I think this error might be a bit confusing, especially when it occurs during the reconcile process, as the user might think there was something wrong with the version he provided in theEventBus
spec and not in the controller config (which I'm not sure that most users aware about). WDYT?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.
@tooptoop4 This change would only validate the global configuration that is provided to the controller. You would still be able to only use stan eventbus. We could support providing only one of jestream or stan versions in the global configuration, and fail during reconcile if a user tries to install an eventbus with no versions provided in the config.
For simplicity, I chose making both mandatory for now but we can change this as well @whynowy
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.
@whynowy WDYT?
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.
Sorry for the late response.
I think it's okay to enforce eventbus configuration in the configmap for now, since in our installation files both of them are there. We can always revisit this if anything needs to be changed.