Skip to content

Commit

Permalink
🐛 check if resource exist to allow to create webhooks
Browse files Browse the repository at this point in the history
  • Loading branch information
Camila Macedo committed Oct 10, 2020
1 parent 5031c94 commit 77e00f8
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 77e00f8

Please sign in to comment.