Skip to content

Commit

Permalink
Review Remarks
Browse files Browse the repository at this point in the history
  • Loading branch information
trasc committed Mar 19, 2024
1 parent 42e1363 commit 09d7cec
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions cmd/importer/main.go
Expand Up @@ -48,8 +48,8 @@ const (
BurstFlag = "burst"
VerbosityFlag = "verbose"
VerboseFlagShort = "v"
JobsFlag = "jobs"
JobsFlagShort = "j"
ConcurrencyFlag = "concurrent-workers"
ConcurrencyFlagShort = "c"
DryRunFlag = "dry-run"
AddLabelsFlag = "add-labels"
)
Expand Down Expand Up @@ -79,7 +79,7 @@ func setFlags(cmd *cobra.Command) {
cmd.Flags().String(QueueMappingFileFlag, "", "yaml file containing extra mappings from \""+QueueLabelFlag+"\" label values to local queue names")
cmd.Flags().Float32(QPSFlag, 50, "client QPS, as described in https://kubernetes.io/docs/reference/config-api/apiserver-eventratelimit.v1alpha1/#eventratelimit-admission-k8s-io-v1alpha1-Limit")
cmd.Flags().Int(BurstFlag, 50, "client Burst, as described in https://kubernetes.io/docs/reference/config-api/apiserver-eventratelimit.v1alpha1/#eventratelimit-admission-k8s-io-v1alpha1-Limit")
cmd.Flags().UintP(JobsFlag, JobsFlagShort, 8, "number of concurrent import workers")
cmd.Flags().UintP(ConcurrencyFlag, ConcurrencyFlagShort, 8, "number of concurrent import workers")
cmd.Flags().Bool(DryRunFlag, true, "don't import, check the config only")

_ = cmd.MarkFlagRequired(QueueLabelFlag)
Expand Down Expand Up @@ -198,7 +198,7 @@ func getKubeClient(cmd *cobra.Command) (client.Client, error) {
func importCmd(cmd *cobra.Command, _ []string) error {
log := ctrl.Log.WithName("import")
ctx := ctrl.LoggerInto(context.Background(), log)
jobs, _ := cmd.Flags().GetUint(JobsFlag)
cWorkers, _ := cmd.Flags().GetUint(ConcurrencyFlag)
c, err := getKubeClient(cmd)
if err != nil {
return err
Expand All @@ -209,13 +209,13 @@ func importCmd(cmd *cobra.Command, _ []string) error {
return err
}

if err = pod.Check(ctx, c, cache, jobs); err != nil {
if err = pod.Check(ctx, c, cache, cWorkers); err != nil {
return err
}

if dr, _ := cmd.Flags().GetBool(DryRunFlag); dr {
fmt.Printf("%q is enabled by default, use \"--%s=false\" to continue with the import\n", DryRunFlag, DryRunFlag)
return nil
}
return pod.Import(ctx, c, cache, jobs)
return pod.Import(ctx, c, cache, cWorkers)
}

0 comments on commit 09d7cec

Please sign in to comment.