Skip to content
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
7 changes: 7 additions & 0 deletions internal/webhook/appwrapper_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import (
const (
AppWrapperUsernameLabel = "workload.codeflare.dev/user"
AppWrapperUserIDLabel = "workload.codeflare.dev/userid"
QueueNameLabel = "kueue.x-k8s.io/queue-name"
)

type AppWrapperWebhook struct {
Expand Down Expand Up @@ -81,6 +82,12 @@ func (w *AppWrapperWebhook) Default(ctx context.Context, obj runtime.Object) err
userInfo := request.UserInfo
username := utils.SanitizeLabel(userInfo.Username)
aw.Labels = utilmaps.MergeKeepFirst(map[string]string{AppWrapperUsernameLabel: username, AppWrapperUserIDLabel: userInfo.UID}, aw.Labels)

// inject default queue name if missing from appwrapper and configured on controller
if w.Config.QueueName != "" && aw.Annotations[QueueNameLabel] == "" && aw.Labels[QueueNameLabel] == "" {
aw.Labels[QueueNameLabel] = w.Config.QueueName
}

return nil
}

Expand Down
1 change: 1 addition & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ type AppWrapperConfig struct {
UserRBACAdmissionCheck bool `json:"userRBACAdmissionCheck,omitempty"`
FaultTolerance *FaultToleranceConfig `json:"faultTolerance,omitempty"`
SchedulerName string `json:"schedulerName,omitempty"`
QueueName string `json:"queueName,omitempty"`
}

type FaultToleranceConfig struct {
Expand Down