Skip to content

Commit

Permalink
Merge pull request #2289 from mythi/envtest
Browse files Browse the repository at this point in the history
🌱 envtest: set default webhook options for polling
  • Loading branch information
k8s-ci-robot committed Apr 26, 2023
2 parents 0f5aba9 + 007dc76 commit 3171b66
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pkg/envtest/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ func (o *WebhookInstallOptions) PrepWithoutInstalling() error {

// Install installs specified webhooks to the API server.
func (o *WebhookInstallOptions) Install(config *rest.Config) error {
defaultWebhookOptions(o)

if len(o.LocalServingCAData) == 0 {
if err := o.PrepWithoutInstalling(); err != nil {
return err
Expand All @@ -168,6 +170,16 @@ func (o *WebhookInstallOptions) Cleanup() error {
return nil
}

// defaultWebhookOptions sets the default values for Webhooks.
func defaultWebhookOptions(o *WebhookInstallOptions) {
if o.MaxTime == 0 {
o.MaxTime = defaultMaxWait
}
if o.PollInterval == 0 {
o.PollInterval = defaultPollInterval
}
}

// WaitForWebhooks waits for the Webhooks to be available through API server.
func WaitForWebhooks(config *rest.Config,
mutatingWebhooks []*admissionv1.MutatingWebhookConfiguration,
Expand Down

0 comments on commit 3171b66

Please sign in to comment.