Files
open-cluster-management/pkg/cmd/hub/operator.go
Jian Zhu a5757b46f3
Some checks failed
Scorecard supply-chain security / Scorecard analysis (push) Failing after 2m36s
Post / coverage (push) Failing after 35m17s
Post / images (amd64) (push) Failing after 8m34s
Post / images (arm64) (push) Failing after 8m7s
Post / image manifest (push) Has been skipped
Post / trigger clusteradm e2e (push) Has been skipped
Close stale issues and PRs / stale (push) Successful in 56s
Fix typo description of the cluster manager operator flags (#1044)
Signed-off-by: zhujian <jiazhu@redhat.com>
2025-06-19 08:06:21 +00:00

36 lines
1.4 KiB
Go

package hub
import (
"context"
"github.com/spf13/cobra"
"k8s.io/utils/clock"
commonoptions "open-cluster-management.io/ocm/pkg/common/options"
"open-cluster-management.io/ocm/pkg/operator/operators/clustermanager"
"open-cluster-management.io/ocm/pkg/version"
)
// NewHubOperatorCmd generate a command to start hub operator
func NewHubOperatorCmd() *cobra.Command {
opts := commonoptions.NewOptions()
cmOptions := clustermanager.Options{}
cmd := opts.
NewControllerCommandConfig("clustermanager", version.Get(), cmOptions.RunClusterManagerOperator, clock.RealClock{}).
NewCommandWithContext(context.TODO())
cmd.Use = "hub"
cmd.Short = "Start the cluster manager operator"
flags := cmd.Flags()
flags.BoolVar(&cmOptions.SkipRemoveCRDs, "skip-remove-crds", false, "Skip removing CRDs while ClusterManager is deleting.")
flags.StringVar(&cmOptions.ControlPlaneNodeLabelSelector, "control-plane-node-label-selector",
"node-role.kubernetes.io/master=", "control plane node labels, "+
"e.g. 'environment=production', 'tier notin (frontend,backend)'")
flags.Int32Var(&cmOptions.DeploymentReplicas, "deployment-replicas", 0,
"Number of deployment replicas, operator will automatically determine replicas if not set")
flags.BoolVar(&cmOptions.EnableSyncLabels, "enable-sync-labels", false,
"If set, will sync the labels of ClusterManager CR to all hub resources")
opts.AddFlags(flags)
return cmd
}