-
Notifications
You must be signed in to change notification settings - Fork 240
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
instantiate a default cns config if loading fails #1829
Conversation
cns/service/main.go
Outdated
@@ -503,6 +503,7 @@ func main() { | |||
cnsconfig, err := configuration.ReadConfig(cmdLineConfigPath) | |||
if err != nil { | |||
logger.Errorf("[Azure CNS] Error reading cns config: %v", err) | |||
cnsconfig = &configuration.CNSConfig{} |
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.
We should make it apparent in the error log line that a default will be used. I'm also curious if we should only use a default in cases where the file is missing. If, for example, the file is malformed, maybe it's better to still crash such that orchestrators take action.
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.
agree and updated
Signed-off-by: Evan Baker <[email protected]>
Signed-off-by: Evan Baker <[email protected]>
…lformed Signed-off-by: Evan Baker <[email protected]>
Signed-off-by: Evan Baker <[email protected]>
Signed-off-by: Evan Baker <[email protected]>
Reason for Change:
Currently if CNS does not find a config it returns a nil pointer and an error, but does not stop executing and continues to attempt to use that nil config pointer (immediately, in the next line...).
This change modifies the behavior such that if we fail to find a config and return a nil pointer, we instantiate a default struct and assign it to make the subsequent pointer refs valid.
Issue Fixed:
closes #1775
Requirements:
Notes: