Skip to content

Commit 8b6a1a5

Browse files
author
xianjing
committed
should support webhook certDir args
1 parent d7467fc commit 8b6a1a5

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

pkg/manager/internal.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ type controllerManager struct {
111111
port int
112112
// host is the hostname that the webhook server binds to.
113113
host string
114+
// CertDir is the directory that contains the server key and certificate.
115+
certDir string
114116

115117
webhookServer *webhook.Server
116118

@@ -219,8 +221,9 @@ func (cm *controllerManager) GetAPIReader() client.Reader {
219221
func (cm *controllerManager) GetWebhookServer() *webhook.Server {
220222
if cm.webhookServer == nil {
221223
cm.webhookServer = &webhook.Server{
222-
Port: cm.port,
223-
Host: cm.host,
224+
Port: cm.port,
225+
Host: cm.host,
226+
CertDir: cm.certDir,
224227
}
225228
if err := cm.Add(cm.webhookServer); err != nil {
226229
panic("unable to add webhookServer to the controller manager")

pkg/manager/manager.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@ type Options struct {
149149
// It is used to set webhook.Server.Host.
150150
Host string
151151

152+
// CertDir is the directory that contains the server key and certificate.
153+
CertDir string
152154
// Functions to all for a user to customize the values that will be injected.
153155

154156
// NewCache is the function that will create the cache to be used
@@ -271,6 +273,7 @@ func New(config *rest.Config, options Options) (Manager, error) {
271273
internalStopper: stop,
272274
port: options.Port,
273275
host: options.Host,
276+
certDir: options.CertDir,
274277
leaseDuration: *options.LeaseDuration,
275278
renewDeadline: *options.RenewDeadline,
276279
retryPeriod: *options.RetryPeriod,

0 commit comments

Comments
 (0)