Skip to content

Commit

Permalink
*: add --runner-sa flag to rg server subcmd
Browse files Browse the repository at this point in the history
It's used to override existing runner group's server account.

Signed-off-by: Wei Fu <weifu@microsoft.com>
  • Loading branch information
fuweid committed Jan 29, 2024
1 parent e5c5ff0 commit 69a9708
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
13 changes: 13 additions & 0 deletions cmd/kperf/commands/runnergroup/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ var serverCommand = cli.Command{
Name: "runner-owner",
Usage: "The runners depend on this object (FORMAT: APIVersion:Kind:Name:UID)",
},
cli.StringFlag{
Name: "runner-sa",
Usage: "Override runner group's service account",
},
cli.StringSliceFlag{
Name: "address",
Usage: "Address for the server",
Expand Down Expand Up @@ -89,6 +93,11 @@ func buildRunnerGroupHandlers(cliCtx *cli.Context, serverName string) ([]*runner
ownerRef = cliCtx.String("runner-owner")
}

sa := ""
if cliCtx.IsSet("runner-sa") {
sa = cliCtx.String("runner-sa")
}

groups := make([]*runnergroup.Handler, 0, len(specURIs))
for idx, specURI := range specURIs {
spec, err := runnergroup.NewRunnerGroupSpecFromURI(clientset, specURI)
Expand All @@ -100,6 +109,10 @@ func buildRunnerGroupHandlers(cliCtx *cli.Context, serverName string) ([]*runner
spec.OwnerReference = &ownerRef
}

if sa != "" {
spec.ServiceAccount = &sa
}

groupName := fmt.Sprintf("%s-%d", serverName, idx)
g, err := runnergroup.NewHandler(clientset, namespace, groupName, spec, imgRef)
if err != nil {
Expand Down
2 changes: 2 additions & 0 deletions manifests/runnergroup/server/templates/pod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ spec:
- {{ .Values.image }}
- --runner-owner
- v1:Pod:$(POD_NAME):$(POD_UID)
- --runner-sa
- {{ .Values.name }}
- --address
- $(POD_IP):8080
- --address
Expand Down

0 comments on commit 69a9708

Please sign in to comment.