Files
Jian Qiu 588f82f48b
Some checks failed
Scorecard supply-chain security / Scorecard analysis (push) Failing after 1m26s
Post / coverage (push) Failing after 39m1s
Post / images (amd64) (push) Failing after 8m21s
Post / images (arm64) (push) Failing after 7m47s
Post / image manifest (push) Has been skipped
Post / trigger clusteradm e2e (push) Has been skipped
Close stale issues and PRs / stale (push) Successful in 47s
Refactor webhook to use a common webhook option (#1096)
Signed-off-by: Jian Qiu <jqiu@redhat.com>
2025-07-29 07:38:59 +00:00

27 lines
702 B
Go

package webhook
import (
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
clusterv1 "open-cluster-management.io/api/cluster/v1"
commonoptions "open-cluster-management.io/ocm/pkg/common/options"
internalv1 "open-cluster-management.io/ocm/pkg/registration/webhook/v1"
internalv1beta2 "open-cluster-management.io/ocm/pkg/registration/webhook/v1beta2"
)
func SetupWebhookServer(opts *commonoptions.WebhookOptions) error {
if err := opts.InstallScheme(
clientgoscheme.AddToScheme,
clusterv1.Install,
internalv1beta2.Install,
); err != nil {
return err
}
opts.InstallWebhook(
&internalv1.ManagedClusterWebhook{},
&internalv1beta2.ManagedClusterSetBindingWebhook{})
return nil
}