Skip to content

Flexible configuration of Kueue's GenericJob Reconciller #184

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ package config
import (
"fmt"
"time"

"sigs.k8s.io/kueue/apis/config/v1beta1"
)

type OperatorConfig struct {
Expand All @@ -31,12 +33,19 @@ type OperatorConfig struct {
type AppWrapperConfig struct {
EnableKueueIntegrations bool `json:"enableKueueIntegrations,omitempty"`
DisableChildAdmissionCtrl bool `json:"disableChildAdmissionCtrl,omitempty"`
KueueJobReconciller *KueueJobReconciller `json:"kueueJobReconciller,omitempty"`
UserRBACAdmissionCheck bool `json:"userRBACAdmissionCheck,omitempty"`
FaultTolerance *FaultToleranceConfig `json:"faultTolerance,omitempty"`
SchedulerName string `json:"schedulerName,omitempty"`
DefaultQueueName string `json:"defaultQueueName,omitempty"`
}

type KueueJobReconciller struct {
ManageJobsWithoutQueueName bool `json:"manageJobsWithoutQueueName,omitempty"`
WaitForPodsReady *v1beta1.WaitForPodsReady `json:"waitForPodsReady,omitempty"`
LabelKeysToCopy []string `json:"labelKeysToCopy,omitempty"`
}

type FaultToleranceConfig struct {
AdmissionGracePeriod time.Duration `json:"admissionGracePeriod,omitempty"`
WarmupGracePeriod time.Duration `json:"warmupGracePeriod,omitempty"`
Expand Down Expand Up @@ -80,7 +89,12 @@ func NewAppWrapperConfig() *AppWrapperConfig {
return &AppWrapperConfig{
EnableKueueIntegrations: true,
DisableChildAdmissionCtrl: true,
UserRBACAdmissionCheck: true,
KueueJobReconciller: &KueueJobReconciller{
ManageJobsWithoutQueueName: true,
WaitForPodsReady: &v1beta1.WaitForPodsReady{Enable: true},
LabelKeysToCopy: []string{},
},
UserRBACAdmissionCheck: true,
FaultTolerance: &FaultToleranceConfig{
AdmissionGracePeriod: 1 * time.Minute,
WarmupGracePeriod: 5 * time.Minute,
Expand Down
6 changes: 3 additions & 3 deletions pkg/controller/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import (
"github.com/project-codeflare/appwrapper/internal/webhook"
"github.com/project-codeflare/appwrapper/pkg/config"

"sigs.k8s.io/kueue/apis/config/v1beta1"
"sigs.k8s.io/kueue/pkg/controller/jobframework"
)

Expand All @@ -43,8 +42,9 @@ func SetupControllers(mgr ctrl.Manager, awConfig *config.AppWrapperConfig) error
if err := workload.WorkloadReconciler(
mgr.GetClient(),
mgr.GetEventRecorderFor("kueue"),
jobframework.WithManageJobsWithoutQueueName(true),
jobframework.WithWaitForPodsReady(&v1beta1.WaitForPodsReady{Enable: true}),
jobframework.WithManageJobsWithoutQueueName(awConfig.KueueJobReconciller.ManageJobsWithoutQueueName),
jobframework.WithWaitForPodsReady(awConfig.KueueJobReconciller.WaitForPodsReady),
jobframework.WithLabelKeysToCopy(awConfig.KueueJobReconciller.LabelKeysToCopy),
).SetupWithManager(mgr); err != nil {
return fmt.Errorf("workload controller: %w", err)
}
Expand Down