mirror of
https://github.com/open-cluster-management-io/ocm.git
synced 2026-05-06 01:07:03 +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>
32 lines
787 B
Go
32 lines
787 B
Go
package webhook
|
|
|
|
import (
|
|
"github.com/spf13/cobra"
|
|
ctrl "sigs.k8s.io/controller-runtime"
|
|
|
|
commonoptions "open-cluster-management.io/ocm/pkg/common/options"
|
|
_ "open-cluster-management.io/ocm/pkg/features"
|
|
"open-cluster-management.io/ocm/pkg/work/webhook"
|
|
)
|
|
|
|
func NewWorkWebhook() *cobra.Command {
|
|
webhookOptions := commonoptions.NewWebhookOptions()
|
|
opts := webhook.NewOptions()
|
|
cmd := &cobra.Command{
|
|
Use: "webhook-server",
|
|
Short: "Start the work webhook server",
|
|
RunE: func(c *cobra.Command, args []string) error {
|
|
if err := opts.SetupWebhookServer(webhookOptions); err != nil {
|
|
return err
|
|
}
|
|
return webhookOptions.RunWebhookServer(ctrl.SetupSignalHandler())
|
|
},
|
|
}
|
|
|
|
flags := cmd.Flags()
|
|
webhookOptions.AddFlags(flags)
|
|
opts.AddFlags(flags)
|
|
|
|
return cmd
|
|
}
|