Skip to content

Commit

Permalink
Merge pull request #1708 from camilamacedo86/fix-path-webhooks
Browse files Browse the repository at this point in the history
🐛 check if resource exist to allow to create webhooks
  • Loading branch information
k8s-ci-robot committed Oct 13, 2020
2 parents 5031c94 + 77e00f8 commit df80fc5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/plugin/v2/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ func (p *createWebhookPlugin) Validate() error {
" --programmatic-validation and --conversion to be true", p.commandName)
}

// check if resource exist to create webhook
if !p.config.HasResource(p.resource.GVK()) {
return fmt.Errorf("%s create webhook requires an api with the group,"+
" kind and version provided", p.commandName)
}

return nil
}

Expand Down
6 changes: 6 additions & 0 deletions pkg/plugin/v3/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ func (p *createWebhookPlugin) Validate() error {
" --programmatic-validation and --conversion to be true", p.commandName)
}

// check if resource exist to create webhook
if !p.config.HasResource(p.resource.GVK()) {
return fmt.Errorf("%s create webhook requires an api with the group,"+
" kind and version provided", p.commandName)
}

return nil
}

Expand Down

0 comments on commit df80fc5

Please sign in to comment.