Skip to content

Commit 3171b66

Browse files
authored
Merge pull request #2289 from mythi/envtest
🌱 envtest: set default webhook options for polling
2 parents 0f5aba9 + 007dc76 commit 3171b66

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

pkg/envtest/webhook.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ func (o *WebhookInstallOptions) PrepWithoutInstalling() error {
147147

148148
// Install installs specified webhooks to the API server.
149149
func (o *WebhookInstallOptions) Install(config *rest.Config) error {
150+
defaultWebhookOptions(o)
151+
150152
if len(o.LocalServingCAData) == 0 {
151153
if err := o.PrepWithoutInstalling(); err != nil {
152154
return err
@@ -168,6 +170,16 @@ func (o *WebhookInstallOptions) Cleanup() error {
168170
return nil
169171
}
170172

173+
// defaultWebhookOptions sets the default values for Webhooks.
174+
func defaultWebhookOptions(o *WebhookInstallOptions) {
175+
if o.MaxTime == 0 {
176+
o.MaxTime = defaultMaxWait
177+
}
178+
if o.PollInterval == 0 {
179+
o.PollInterval = defaultPollInterval
180+
}
181+
}
182+
171183
// WaitForWebhooks waits for the Webhooks to be available through API server.
172184
func WaitForWebhooks(config *rest.Config,
173185
mutatingWebhooks []*admissionv1.MutatingWebhookConfiguration,

0 commit comments

Comments
 (0)