Files
open-cluster-management/pkg/cmd/spoke/work.go
Jian Qiu 8c92c70e6d Being able to match multiple items in jsonpath (#202)
This allows a jsonpatch to match multiple items and
returns a list with jsonraw

Signed-off-by: Jian Qiu <jqiu@redhat.com>
2023-07-05 04:32:52 -04:00

30 lines
792 B
Go

package spoke
import (
"context"
"github.com/openshift/library-go/pkg/controller/controllercmd"
"github.com/spf13/cobra"
"open-cluster-management.io/ocm/pkg/version"
"open-cluster-management.io/ocm/pkg/work/spoke"
)
// NewWorkAgent generates a command to start work agent
func NewWorkAgent() *cobra.Command {
o := spoke.NewWorkloadAgentOptions()
cmdConfig := controllercmd.
NewControllerCommandConfig("work-agent", version.Get(), o.RunWorkloadAgent)
cmd := cmdConfig.NewCommandWithContext(context.TODO())
cmd.Use = "agent"
cmd.Short = "Start the Work Agent"
o.AddFlags(cmd)
// add disable leader election flag
flags := cmd.Flags()
flags.BoolVar(&cmdConfig.DisableLeaderElection, "disable-leader-election", false, "Disable leader election for the agent.")
return cmd
}