Skip to content

Commit

Permalink
should support webhook certDir args
Browse files Browse the repository at this point in the history
  • Loading branch information
xianjing committed Aug 19, 2019
1 parent d7467fc commit 8b6a1a5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/manager/internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ type controllerManager struct {
port int
// host is the hostname that the webhook server binds to.
host string
// CertDir is the directory that contains the server key and certificate.
certDir string

webhookServer *webhook.Server

Expand Down Expand Up @@ -219,8 +221,9 @@ func (cm *controllerManager) GetAPIReader() client.Reader {
func (cm *controllerManager) GetWebhookServer() *webhook.Server {
if cm.webhookServer == nil {
cm.webhookServer = &webhook.Server{
Port: cm.port,
Host: cm.host,
Port: cm.port,
Host: cm.host,
CertDir: cm.certDir,
}
if err := cm.Add(cm.webhookServer); err != nil {
panic("unable to add webhookServer to the controller manager")
Expand Down
3 changes: 3 additions & 0 deletions pkg/manager/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ type Options struct {
// It is used to set webhook.Server.Host.
Host string

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

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

0 comments on commit 8b6a1a5

Please sign in to comment.