Skip to content
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

Expose flags to configure TLS #451

Merged
merged 2 commits into from
Jul 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions pkg/operator/controllermanager/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,33 @@ func InitFlags() {
}
}

// expose flags to configure TLS communication to topology service and vttablets
// vttablet set contains all required flags
vttabletFlags := servenv.GetFlagSetFor("vttablet")
tlsFlags := map[string]bool{
"tablet_manager_grpc_ca": false,
"tablet_manager_grpc_server_name": false,
"topo_global_server_address": false,
"topo_etcd_tls_ca": false,
"topo_etcd_tls_cert": false,
"topo_etcd_tls_key": false,
}
vttabletFlags.VisitAll(func(f *pflag.Flag) {
_, isRequired := tlsFlags[f.Name]
if isRequired {
isAlreadyAdded := pflag.CommandLine.Lookup(f.Name) != nil
if !isAlreadyAdded {
pflag.CommandLine.AddFlag(f)
tlsFlags[f.Name] = true
}
}
})
for flagName, wasAdded := range tlsFlags {
if !wasAdded {
fmt.Fprintf(os.Stderr, "unable to add the flag - %s\n", flagName)
}
}

// Add flags registered by imported packages (e.g. glog and
// controller-runtime)
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
Expand Down