Skip to content

Commit

Permalink
should support webhook certDir args
Browse files Browse the repository at this point in the history
  • Loading branch information
xrmzju committed Aug 27, 2019
1 parent d90bbc6 commit c658932
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pkg/manager/internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ 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.
// if not set, webhook server would look up the server key and certificate in
// {TempDir}/k8s-webhook-server/serving-certs
certDir string

webhookServer *webhook.Server

Expand Down Expand Up @@ -219,8 +223,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
5 changes: 5 additions & 0 deletions pkg/manager/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,10 @@ type Options struct {
// It is used to set webhook.Server.Host.
Host string

// CertDir is the directory that contains the server key and certificate.
// if not set, webhook server would look up the server key and certificate in
// {TempDir}/k8s-webhook-server/serving-certs
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 +275,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 c658932

Please sign in to comment.