Skip to content

Commit

Permalink
commands: sched: pass through scoringStrategy config
Browse files Browse the repository at this point in the history
We need to pass the data in all the flows,
not just on the render flow.

Signed-off-by: Francesco Romani <[email protected]>
  • Loading branch information
ffromani committed Feb 22, 2024
1 parent 7415477 commit ffdce3e
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 37 deletions.
17 changes: 9 additions & 8 deletions pkg/commands/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,15 @@ func NewDeploySchedulerPluginCommand(env *deployer.Environment, commonOpts *opti

env.Log.Info("detection", "platform", commonOpts.ClusterPlatform, "reason", reason, "version", commonOpts.ClusterVersion, "source", source)
return sched.Deploy(env, options.Scheduler{
Platform: commonOpts.ClusterPlatform,
WaitCompletion: commonOpts.WaitCompletion,
Replicas: int32(commonOpts.Replicas),
PullIfNotPresent: commonOpts.PullIfNotPresent,
ProfileName: commonOpts.SchedProfileName,
CacheResyncPeriod: commonOpts.SchedResyncPeriod,
CtrlPlaneAffinity: commonOpts.SchedCtrlPlaneAffinity,
Verbose: commonOpts.SchedVerbose,
Platform: commonOpts.ClusterPlatform,
WaitCompletion: commonOpts.WaitCompletion,
Replicas: int32(commonOpts.Replicas),
PullIfNotPresent: commonOpts.PullIfNotPresent,
ProfileName: commonOpts.SchedProfileName,
CacheResyncPeriod: commonOpts.SchedResyncPeriod,
CtrlPlaneAffinity: commonOpts.SchedCtrlPlaneAffinity,
Verbose: commonOpts.SchedVerbose,
ScoringStratConfigData: commonOpts.SchedScoringStratConfigData,
})
},
Args: cobra.NoArgs,
Expand Down
33 changes: 18 additions & 15 deletions pkg/commands/remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,15 @@ func NewRemoveCommand(env *deployer.Environment, commonOpts *options.Options) *c
env.Log.Info("detection", "platform", commonOpts.ClusterPlatform, "reason", reason, "version", commonOpts.ClusterVersion, "source", source)

err = sched.Remove(env, options.Scheduler{
Platform: commonOpts.ClusterPlatform,
WaitCompletion: commonOpts.WaitCompletion,
Replicas: int32(commonOpts.Replicas),
PullIfNotPresent: commonOpts.PullIfNotPresent,
ProfileName: commonOpts.SchedProfileName,
CacheResyncPeriod: commonOpts.SchedResyncPeriod,
CtrlPlaneAffinity: commonOpts.SchedCtrlPlaneAffinity,
Platform: commonOpts.ClusterPlatform,
WaitCompletion: commonOpts.WaitCompletion,
Replicas: int32(commonOpts.Replicas),
PullIfNotPresent: commonOpts.PullIfNotPresent,
ProfileName: commonOpts.SchedProfileName,
CacheResyncPeriod: commonOpts.SchedResyncPeriod,
CtrlPlaneAffinity: commonOpts.SchedCtrlPlaneAffinity,
Verbose: commonOpts.SchedVerbose,
ScoringStratConfigData: commonOpts.SchedScoringStratConfigData,
})
if err != nil {
// intentionally keep going to remove as much as possible
Expand Down Expand Up @@ -153,14 +155,15 @@ func NewRemoveSchedulerPluginCommand(env *deployer.Environment, commonOpts *opti

env.Log.Info("detection", "platform", commonOpts.ClusterPlatform, "reason", reason, "version", commonOpts.ClusterVersion, "source", source)
return sched.Remove(env, options.Scheduler{
Platform: commonOpts.ClusterPlatform,
WaitCompletion: commonOpts.WaitCompletion,
Replicas: int32(commonOpts.Replicas),
PullIfNotPresent: commonOpts.PullIfNotPresent,
ProfileName: commonOpts.SchedProfileName,
CacheResyncPeriod: commonOpts.SchedResyncPeriod,
CtrlPlaneAffinity: commonOpts.SchedCtrlPlaneAffinity,
Verbose: commonOpts.SchedVerbose,
Platform: commonOpts.ClusterPlatform,
WaitCompletion: commonOpts.WaitCompletion,
Replicas: int32(commonOpts.Replicas),
PullIfNotPresent: commonOpts.PullIfNotPresent,
ProfileName: commonOpts.SchedProfileName,
CacheResyncPeriod: commonOpts.SchedResyncPeriod,
CtrlPlaneAffinity: commonOpts.SchedCtrlPlaneAffinity,
Verbose: commonOpts.SchedVerbose,
ScoringStratConfigData: commonOpts.SchedScoringStratConfigData,
})
},
Args: cobra.NoArgs,
Expand Down
13 changes: 7 additions & 6 deletions pkg/commands/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,13 @@ func RenderManifests(env *deployer.Environment, commonOpts *options.Options) err
}

schedRenderOpts := options.Scheduler{
Replicas: int32(commonOpts.Replicas),
PullIfNotPresent: commonOpts.PullIfNotPresent,
ProfileName: commonOpts.SchedProfileName,
CacheResyncPeriod: commonOpts.SchedResyncPeriod,
CtrlPlaneAffinity: commonOpts.SchedCtrlPlaneAffinity,
Verbose: commonOpts.SchedVerbose,
Replicas: int32(commonOpts.Replicas),
PullIfNotPresent: commonOpts.PullIfNotPresent,
ProfileName: commonOpts.SchedProfileName,
CacheResyncPeriod: commonOpts.SchedResyncPeriod,
CtrlPlaneAffinity: commonOpts.SchedCtrlPlaneAffinity,
Verbose: commonOpts.SchedVerbose,
ScoringStratConfigData: commonOpts.SchedScoringStratConfigData,
}

schedObjs, err := schedManifests.Render(env.Log, schedRenderOpts)
Expand Down
17 changes: 9 additions & 8 deletions pkg/deploy/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,15 @@ func OnCluster(env *deployer.Environment, commonOpts *options.Options) error {
return err
}
if err := sched.Deploy(env, options.Scheduler{
Platform: commonOpts.ClusterPlatform,
WaitCompletion: commonOpts.WaitCompletion,
Replicas: int32(commonOpts.Replicas),
PullIfNotPresent: commonOpts.PullIfNotPresent,
ProfileName: commonOpts.SchedProfileName,
CacheResyncPeriod: commonOpts.SchedResyncPeriod,
CtrlPlaneAffinity: commonOpts.SchedCtrlPlaneAffinity,
Verbose: commonOpts.SchedVerbose,
Platform: commonOpts.ClusterPlatform,
WaitCompletion: commonOpts.WaitCompletion,
Replicas: int32(commonOpts.Replicas),
PullIfNotPresent: commonOpts.PullIfNotPresent,
ProfileName: commonOpts.SchedProfileName,
CacheResyncPeriod: commonOpts.SchedResyncPeriod,
CtrlPlaneAffinity: commonOpts.SchedCtrlPlaneAffinity,
Verbose: commonOpts.SchedVerbose,
ScoringStratConfigData: commonOpts.SchedScoringStratConfigData,
}); err != nil {
return err
}
Expand Down

0 comments on commit ffdce3e

Please sign in to comment.