Skip to content

Commit 849fb52

Browse files
authored
Merge pull request #367 from damdo/use-manager-tlsconfig-for-webhook-server
fix: use tlsconfig from the manager options for the webhook server
2 parents a652813 + 1cbbb18 commit 849fb52

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

main.go

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ package main
1818

1919
import (
2020
"context"
21-
"crypto/tls"
2221
"flag"
2322
"math/rand"
2423
"os"
@@ -161,21 +160,11 @@ func main() {
161160
}
162161
}
163162

164-
webhookOptions := webhook.Options{
165-
Port: webhookPort,
166-
CertDir: webhookCertDir,
167-
TLSOpts: []func(*tls.Config){
168-
func(t *tls.Config) {
169-
t.MinVersion = tls.VersionTLS12
170-
},
171-
},
172-
}
173-
174163
restConfig := ctrl.GetConfigOrDie()
175164
restConfig.QPS = restConfigQPS
176165
restConfig.Burst = restConfigBurst
177166

178-
_, metricsOptions, err := flags.GetManagerOptions(managerOptions)
167+
tlsOptions, metricsOptions, err := flags.GetManagerOptions(managerOptions)
179168
if err != nil {
180169
setupLog.Error(err, "unable to start manager: invalid flags")
181170
os.Exit(1)
@@ -194,7 +183,11 @@ func main() {
194183
DefaultNamespaces: defaultNamespaces,
195184
},
196185
HealthProbeBindAddress: healthAddr,
197-
WebhookServer: webhook.NewServer(webhookOptions),
186+
WebhookServer: webhook.NewServer(webhook.Options{
187+
Port: webhookPort,
188+
CertDir: webhookCertDir,
189+
TLSOpts: tlsOptions,
190+
}),
198191
})
199192
if err != nil {
200193
setupLog.Error(err, "unable to start manager")

0 commit comments

Comments
 (0)