Skip to content

Commit

Permalink
🌱 Allow users to specify webhook server cert and key names
Browse files Browse the repository at this point in the history
Signed-off-by: Vince Prignano <vince@prigna.com>
  • Loading branch information
vincepri committed May 3, 2024
1 parent 6d400b5 commit 7ca4bf8
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ var (
restConfigBurst int
webhookPort int
webhookCertDir string
webhookCertName string
webhookKeyName string
healthAddr string
tlsOptions = flags.TLSOptions{}
diagnosticsOptions = flags.DiagnosticsOptions{}
Expand Down Expand Up @@ -218,6 +220,12 @@ func InitFlags(fs *pflag.FlagSet) {
fs.StringVar(&webhookCertDir, "webhook-cert-dir", "/tmp/k8s-webhook-server/serving-certs/",
"Webhook cert dir, only used when webhook-port is specified.")

fs.StringVar(&webhookCertName, "webhook-cert-name", "tls.crt",
"Webhook cert name, only used when webhook-port is specified.")

fs.StringVar(&webhookKeyName, "webhook-key-name", "tls.key",
"Webhook key name, only used when webhook-port is specified.")

fs.StringVar(&healthAddr, "health-addr", ":9440",
"The address the health endpoint binds to.")

Expand Down Expand Up @@ -325,9 +333,11 @@ func main() {
},
WebhookServer: webhook.NewServer(
webhook.Options{
Port: webhookPort,
CertDir: webhookCertDir,
TLSOpts: tlsOptionOverrides,
Port: webhookPort,
CertDir: webhookCertDir,
CertName: webhookCertName,
KeyName: webhookKeyName,
TLSOpts: tlsOptionOverrides,
},
),
}
Expand Down

0 comments on commit 7ca4bf8

Please sign in to comment.