Skip to content

Commit

Permalink
Update webhook names and add new cluster configurations and webhooks
Browse files Browse the repository at this point in the history
  • Loading branch information
komer3 committed Nov 20, 2024
1 parent 841fe57 commit c1e2684
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 23 deletions.
4 changes: 4 additions & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,10 @@ func setupWebhooks(mgr manager.Manager) {
setupLog.Error(err, "unable to create webhook", "webhook", "LinodeObjectStorageKey")
os.Exit(1)
}
if err = webhookinfrastructurev1alpha2.SetupLinodeFirewallWebhookWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create webhook", "webhook", "LinodeFirewall")
os.Exit(1)
}
}

// setup configures observability features and returns a cleanup function.
Expand Down
40 changes: 20 additions & 20 deletions config/webhook/manifests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,67 +55,68 @@ webhooks:
service:
name: webhook-service
namespace: system
path: /validate-infrastructure-cluster-x-k8s-io-v1alpha2-linodemachine
path: /validate-infrastructure-cluster-x-k8s-io-v1alpha2-linodefirewall
failurePolicy: Fail
name: validation.linodemachine.infrastructure.cluster.x-k8s.io
name: validation.linodefirewall.infrastructure.cluster.x-k8s.io
rules:
- apiGroups:
- infrastructure.cluster.x-k8s.io
apiVersions:
- v1alpha2
operations:
- CREATE
- UPDATE
resources:
- linodemachines
- linodefirewalls
sideEffects: None
- admissionReviewVersions:
- v1
clientConfig:
service:
name: webhook-service
namespace: system
path: /validate-infrastructure-cluster-x-k8s-io-v1alpha2-linodeobjectstoragekey
path: /validate-infrastructure-cluster-x-k8s-io-v1alpha2-linodemachine
failurePolicy: Fail
name: validation.linodeobjectstoragekey.infrastructure.cluster.x-k8s.io
name: validation.linodemachine.infrastructure.cluster.x-k8s.io
rules:
- apiGroups:
- infrastructure.cluster.x-k8s.io
apiVersions:
- v1alpha2
operations:
- CREATE
- UPDATE
resources:
- linodeobjectstoragekeys
- linodemachines
sideEffects: None
- admissionReviewVersions:
- v1
clientConfig:
service:
name: webhook-service
namespace: system
path: /validate-infrastructure-cluster-x-k8s-io-v1alpha2-linodevpc
path: /validate-infrastructure-cluster-x-k8s-io-v1alpha2-linodeobjectstoragebucket
failurePolicy: Fail
name: validation.linodevpc.infrastructure.cluster.x-k8s.io
name: validation.linodeobjectstoragebucket.infrastructure.cluster.x-k8s.io
rules:
- apiGroups:
- infrastructure.cluster.x-k8s.io
apiVersions:
- v1alpha2
operations:
- CREATE
- UPDATE
resources:
- linodevpcs
- linodeobjectstoragebuckets
sideEffects: None
- admissionReviewVersions:
- v1
clientConfig:
service:
name: webhook-service
namespace: system
path: /validate-infrastructure-cluster-x-k8s-io-v1alpha2-linodefirewall
path: /validate-infrastructure-cluster-x-k8s-io-v1alpha2-linodeobjectstoragekey
failurePolicy: Fail
name: vlinodefirewall-v1alpha2.kb.io
name: validation.linodeobjectstoragekey.infrastructure.cluster.x-k8s.io
rules:
- apiGroups:
- infrastructure.cluster.x-k8s.io
Expand All @@ -125,17 +126,17 @@ webhooks:
- CREATE
- UPDATE
resources:
- linodefirewalls
- linodeobjectstoragekeys
sideEffects: None
- admissionReviewVersions:
- v1
clientConfig:
service:
name: webhook-service
namespace: system
path: /validate-infrastructure-cluster-x-k8s-io-v1alpha2-linodeobjectstoragebucket
path: /validate-infrastructure-cluster-x-k8s-io-v1alpha2-linodeplacementgroup
failurePolicy: Fail
name: vlinodeobjectstoragebucket-v1alpha2.kb.io
name: validation.linodeplacementgroup.infrastructure.cluster.x-k8s.io
rules:
- apiGroups:
- infrastructure.cluster.x-k8s.io
Expand All @@ -145,25 +146,24 @@ webhooks:
- CREATE
- UPDATE
resources:
- linodeobjectstoragebuckets
- linodeplacementgroups
sideEffects: None
- admissionReviewVersions:
- v1
clientConfig:
service:
name: webhook-service
namespace: system
path: /validate-infrastructure-cluster-x-k8s-io-v1alpha2-linodeplacementgroup
path: /validate-infrastructure-cluster-x-k8s-io-v1alpha2-linodevpc
failurePolicy: Fail
name: vlinodeplacementgroup-v1alpha2.kb.io
name: validation.linodevpc.infrastructure.cluster.x-k8s.io
rules:
- apiGroups:
- infrastructure.cluster.x-k8s.io
apiVersions:
- v1alpha2
operations:
- CREATE
- UPDATE
resources:
- linodeplacementgroups
- linodevpcs
sideEffects: None
2 changes: 1 addition & 1 deletion internal/webhook/v1alpha2/linodefirewall_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func SetupLinodeFirewallWebhookWithManager(mgr ctrl.Manager) error {
// TODO(user): change verbs to "verbs=create;update;delete" if you want to enable deletion validation.
// NOTE: The 'path' attribute must follow a specific pattern and should not be modified directly here.
// Modifying the path for an invalid path can cause API server errors; failing to locate the webhook.
// +kubebuilder:webhook:path=/validate-infrastructure-cluster-x-k8s-io-v1alpha2-linodefirewall,mutating=false,failurePolicy=fail,sideEffects=None,groups=infrastructure.cluster.x-k8s.io,resources=linodefirewalls,verbs=create;update,versions=v1alpha2,name=vlinodefirewall-v1alpha2.kb.io,admissionReviewVersions=v1
// +kubebuilder:webhook:path=/validate-infrastructure-cluster-x-k8s-io-v1alpha2-linodefirewall,mutating=false,failurePolicy=fail,sideEffects=None,groups=infrastructure.cluster.x-k8s.io,resources=linodefirewalls,verbs=create;update,versions=v1alpha2,name=validation.linodefirewall.infrastructure.cluster.x-k8s.io,admissionReviewVersions=v1

// LinodeFirewallCustomValidator struct is responsible for validating the LinodeFirewall resource
// when it is created, updated, or deleted.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func SetupLinodeObjectStorageBucketWebhookWithManager(mgr ctrl.Manager) error {
Complete()
}

// +kubebuilder:webhook:path=/validate-infrastructure-cluster-x-k8s-io-v1alpha2-linodeobjectstoragebucket,mutating=false,failurePolicy=fail,sideEffects=None,groups=infrastructure.cluster.x-k8s.io,resources=linodeobjectstoragebuckets,verbs=create;update,versions=v1alpha2,name=vlinodeobjectstoragebucket-v1alpha2.kb.io,admissionReviewVersions=v1
// +kubebuilder:webhook:path=/validate-infrastructure-cluster-x-k8s-io-v1alpha2-linodeobjectstoragebucket,mutating=false,failurePolicy=fail,sideEffects=None,groups=infrastructure.cluster.x-k8s.io,resources=linodeobjectstoragebuckets,verbs=create;update,versions=v1alpha2,name=validation.linodeobjectstoragebucket.infrastructure.cluster.x-k8s.io,admissionReviewVersions=v1

// LinodeObjectStorageBucketCustomValidator struct is responsible for validating the LinodeObjectStorageBucket resource
type LinodeObjectStorageBucketCustomValidator struct{}
Expand Down
2 changes: 1 addition & 1 deletion internal/webhook/v1alpha2/linodeplacementgroup_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func SetupLinodePlacementGroupWebhookWithManager(mgr ctrl.Manager) error {
Complete()
}

// +kubebuilder:webhook:path=/validate-infrastructure-cluster-x-k8s-io-v1alpha2-linodeplacementgroup,mutating=false,failurePolicy=fail,sideEffects=None,groups=infrastructure.cluster.x-k8s.io,resources=linodeplacementgroups,verbs=create;update,versions=v1alpha2,name=vlinodeplacementgroup-v1alpha2.kb.io,admissionReviewVersions=v1
// +kubebuilder:webhook:path=/validate-infrastructure-cluster-x-k8s-io-v1alpha2-linodeplacementgroup,mutating=false,failurePolicy=fail,sideEffects=None,groups=infrastructure.cluster.x-k8s.io,resources=linodeplacementgroups,verbs=create;update,versions=v1alpha2,name=validation.linodeplacementgroup.infrastructure.cluster.x-k8s.io,admissionReviewVersions=v1

// LinodePlacementGroupCustomValidator struct is responsible for validating the LinodePlacementGroup resource
type LinodePlacementGroupCustomValidator struct {
Expand Down

0 comments on commit c1e2684

Please sign in to comment.