Skip to content

Commit

Permalink
Add TODO comments
Browse files Browse the repository at this point in the history
Signed-off-by: Yuki Iwai <yuki.iwai.tz@gmail.com>
  • Loading branch information
tenzen-y committed Oct 16, 2024
1 parent ba81beb commit 2f616e5
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pkg/runtime.v2/framework/plugins/jobset/jobset.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"fmt"
"maps"

"github.com/go-logr/logr"
batchv1 "k8s.io/api/batch/v1"
"k8s.io/apimachinery/pkg/api/equality"
apierrors "k8s.io/apimachinery/pkg/api/errors"
Expand All @@ -29,6 +30,7 @@ import (
apiruntime "k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/utils/ptr"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/builder"
"sigs.k8s.io/controller-runtime/pkg/client"
ctrlutil "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
Expand All @@ -43,18 +45,20 @@ type JobSet struct {
client client.Client
restMapper meta.RESTMapper
scheme *apiruntime.Scheme
logger logr.Logger
}

var _ framework.WatchExtensionPlugin = (*JobSet)(nil)
var _ framework.ComponentBuilderPlugin = (*JobSet)(nil)

const Name = "JobSet"

func New(_ context.Context, c client.Client, _ client.FieldIndexer) (framework.Plugin, error) {
func New(ctx context.Context, c client.Client, _ client.FieldIndexer) (framework.Plugin, error) {
return &JobSet{
client: c,
restMapper: c.RESTMapper(),
scheme: c.Scheme(),
logger: ctrl.LoggerFrom(ctx).WithValues("pluginName", "JobSet"),
}, nil
}

Expand All @@ -77,6 +81,7 @@ func (j *JobSet) Build(ctx context.Context, info *runtime.Info, trainJob *kubefl
},
Spec: raw.Spec,
})
// TODO (tenzen-y): We should support all field propagation in builder.
jobSet := jobSetBuilder.
ContainerImage(trainJob.Spec.Trainer.Image).
JobCompletionMode(batchv1.IndexedCompletion).
Expand Down Expand Up @@ -111,7 +116,8 @@ func (j *JobSet) ReconcilerBuilders() []runtime.ReconcilerBuilder {
schema.GroupKind{Group: jobsetv1alpha2.GroupVersion.Group, Kind: "JobSet"},
jobsetv1alpha2.SchemeGroupVersion.Version,
); err != nil {
return nil
// TODO (tenzen-y): After we provide the Configuration API, we should return errors based on the enabled plugins.
j.logger.Error(err, "JobSet CRDs must be installed in advance")
}
return []runtime.ReconcilerBuilder{
func(b *builder.Builder, c client.Client) *builder.Builder {
Expand Down

0 comments on commit 2f616e5

Please sign in to comment.