Skip to content

Commit b88347b

Browse files
authored
Merge pull request #462 from mengqiy/addmarkers
👻 add webhook markers in the example
2 parents bce1e17 + 596620d commit b88347b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

examples/crd/pkg/resource.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ type ChaosPodList struct {
6161
Items []ChaosPod `json:"items"`
6262
}
6363

64+
// +kubebuilder:webhook:failurePolicy=fail,groups=chaosapps.metamagical.io,resources=chaospods,verbs=create;update,versions=v1,name=vchaospod.kb.io,path=/validate-chaosapps-metamagical-io-v1-chaospod,mutating=false
65+
66+
var _ webhook.Validator = &ChaosPod{}
67+
6468
// ValidateCreate implements webhookutil.validator so a webhook will be registered for the type
6569
func (c *ChaosPod) ValidateCreate() error {
6670
log.Info("validate create", "name", c.Name)
@@ -89,6 +93,8 @@ func (c *ChaosPod) ValidateUpdate(old runtime.Object) error {
8993
return nil
9094
}
9195

96+
// +kubebuilder:webhook:failurePolicy=fail,groups=chaosapps.metamagical.io,resources=chaospods,verbs=create;update,versions=v1,name=mchaospod.kb.io,path=/mutate-chaosapps-metamagical-io-v1-chaospod,mutating=true
97+
9298
var _ webhook.Defaulter = &ChaosPod{}
9399

94100
// Default implements webhookutil.defaulter so a webhook will be registered for the type

0 commit comments

Comments
 (0)