@@ -27,6 +27,7 @@ import (
2727 "k8s.io/utils/pointer"
2828 ctrl "sigs.k8s.io/controller-runtime"
2929 logf "sigs.k8s.io/controller-runtime/pkg/log"
30+ "sigs.k8s.io/controller-runtime/pkg/webhook"
3031 "sigs.k8s.io/controller-runtime/pkg/webhook/admission"
3132
3233 "github.com/project-codeflare/codeflare-operator/pkg/config"
@@ -36,14 +37,13 @@ import (
3637var rayclusterlog = logf .Log .WithName ("raycluster-resource" )
3738
3839func SetupRayClusterWebhookWithManager (mgr ctrl.Manager , cfg * config.KubeRayConfiguration ) error {
40+ rayClusterWebhookInstance := & rayClusterWebhook {
41+ Config : cfg ,
42+ }
3943 return ctrl .NewWebhookManagedBy (mgr ).
4044 For (& rayv1.RayCluster {}).
41- WithDefaulter (& rayClusterWebhook {
42- Config : cfg ,
43- }).
44- WithValidator (& rayClusterWebhook {
45- Config : cfg ,
46- }).
45+ WithDefaulter (rayClusterWebhookInstance ).
46+ WithValidator (rayClusterWebhookInstance ).
4747 Complete ()
4848}
4949
@@ -54,6 +54,9 @@ type rayClusterWebhook struct {
5454 Config * config.KubeRayConfiguration
5555}
5656
57+ var _ webhook.CustomDefaulter = & rayClusterWebhook {}
58+ var _ webhook.CustomValidator = & rayClusterWebhook {}
59+
5760// Default implements webhook.Defaulter so a webhook will be registered for the type
5861func (w * rayClusterWebhook ) Default (ctx context.Context , obj runtime.Object ) error {
5962 raycluster := obj .(* rayv1.RayCluster )
0 commit comments