Skip to content

Commit 007dc76

Browse files
committed
envtest: set default webhook options for polling
Similar to how it's done for the CRD installation, set default webhook options for timeout/poll interval values. This avoids getting MaxTime=0 which changes its behaviour when moving from k8s deprecated wait.PollImmediate() to wait.PollUntilContextTimeout(). Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
1 parent 0f5aba9 commit 007dc76

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

pkg/envtest/webhook.go

+12
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)