From 97663fe6cd489e37e444b0f06935eeb5d71d98e9 Mon Sep 17 00:00:00 2001 From: Andrey Velichkevich Date: Sat, 19 Oct 2024 01:18:01 +0100 Subject: [PATCH] Move kubebuilder markers to plugins Signed-off-by: Andrey Velichkevich --- Makefile | 2 +- pkg/controller.v2/trainjob_controller.go | 2 -- pkg/runtime.v2/framework/plugins/coscheduling/coscheduling.go | 2 ++ pkg/runtime.v2/framework/plugins/jobset/jobset.go | 2 ++ 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 01e663f862..613e667be5 100644 --- a/Makefile +++ b/Makefile @@ -42,7 +42,7 @@ manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and Cust output:rbac:artifacts:config=manifests/base/rbac \ output:webhook:artifacts:config=manifests/base/webhook $(CONTROLLER_GEN) "crd:generateEmbeddedObjectMeta=true" rbac:roleName=training-operator-v2 webhook \ - paths="./pkg/apis/kubeflow.org/v2alpha1/...;./pkg/controller.v2/...;./pkg/webhook.v2/...;./pkg/cert/..." \ + paths="./pkg/apis/kubeflow.org/v2alpha1/...;./pkg/controller.v2/...;./pkg/runtime.v2/...;./pkg/webhook.v2/...;./pkg/cert/..." \ output:crd:artifacts:config=manifests/v2/base/crds \ output:rbac:artifacts:config=manifests/v2/base/rbac \ output:webhook:artifacts:config=manifests/v2/base/webhook diff --git a/pkg/controller.v2/trainjob_controller.go b/pkg/controller.v2/trainjob_controller.go index db09bdb5f7..c2aef66cab 100644 --- a/pkg/controller.v2/trainjob_controller.go +++ b/pkg/controller.v2/trainjob_controller.go @@ -47,8 +47,6 @@ func NewTrainJobReconciler(client client.Client, recorder record.EventRecorder) //+kubebuilder:rbac:groups=kubeflow.org,resources=trainjobs/status,verbs=get;update;patch //+kubebuilder:rbac:groups=kubeflow.org,resources=trainingruntimes,verbs=get;list;watch //+kubebuilder:rbac:groups=kubeflow.org,resources=clustertrainingruntimes,verbs=get;list;watch -//+kubebuilder:rbac:groups=jobset.x-k8s.io,resources=jobsets,verbs=get;list;watch;create -//+kubebuilder:rbac:groups=scheduling.x-k8s.io,resources=podgroups,verbs=get;list;watch;create func (r *TrainJobReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { var trainJob kubeflowv2.TrainJob diff --git a/pkg/runtime.v2/framework/plugins/coscheduling/coscheduling.go b/pkg/runtime.v2/framework/plugins/coscheduling/coscheduling.go index aa0ef3b3a6..d240764705 100644 --- a/pkg/runtime.v2/framework/plugins/coscheduling/coscheduling.go +++ b/pkg/runtime.v2/framework/plugins/coscheduling/coscheduling.go @@ -65,6 +65,8 @@ var ( const Name = "CoScheduling" +//+kubebuilder:rbac:groups=scheduling.x-k8s.io,resources=podgroups,verbs=get;list;watch;create + func New(ctx context.Context, c client.Client, indexer client.FieldIndexer) (framework.Plugin, error) { if err := indexer.IndexField(ctx, &kubeflowv2.TrainingRuntime{}, TrainingRuntimeContainerRuntimeClassKey, IndexTrainingRuntimeContainerRuntimeClass); err != nil { diff --git a/pkg/runtime.v2/framework/plugins/jobset/jobset.go b/pkg/runtime.v2/framework/plugins/jobset/jobset.go index 82eca0ef7f..49a5ecd083 100644 --- a/pkg/runtime.v2/framework/plugins/jobset/jobset.go +++ b/pkg/runtime.v2/framework/plugins/jobset/jobset.go @@ -53,6 +53,8 @@ var _ framework.ComponentBuilderPlugin = (*JobSet)(nil) const Name = "JobSet" +//+kubebuilder:rbac:groups=jobset.x-k8s.io,resources=jobsets,verbs=get;list;watch;create + func New(ctx context.Context, c client.Client, _ client.FieldIndexer) (framework.Plugin, error) { return &JobSet{ client: c,