Documentation ¶
Index ¶
- Constants
- Variables
- func GetDynamicConfig(ctx context.Context, cmd *cobra.Command, name configv1alpha1.ConfigName, ...) error
- func GetNamespace(cmd *cobra.Command) (string, error)
- func GetOutputFormat(cmd *cobra.Command) (printer.OutputFormat, error)
- func NewContext(_ *cobra.Command) (controllercontext.Context, error)
- func NewDisableCommand(streams *streams.Streams) *cobra.Command
- func NewEnableCommand(streams *streams.Streams) *cobra.Command
- func NewGetCommand(streams *streams.Streams) *cobra.Command
- func NewGetJobCommand(streams *streams.Streams) *cobra.Command
- func NewGetJobConfigCommand(streams *streams.Streams) *cobra.Command
- func NewKillCommand(streams *streams.Streams) *cobra.Command
- func NewListCommand(streams *streams.Streams) *cobra.Command
- func NewListJobCommand(streams *streams.Streams) *cobra.Command
- func NewListJobConfigCommand(streams *streams.Streams) *cobra.Command
- func NewRootCommand(streams *streams.Streams) *cobra.Command
- func NewRunCommand(streams *streams.Streams) *cobra.Command
- func PrepareExample(example string) string
- func PrerunWithKubeconfig(cmd *cobra.Command, _ []string) error
- func SetCtrlContext(cc controllercontext.Context)
- func ToRunE(ctx context.Context, executor Runner) func(cmd *cobra.Command, args []string) error
- type DisableCommand
- type EnableCommand
- type GetJobCommand
- type GetJobConfigCommand
- type KillCommand
- type ListJobCommand
- type ListJobConfigCommand
- type RootCommand
- type RunCommand
- type Runner
Constants ¶
const (
// CommandName is the expected entrypoint of the root command.
CommandName = "furiko"
)
Variables ¶
var (
DisableExample = PrepareExample(`
# Disable scheduling for the JobConfig.
{{.CommandName}} disable send-weekly-report`)
)
var (
EnableExample = PrepareExample(`
# Enable scheduling for the JobConfig.
{{.CommandName}} enable send-weekly-report`)
)
var (
GetJobConfigExample = PrepareExample(`
# Get a single JobConfig in the current namespace.
{{.CommandName}} get jobconfig daily-send-email
# Get multiple JobConfigs by name in the current namespace.
{{.CommandName}} get jobconfig daily-send-email weekly-report-email
# Get a single JobConfig in JSON format.
{{.CommandName}} get jobconfig daily-send-email -o json`)
)
var (
GetJobExample = PrepareExample(`
# Get a single Job in the current namespace.
{{.CommandName}} get job job-sample-l6dc6
# Get multiple Jobs by name in the current namespace.
{{.CommandName}} get job job-sample-l6dc6 job-sample-cdwqb
# Get a single Job in JSON format.
{{.CommandName}} get job job-sample-l6dc6 -o json`)
)
var (
KillExample = PrepareExample(`
# Request to kill an ongoing Job.
{{.CommandName}} kill job-sample-1653825000
# Request for an ongoing Job to be killed 60 seconds from now.
{{.CommandName}} kill job-sample-1653825000 -p 60s
# Request for an ongoing Job to be killed at a specific time in the future.
{{.CommandName}} kill job-sample-1653825000 -t 2023-01-01T00:00:00Z`)
)
var (
ListJobConfigExample = PrepareExample(`
# List all JobConfigs in current namespace.
{{.CommandName}} list jobconfig
# List all JobConfigs in JSON format.
{{.CommandName}} list jobconfig -o json`)
)
var (
ListJobExample = PrepareExample(`
# List all Jobs in current namespace.
{{.CommandName}} list job
# List all Jobs in current namespace belonging to JobConfig "daily-send-email".
{{.CommandName}} list job --for daily-send-email
# List all Jobs in JSON format.
{{.CommandName}} list job -o json`)
)
var (
RunExample = PrepareExample(`
# Start a new Job from an existing JobConfig.
{{.CommandName}} run daily-send-email
# Start a new Job only after the specified time.
{{.CommandName}} run daily-send-email --at 2021-01-01T00:00:00+08:00
# Start a new Job, and use all default options.
{{.CommandName}} run daily-send-email --use-default-options`)
)
Functions ¶
func GetDynamicConfig ¶
func GetDynamicConfig(ctx context.Context, cmd *cobra.Command, name configv1alpha1.ConfigName, out interface{}) error
GetDynamicConfig loads the dynamic config by name and unmarshals to out. TODO(irvinlim): If the current user does not have permissions to read the
ConfigMap, or the ConfigMap uses a different name/namespace, we should gracefully handle this case.
func GetNamespace ¶
GetNamespace returns the namespace to use depending on what was defined in the flags.
func GetOutputFormat ¶
func GetOutputFormat(cmd *cobra.Command) (printer.OutputFormat, error)
GetOutputFormat returns the output format as parsed by the flag.
func NewContext ¶
func NewContext(_ *cobra.Command) (controllercontext.Context, error)
NewContext returns a common context from the cobra command.
func NewDisableCommand ¶ added in v0.2.0
func NewEnableCommand ¶ added in v0.2.0
func NewListJobConfigCommand ¶
func NewRootCommand ¶
NewRootCommand returns a new root command for the command-line utility.
func PrepareExample ¶
PrepareExample replaces the root command name and indents all lines.
func PrerunWithKubeconfig ¶
PrerunWithKubeconfig is a pre-run function that will set up the common context when kubeconfig is needed. TODO(irvinlim): We currently reuse controllercontext, but most of it is unusable for CLI interfaces.
We should create a new common context as needed.
func SetCtrlContext ¶
func SetCtrlContext(cc controllercontext.Context)
SetCtrlContext explicitly sets the common context.
Types ¶
type DisableCommand ¶ added in v0.2.0
type DisableCommand struct {
// contains filtered or unexported fields
}
type EnableCommand ¶ added in v0.2.0
type EnableCommand struct {
// contains filtered or unexported fields
}
type GetJobCommand ¶
type GetJobCommand struct {
// contains filtered or unexported fields
}
func (*GetJobCommand) PrintJobs ¶
func (c *GetJobCommand) PrintJobs(output printer.OutputFormat, jobs []*execution.Job) error
type GetJobConfigCommand ¶
type GetJobConfigCommand struct {
// contains filtered or unexported fields
}
func (*GetJobConfigCommand) PrintJobConfigs ¶
func (c *GetJobConfigCommand) PrintJobConfigs( ctx context.Context, cmd *cobra.Command, output printer.OutputFormat, jobConfigs []*execution.JobConfig, ) error
type KillCommand ¶ added in v0.2.0
type KillCommand struct {
// contains filtered or unexported fields
}
type ListJobCommand ¶
type ListJobCommand struct {
// contains filtered or unexported fields
}
func (*ListJobCommand) PrintJobs ¶
func (c *ListJobCommand) PrintJobs(output printer.OutputFormat, jobList *execution.JobList) error
type ListJobConfigCommand ¶
type ListJobConfigCommand struct {
// contains filtered or unexported fields
}
func (*ListJobConfigCommand) PrintJobConfigs ¶
func (c *ListJobConfigCommand) PrintJobConfigs( output printer.OutputFormat, jobConfigList *execution.JobConfigList, ) error
type RootCommand ¶
type RootCommand struct {
// contains filtered or unexported fields
}
func (*RootCommand) PersistentPreRunE ¶
func (c *RootCommand) PersistentPreRunE(cmd *cobra.Command, args []string) error
type RunCommand ¶
type RunCommand struct {
// contains filtered or unexported fields
}