Skip to content

Commit c29fe20

Browse files
authored
Merge pull request #569 from xrmzju/master
should support webhook certDir args
2 parents dd6ead6 + c658932 commit c29fe20

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

pkg/manager/internal.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ 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+
// if not set, webhook server would look up the server key and certificate in
116+
// {TempDir}/k8s-webhook-server/serving-certs
117+
certDir string
114118

115119
webhookServer *webhook.Server
116120

@@ -219,8 +223,9 @@ func (cm *controllerManager) GetAPIReader() client.Reader {
219223
func (cm *controllerManager) GetWebhookServer() *webhook.Server {
220224
if cm.webhookServer == nil {
221225
cm.webhookServer = &webhook.Server{
222-
Port: cm.port,
223-
Host: cm.host,
226+
Port: cm.port,
227+
Host: cm.host,
228+
CertDir: cm.certDir,
224229
}
225230
if err := cm.Add(cm.webhookServer); err != nil {
226231
panic("unable to add webhookServer to the controller manager")

pkg/manager/manager.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,10 @@ 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+
// if not set, webhook server would look up the server key and certificate in
154+
// {TempDir}/k8s-webhook-server/serving-certs
155+
CertDir string
152156
// Functions to all for a user to customize the values that will be injected.
153157

154158
// NewCache is the function that will create the cache to be used
@@ -275,6 +279,7 @@ func New(config *rest.Config, options Options) (Manager, error) {
275279
internalStopper: stop,
276280
port: options.Port,
277281
host: options.Host,
282+
certDir: options.CertDir,
278283
leaseDuration: *options.LeaseDuration,
279284
renewDeadline: *options.RenewDeadline,
280285
retryPeriod: *options.RetryPeriod,

0 commit comments

Comments
 (0)