Skip to content

Commit 41d2cb1

Browse files
committed
simplify configuration of default queue
1 parent 7ec3c3e commit 41d2cb1

File tree

7 files changed

+14
-22
lines changed

7 files changed

+14
-22
lines changed

config/default/config.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ data:
66
config.yaml: |
77
appwrapper:
88
enableKueueIntegrations: true
9-
manageJobsWithoutQueueName: true
109
controllerManager:
1110
health:
1211
bindAddress: ":8081"

config/dev/config.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ data:
66
config.yaml: |
77
appwrapper:
88
enableKueueIntegrations: true
9-
manageJobsWithoutQueueName: true
109
controllerManager:
1110
health:
1211
bindAddress: "localhost:0"

config/standalone/config.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ data:
66
config.yaml: |
77
appwrapper:
88
enableKueueIntegrations: false
9-
manageJobsWithoutQueueName: false
109
controllerManager:
1110
health:
1211
bindAddress: ":8081"

internal/webhook/appwrapper_webhook.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,10 @@ func (w *AppWrapperWebhook) Default(ctx context.Context, obj runtime.Object) err
7272

7373
// Queue name and Suspend
7474
if w.Config.EnableKueueIntegrations {
75-
if w.Config.QueueName != "" && aw.Annotations[QueueNameLabel] == "" && aw.Labels[QueueNameLabel] == "" {
76-
if aw.Labels == nil {
77-
aw.Labels = map[string]string{}
78-
}
79-
aw.Labels[QueueNameLabel] = w.Config.QueueName
75+
if w.Config.DefaultQueueName != "" {
76+
aw.Labels = utilmaps.MergeKeepFirst(aw.Labels, map[string]string{QueueNameLabel: w.Config.DefaultQueueName})
8077
}
81-
jobframework.ApplyDefaultForSuspend((*wlc.AppWrapper)(aw), w.Config.ManageJobsWithoutQueueName)
78+
jobframework.ApplyDefaultForSuspend((*wlc.AppWrapper)(aw), false)
8279
}
8380

8481
// inject labels with user name and id

internal/webhook/suite_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ var _ = BeforeSuite(func() {
160160
Expect(err).NotTo(HaveOccurred())
161161

162162
conf := config.NewAppWrapperConfig()
163-
conf.QueueName = defaultQueueName // add default queue name
163+
conf.DefaultQueueName = defaultQueueName // add default queue name
164164
err = (&AppWrapperWebhook{Config: conf}).SetupWebhookWithManager(mgr)
165165
Expect(err).NotTo(HaveOccurred())
166166

pkg/config/config.go

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,12 @@ type OperatorConfig struct {
2929
}
3030

3131
type AppWrapperConfig struct {
32-
ManageJobsWithoutQueueName bool `json:"manageJobsWithoutQueueName,omitempty"`
33-
EnableKueueIntegrations bool `json:"enableKueueIntegrations,omitempty"`
34-
DisableChildAdmissionCtrl bool `json:"disableChildAdmissionCtrl,omitempty"`
35-
UserRBACAdmissionCheck bool `json:"userRBACAdmissionCheck,omitempty"`
36-
FaultTolerance *FaultToleranceConfig `json:"faultTolerance,omitempty"`
37-
SchedulerName string `json:"schedulerName,omitempty"`
38-
QueueName string `json:"queueName,omitempty"`
32+
EnableKueueIntegrations bool `json:"enableKueueIntegrations,omitempty"`
33+
DisableChildAdmissionCtrl bool `json:"disableChildAdmissionCtrl,omitempty"`
34+
UserRBACAdmissionCheck bool `json:"userRBACAdmissionCheck,omitempty"`
35+
FaultTolerance *FaultToleranceConfig `json:"faultTolerance,omitempty"`
36+
SchedulerName string `json:"schedulerName,omitempty"`
37+
DefaultQueueName string `json:"defaultQueueName,omitempty"`
3938
}
4039

4140
type FaultToleranceConfig struct {
@@ -79,10 +78,9 @@ type HealthConfiguration struct {
7978
// NewAppWrapperConfig constructs an AppWrapperConfig and fills in default values
8079
func NewAppWrapperConfig() *AppWrapperConfig {
8180
return &AppWrapperConfig{
82-
ManageJobsWithoutQueueName: true,
83-
EnableKueueIntegrations: true,
84-
DisableChildAdmissionCtrl: false,
85-
UserRBACAdmissionCheck: true,
81+
EnableKueueIntegrations: true,
82+
DisableChildAdmissionCtrl: false,
83+
UserRBACAdmissionCheck: true,
8684
FaultTolerance: &FaultToleranceConfig{
8785
AdmissionGracePeriod: 1 * time.Minute,
8886
WarmupGracePeriod: 5 * time.Minute,

pkg/controller/setup.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func SetupControllers(mgr ctrl.Manager, awConfig *config.AppWrapperConfig) error
4242
if err := workload.WorkloadReconciler(
4343
mgr.GetClient(),
4444
mgr.GetEventRecorderFor("kueue"),
45-
jobframework.WithManageJobsWithoutQueueName(awConfig.ManageJobsWithoutQueueName),
45+
jobframework.WithManageJobsWithoutQueueName(false),
4646
).SetupWithManager(mgr); err != nil {
4747
return fmt.Errorf("workload controller: %w", err)
4848
}

0 commit comments

Comments
 (0)