-
Notifications
You must be signed in to change notification settings - Fork 13
/
operator_command.go
46 lines (44 loc) · 1.7 KB
/
operator_command.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package main
import (
"github.com/ccremer/clustercode/pkg/operator"
"github.com/ccremer/clustercode/pkg/operator/blueprintcontroller"
"github.com/ccremer/clustercode/pkg/operator/taskcontroller"
"github.com/urfave/cli/v2"
)
func newOperatorCommand() *cli.Command {
command := &operator.Command{}
return &cli.Command{
Name: "operator",
Usage: "Start clustercode in operator mode",
Before: LogMetadata,
Action: func(ctx *cli.Context) error {
command.Log = AppLogger(ctx).WithName(ctx.Command.Name)
blueprintcontroller.ScanRoleKind = ctx.String(newScanRoleKindFlag().Name)
return command.Execute(ctx.Context)
},
Flags: []cli.Flag{
&cli.BoolFlag{Name: "leader-election-enabled", Value: false, EnvVars: envVars("LEADER_ELECTION_ENABLED"),
Usage: "Use leader election for the controller manager.",
Destination: &command.LeaderElectionEnabled,
Category: "Operator",
},
&cli.StringFlag{Name: "clustercode-image", EnvVars: envVars("CLUSTERCODE_IMAGE"),
Usage: "Container image to be used when launching Clustercode jobs.",
Destination: &blueprintcontroller.DefaultClusterCodeContainerImage,
Category: "Encoding", Required: true,
},
&cli.StringFlag{Name: "ffmpeg-image", EnvVars: envVars("FFMPEG_IMAGE"),
Usage: "Container image to be used when launching Ffmpeg jobs.",
Destination: &taskcontroller.DefaultFfmpegContainerImage,
Category: "Encoding", Required: true,
},
newScanRoleKindFlag(),
&cli.StringFlag{Name: "scan-role-name", EnvVars: envVars("SCAN_ROLE_NAME"),
Usage: "TODO",
Value: "clustercode-edit",
Destination: &blueprintcontroller.ScanRoleName,
Category: "Encoding",
},
},
}
}