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
camilamacedo86 committed Oct 5, 2020
1 parent 70e9989 commit 997cf54
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/plugin/v2/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@ 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 informed", 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 informed", p.commandName)
}

return nil
}

Expand Down

0 comments on commit 997cf54

Please sign in to comment.