Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

should support webhook certDir args #569

Merged
merged 1 commit into from
Sep 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
xrmzju marked this conversation as resolved.
Show resolved Hide resolved
// 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