-
Notifications
You must be signed in to change notification settings - Fork 299
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
Add labels for workload parent #1032
Changes from all commits
fb1a28d
2478cbd
866a09a
0350ad8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -24,6 +24,7 @@ import ( | |||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||||||
"k8s.io/apimachinery/pkg/types" | ||||||
"k8s.io/apimachinery/pkg/util/sets" | ||||||
"k8s.io/apimachinery/pkg/util/validation" | ||||||
"k8s.io/client-go/tools/record" | ||||||
"k8s.io/utils/pointer" | ||||||
ctrl "sigs.k8s.io/controller-runtime" | ||||||
|
@@ -456,19 +457,33 @@ func (r *JobReconciler) stopJob(ctx context.Context, job GenericJob, object clie | |||||
|
||||||
// constructWorkload will derive a workload from the corresponding job. | ||||||
func (r *JobReconciler) constructWorkload(ctx context.Context, job GenericJob, object client.Object) (*kueue.Workload, error) { | ||||||
log := ctrl.LoggerFrom(ctx) | ||||||
|
||||||
podSets := job.PodSets() | ||||||
|
||||||
wl := &kueue.Workload{ | ||||||
ObjectMeta: metav1.ObjectMeta{ | ||||||
Name: GetWorkloadNameForOwnerWithGVK(object.GetName(), job.GetGVK()), | ||||||
Namespace: object.GetNamespace(), | ||||||
Labels: map[string]string{}, | ||||||
}, | ||||||
Spec: kueue.WorkloadSpec{ | ||||||
PodSets: resetMinCounts(podSets), | ||||||
QueueName: QueueName(job), | ||||||
}, | ||||||
} | ||||||
|
||||||
jobUid := string(job.Object().GetUID()) | ||||||
if errs := validation.IsValidLabelValue(jobUid); len(errs) == 0 { | ||||||
wl.Labels[controllerconsts.JobUIDLabel] = jobUid | ||||||
} else { | ||||||
log.V(2).Info( | ||||||
"Validation of the owner job UID label has failed. Creating workload without the label.", | ||||||
"ValidationErrors", errs, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ahhhh, that's why the value is not present either |
||||||
"LabelValue", jobUid, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this will probably already be part of the error, so no need to include again. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the log message, that I'm getting while unit testing:
Label is not included in the error here. |
||||||
) | ||||||
} | ||||||
|
||||||
priorityClassName, p, err := r.extractPriority(ctx, podSets, job) | ||||||
if err != nil { | ||||||
return nil, err | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.