diff --git a/Makefile b/Makefile index 62e5924aa4..011b7590f5 100644 --- a/Makefile +++ b/Makefile @@ -68,11 +68,14 @@ scheduler-plugins-crd: ## Copy the CRDs from the Scheduler Plugins repository to # Instructions for code generation. .PHONY: manifests manifests: controller-gen ## Generate manifests. + # Skip outputing the RBAC and webhook manifests as we will sync them from the manifests templated from the Helm chart. $(CONTROLLER_GEN) "crd:generateEmbeddedObjectMeta=true" rbac:roleName=kubeflow-trainer-controller-manager webhook \ paths="./pkg/apis/trainer/v1alpha1/...;./pkg/controller/...;./pkg/runtime/...;./pkg/webhooks/...;./pkg/util/cert/..." \ output:crd:artifacts:config=manifests/base/crds \ output:rbac:artifacts:config=manifests/base/rbac \ - output:webhook:artifacts:config=manifests/base/webhook + output:rbac:none \ + output:webhook:artifacts:config=manifests/base/webhook \ + output:webhook:none .PHONY: generate generate: go-mod-download manifests ## Generate APIs and SDK. diff --git a/manifests/base/rbac/role.yaml b/manifests/base/rbac/role.yaml index 77c8151eaa..6716c2f6c5 100644 --- a/manifests/base/rbac/role.yaml +++ b/manifests/base/rbac/role.yaml @@ -1,72 +1,23 @@ ---- +# Source: kubeflow-trainer/templates/rbac/role.yaml apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole +kind: Role metadata: - name: kubeflow-trainer-controller-manager + name: kubeflow-trainer-controller + namespace: kubeflow-system + labels: + app.kubernetes.io/name: kubeflow-trainer + app.kubernetes.io/instance: kubeflow-trainer + app.kubernetes.io/version: "2.0.0" + app.kubernetes.io/managed-by: Kustomize + app.kubernetes.io/part-of: kubeflow + app.kubernetes.io/component: controller rules: -- apiGroups: - - "" - resources: - - secrets - verbs: - - get - - list - - update - - watch -- apiGroups: - - admissionregistration.k8s.io - resources: - - validatingwebhookconfigurations - verbs: - - get - - list - - update - - watch -- apiGroups: - - jobset.x-k8s.io - resources: - - jobsets - verbs: - - create - - get - - list - - watch -- apiGroups: - - scheduling.x-k8s.io - resources: - - podgroups - verbs: - - create - - get - - list - - watch -- apiGroups: - - trainer.kubeflow.org - resources: - - clustertrainingruntimes - - trainingruntimes - verbs: - - get - - list - - watch -- apiGroups: - - trainer.kubeflow.org - resources: - - trainjobs - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - trainer.kubeflow.org - resources: - - trainjobs/finalizers - - trainjobs/status - verbs: - - get - - patch - - update + - apiGroups: + - "" + resources: + - secrets + verbs: + - get + - list + - watch + - update diff --git a/manifests/base/webhook/manifests.yaml b/manifests/base/webhook/manifests.yaml deleted file mode 100644 index 721773af05..0000000000 --- a/manifests/base/webhook/manifests.yaml +++ /dev/null @@ -1,66 +0,0 @@ ---- -apiVersion: admissionregistration.k8s.io/v1 -kind: ValidatingWebhookConfiguration -metadata: - name: validating-webhook-configuration -webhooks: -- admissionReviewVersions: - - v1 - clientConfig: - service: - name: webhook-service - namespace: system - path: /validate-trainer-kubeflow-org-v1alpha1-clustertrainingruntime - failurePolicy: Fail - name: validator.clustertrainingruntime.trainer.kubeflow.org - rules: - - apiGroups: - - trainer.kubeflow.org - apiVersions: - - v1alpha1 - operations: - - CREATE - - UPDATE - resources: - - clustertrainingruntimes - sideEffects: None -- admissionReviewVersions: - - v1 - clientConfig: - service: - name: webhook-service - namespace: system - path: /validate-trainer-kubeflow-org-v1alpha1-trainingruntime - failurePolicy: Fail - name: validator.trainingruntime.trainer.kubeflow.org - rules: - - apiGroups: - - trainer.kubeflow.org - apiVersions: - - v1alpha1 - operations: - - CREATE - - UPDATE - resources: - - trainingruntimes - sideEffects: None -- admissionReviewVersions: - - v1 - clientConfig: - service: - name: webhook-service - namespace: system - path: /validate-trainer-kubeflow-org-v1alpha1-trainjob - failurePolicy: Fail - name: validator.trainjob.trainer.kubeflow.org - rules: - - apiGroups: - - trainer.kubeflow.org - apiVersions: - - v1alpha1 - operations: - - CREATE - - UPDATE - resources: - - trainjobs - sideEffects: None diff --git a/pkg/apis/trainer/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/trainer/v1alpha1/zz_generated.deepcopy.go index 298d478216..3ca536e849 100644 --- a/pkg/apis/trainer/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/trainer/v1alpha1/zz_generated.deepcopy.go @@ -1,5 +1,4 @@ //go:build !ignore_autogenerated -// +build !ignore_autogenerated // Copyright 2024 The Kubeflow Authors // @@ -15,13 +14,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Code generated by deepcopy-gen. DO NOT EDIT. +// Code generated by controller-gen. DO NOT EDIT. package v1alpha1 import ( - v2 "k8s.io/api/autoscaling/v2" - v1 "k8s.io/api/core/v1" + "k8s.io/api/autoscaling/v2" + "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) @@ -32,7 +31,6 @@ func (in *ClusterTrainingRuntime) DeepCopyInto(out *ClusterTrainingRuntime) { out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) in.Spec.DeepCopyInto(&out.Spec) - return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterTrainingRuntime. @@ -65,7 +63,6 @@ func (in *ClusterTrainingRuntimeList) DeepCopyInto(out *ClusterTrainingRuntimeLi (*in)[i].DeepCopyInto(&(*out)[i]) } } - return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterTrainingRuntimeList. @@ -120,7 +117,6 @@ func (in *ContainerOverride) DeepCopyInto(out *ContainerOverride) { (*in)[i].DeepCopyInto(&(*out)[i]) } } - return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerOverride. @@ -141,7 +137,6 @@ func (in *CoschedulingPodGroupPolicySource) DeepCopyInto(out *CoschedulingPodGro *out = new(int32) **out = **in } - return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CoschedulingPodGroupPolicySource. @@ -174,7 +169,6 @@ func (in *DatasetConfig) DeepCopyInto(out *DatasetConfig) { *out = new(v1.LocalObjectReference) **out = **in } - return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DatasetConfig. @@ -207,7 +201,6 @@ func (in *InputModel) DeepCopyInto(out *InputModel) { *out = new(v1.LocalObjectReference) **out = **in } - return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InputModel. @@ -225,7 +218,6 @@ func (in *JobSetTemplateSpec) DeepCopyInto(out *JobSetTemplateSpec) { *out = *in in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) in.Spec.DeepCopyInto(&out.Spec) - return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JobSetTemplateSpec. @@ -241,7 +233,6 @@ func (in *JobSetTemplateSpec) DeepCopy() *JobSetTemplateSpec { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *JobStatus) DeepCopyInto(out *JobStatus) { *out = *in - return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JobStatus. @@ -263,7 +254,6 @@ func (in *MLPolicy) DeepCopyInto(out *MLPolicy) { **out = **in } in.MLPolicySource.DeepCopyInto(&out.MLPolicySource) - return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MLPolicy. @@ -289,7 +279,6 @@ func (in *MLPolicySource) DeepCopyInto(out *MLPolicySource) { *out = new(MPIMLPolicySource) (*in).DeepCopyInto(*out) } - return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MLPolicySource. @@ -325,7 +314,6 @@ func (in *MPIMLPolicySource) DeepCopyInto(out *MPIMLPolicySource) { *out = new(bool) **out = **in } - return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MPIMLPolicySource. @@ -351,7 +339,6 @@ func (in *ModelConfig) DeepCopyInto(out *ModelConfig) { *out = new(OutputModel) (*in).DeepCopyInto(*out) } - return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ModelConfig. @@ -384,7 +371,6 @@ func (in *OutputModel) DeepCopyInto(out *OutputModel) { *out = new(v1.LocalObjectReference) **out = **in } - return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OutputModel. @@ -401,7 +387,6 @@ func (in *OutputModel) DeepCopy() *OutputModel { func (in *PodGroupPolicy) DeepCopyInto(out *PodGroupPolicy) { *out = *in in.PodGroupPolicySource.DeepCopyInto(&out.PodGroupPolicySource) - return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroupPolicy. @@ -422,7 +407,6 @@ func (in *PodGroupPolicySource) DeepCopyInto(out *PodGroupPolicySource) { *out = new(CoschedulingPodGroupPolicySource) (*in).DeepCopyInto(*out) } - return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroupPolicySource. @@ -478,7 +462,6 @@ func (in *PodSpecOverride) DeepCopyInto(out *PodSpecOverride) { (*in)[i].DeepCopyInto(&(*out)[i]) } } - return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodSpecOverride. @@ -494,7 +477,6 @@ func (in *PodSpecOverride) DeepCopy() *PodSpecOverride { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PodSpecOverrideTargetJob) DeepCopyInto(out *PodSpecOverrideTargetJob) { *out = *in - return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodSpecOverrideTargetJob. @@ -520,7 +502,6 @@ func (in *RuntimeRef) DeepCopyInto(out *RuntimeRef) { *out = new(string) **out = **in } - return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RuntimeRef. @@ -558,7 +539,6 @@ func (in *TorchElasticPolicy) DeepCopyInto(out *TorchElasticPolicy) { (*in)[i].DeepCopyInto(&(*out)[i]) } } - return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TorchElasticPolicy. @@ -584,7 +564,6 @@ func (in *TorchMLPolicySource) DeepCopyInto(out *TorchMLPolicySource) { *out = new(TorchElasticPolicy) (*in).DeepCopyInto(*out) } - return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TorchMLPolicySource. @@ -604,7 +583,6 @@ func (in *TrainJob) DeepCopyInto(out *TrainJob) { in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) in.Spec.DeepCopyInto(&out.Spec) in.Status.DeepCopyInto(&out.Status) - return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrainJob. @@ -637,7 +615,6 @@ func (in *TrainJobList) DeepCopyInto(out *TrainJobList) { (*in)[i].DeepCopyInto(&(*out)[i]) } } - return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrainJobList. @@ -708,7 +685,6 @@ func (in *TrainJobSpec) DeepCopyInto(out *TrainJobSpec) { *out = new(string) **out = **in } - return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrainJobSpec. @@ -736,7 +712,6 @@ func (in *TrainJobStatus) DeepCopyInto(out *TrainJobStatus) { *out = make([]JobStatus, len(*in)) copy(*out, *in) } - return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrainJobStatus. @@ -789,7 +764,6 @@ func (in *Trainer) DeepCopyInto(out *Trainer) { *out = new(string) **out = **in } - return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Trainer. @@ -808,7 +782,6 @@ func (in *TrainingRuntime) DeepCopyInto(out *TrainingRuntime) { out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) in.Spec.DeepCopyInto(&out.Spec) - return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrainingRuntime. @@ -841,7 +814,6 @@ func (in *TrainingRuntimeList) DeepCopyInto(out *TrainingRuntimeList) { (*in)[i].DeepCopyInto(&(*out)[i]) } } - return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrainingRuntimeList. @@ -876,7 +848,6 @@ func (in *TrainingRuntimeSpec) DeepCopyInto(out *TrainingRuntimeSpec) { (*in).DeepCopyInto(*out) } in.Template.DeepCopyInto(&out.Template) - return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrainingRuntimeSpec. diff --git a/test/integration/framework/framework.go b/test/integration/framework/framework.go index 1e13d82a7e..58b0e4f864 100644 --- a/test/integration/framework/framework.go +++ b/test/integration/framework/framework.go @@ -62,7 +62,7 @@ func (f *Framework) Init() *rest.Config { filepath.Join("..", "..", "..", "manifests", "external-crds", "jobset-operator"), }, WebhookInstallOptions: envtest.WebhookInstallOptions{ - Paths: []string{filepath.Join("..", "..", "..", "manifests", "base", "webhook", "manifests.yaml")}, + Paths: []string{filepath.Join("..", "..", "..", "manifests", "base", "webhook", "validatingwebhookconfiguration.yaml")}, }, ErrorIfCRDPathMissing: true, }