mirror of
https://github.com/open-cluster-management-io/ocm.git
synced 2026-05-14 05:07:48 +00:00
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
Signed-off-by: Jian Qiu <jqiu@redhat.com>
33 lines
1.1 KiB
Go
33 lines
1.1 KiB
Go
package webhook
|
|
|
|
import (
|
|
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
|
|
_ "k8s.io/client-go/plugin/pkg/client/auth"
|
|
|
|
ocmfeature "open-cluster-management.io/api/feature"
|
|
workv1 "open-cluster-management.io/api/work/v1"
|
|
workv1alpha1 "open-cluster-management.io/api/work/v1alpha1"
|
|
|
|
commonoptions "open-cluster-management.io/ocm/pkg/common/options"
|
|
"open-cluster-management.io/ocm/pkg/features"
|
|
"open-cluster-management.io/ocm/pkg/work/webhook/common"
|
|
webhookv1 "open-cluster-management.io/ocm/pkg/work/webhook/v1"
|
|
webhookv1alpha1 "open-cluster-management.io/ocm/pkg/work/webhook/v1alpha1"
|
|
)
|
|
|
|
func (c *Options) SetupWebhookServer(opts *commonoptions.WebhookOptions) error {
|
|
common.ManifestValidator.WithLimit(c.ManifestLimit)
|
|
if err := opts.InstallScheme(
|
|
clientgoscheme.AddToScheme,
|
|
workv1.Install,
|
|
workv1alpha1.Install,
|
|
); err != nil {
|
|
return err
|
|
}
|
|
opts.InstallWebhook(&webhookv1.ManifestWorkWebhook{})
|
|
if features.HubMutableFeatureGate.Enabled(ocmfeature.ManifestWorkReplicaSet) {
|
|
opts.InstallWebhook(&webhookv1alpha1.ManifestWorkReplicaSetWebhook{})
|
|
}
|
|
return nil
|
|
}
|