-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
[master] Add validation to certificate rotation #4692
[master] Add validation to certificate rotation #4692
Conversation
Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com>
pkg/cli/cert/cert.go
Outdated
@@ -219,3 +223,23 @@ func backupCertificates(serverDataDir, agentDataDir string) (string, error) { | |||
} | |||
return tlsBackupDir, nil | |||
} | |||
|
|||
func validateCertConfig() error { | |||
for _, service := range cmds.ServicesList { |
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.
Can you create a helper method and simplify this logic?
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.
done
Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com>
@@ -34,6 +34,20 @@ const ( | |||
k3sServerService = "-server" | |||
) | |||
|
|||
var services = []string{ |
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.
a more efficient way to do this would be to make this a map[string]struct{}
or map[string]bool
and then just see if the service name is in the map instead of having to walk the whole list each time, but this is fine.
CI is failing because of test validation flake, merging PR now |
Signed-off-by: galal-hussein hussein.galal.ahmed.11@gmail.com
Proposed Changes
Add validation to certificate rotation service
Types of Changes
bugfix
Verification
the subcommand should return error: