Skip to content

Commit

Permalink
Remarks
Browse files Browse the repository at this point in the history
  • Loading branch information
mimowo committed Mar 3, 2023
1 parent 015e75f commit 4dc53e4
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
3 changes: 3 additions & 0 deletions pkg/controller/workload/mpijob/mpijob_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,9 @@ func ConstructWorkloadFor(ctx context.Context, client client.Client,
// 1. .spec.runPolicy.schedulingPolicy.priorityClass
// 2. .spec.mpiReplicaSecs[Launcher].template.spec.priorityClassName
// 3. .spec.mpiReplicaSecs[Worker].template.spec.priorityClassName
//
// This function is inspired by an analogous one in mpi-controller:
// https://github.com/kubeflow/mpi-operator/blob/5946ef4157599a474ab82ff80e780d5c2546c9ee/pkg/controller/podgroup.go#L69-L72
func calcPriorityClassName(job *kubeflow.MPIJob) string {
if job.Spec.RunPolicy.SchedulingPolicy != nil && len(job.Spec.RunPolicy.SchedulingPolicy.PriorityClass) != 0 {
return job.Spec.RunPolicy.SchedulingPolicy.PriorityClass
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/workload/mpijob/mpijob_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func (w *MPIJobWebhook) ValidateCreate(ctx context.Context, obj runtime.Object)
func validateCreate(job *kubeflow.MPIJob) field.ErrorList {
klog.InfoS("validateCreate invoked", "mpijob", job.Name)
var allErrs field.ErrorList
for _, crdNameAnnotation := range []string{constants.ParentWorkloadAnnotation, constants.QueueAnnotation} {
for _, crdNameAnnotation := range []string{constants.QueueAnnotation} {
if value, exists := job.Annotations[crdNameAnnotation]; exists {
if errs := validation.IsDNS1123Subdomain(value); len(errs) > 0 {
allErrs = append(allErrs, field.Invalid(annotationsPath.Key(crdNameAnnotation), value, strings.Join(errs, ",")))
Expand Down
5 changes: 2 additions & 3 deletions test/integration/controller/job/job_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,10 @@ const (
)

var (
wlLookupKey = types.NamespacedName{Name: workloadjob.GetWorkloadNameForJob(jobName), Namespace: jobNamespace}
wlLookupKey = types.NamespacedName{Name: workloadjob.GetWorkloadNameForJob(jobName), Namespace: jobNamespace}
ignoreConditionTimestamps = cmpopts.IgnoreFields(metav1.Condition{}, "LastTransitionTime")
)

var ignoreConditionTimestamps = cmpopts.IgnoreFields(metav1.Condition{}, "LastTransitionTime")

// +kubebuilder:docs-gen:collapse=Imports

var _ = ginkgo.Describe("Job controller", func() {
Expand Down
5 changes: 2 additions & 3 deletions test/integration/controller/mpijob/mpijob_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,9 @@ const (
priorityValue = 10
)

var ignoreConditionTimestamps = cmpopts.IgnoreFields(metav1.Condition{}, "LastTransitionTime")

var (
wlLookupKey = types.NamespacedName{Name: workloadmpijob.GetWorkloadNameForMPIJob(jobName), Namespace: jobNamespace}
wlLookupKey = types.NamespacedName{Name: workloadmpijob.GetWorkloadNameForMPIJob(jobName), Namespace: jobNamespace}
ignoreConditionTimestamps = cmpopts.IgnoreFields(metav1.Condition{}, "LastTransitionTime")
)

// +kubebuilder:docs-gen:collapse=Imports
Expand Down

0 comments on commit 4dc53e4

Please sign in to comment.