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

cmd, webhook: add config opt to specify the cert path #19

Merged
merged 1 commit into from
Jun 7, 2024
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
17 changes: 15 additions & 2 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,21 @@ func main() {
var enableLeaderElection bool
var probeAddr string
var enableHTTP2 bool
var certDir string

flag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.")
flag.BoolVar(&enableLeaderElection, "leader-elect", false,
"Enable leader election for controller manager. "+
"Enabling this will ensure there is only one active controller manager.")
flag.BoolVar(&enableHTTP2, "enable-http2", false,
"If set, HTTP/2 will be enabled for the metrics and webhook servers")
flag.StringVar(
&certDir,
"certificates-dir",
"",
"Specify the certificates directory for the webhook server",
)

opts := zap.Options{
Development: true,
}
Expand All @@ -97,9 +105,14 @@ func main() {
tlsOpts = append(tlsOpts, disableHTTP2)
}

webhookServer := webhook.NewServer(webhook.Options{
webhookOptions := webhook.Options{
TLSOpts: tlsOpts,
})
}
if certDir != "" {
setupLog.Info("using certificates directory", "dir", certDir)
webhookOptions.CertDir = certDir
}
webhookServer := webhook.NewServer(webhookOptions)

mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
Scheme: scheme,
Expand Down
Loading