mirror of
https://github.com/hanzo-ml/trainer.git
synced 2026-09-24 00:31:34 +00:00
* chore(deps): Bump Go 1.25, k8s to v1.35, and controller-runtime v0.23.1 Signed-off-by: Andrey Velichkevich <[email protected]> * Migrate to new events API with EventRecorder Signed-off-by: Andrey Velichkevich <[email protected]> * Fix RBAC for events Signed-off-by: Andrey Velichkevich <[email protected]> * Bump k8s version in tests Signed-off-by: Andrey Velichkevich <[email protected]> * Add type compliance check Signed-off-by: Andrey Velichkevich <[email protected]> * Use Reconciling action for event Signed-off-by: Andrey Velichkevich <[email protected]> --------- Signed-off-by: Andrey Velichkevich <[email protected]>
38 lines
1.2 KiB
Go
38 lines
1.2 KiB
Go
/*
|
|
Copyright 2024 The Kubeflow Authors.
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
*/
|
|
|
|
package webhooks
|
|
|
|
import (
|
|
ctrl "sigs.k8s.io/controller-runtime"
|
|
|
|
trainer "github.com/kubeflow/trainer/v2/pkg/apis/trainer/v1alpha1"
|
|
"github.com/kubeflow/trainer/v2/pkg/runtime"
|
|
)
|
|
|
|
func Setup(mgr ctrl.Manager, runtimes map[string]runtime.Runtime) (string, error) {
|
|
if err := setupWebhookForClusterTrainingRuntime(mgr); err != nil {
|
|
return trainer.ClusterTrainingRuntimeKind, err
|
|
}
|
|
if err := setupWebhookForTrainingRuntime(mgr); err != nil {
|
|
return trainer.TrainingRuntimeKind, err
|
|
}
|
|
if err := setupWebhookForTrainJob(mgr, runtimes); err != nil {
|
|
return trainer.TrainJobKind, err
|
|
}
|
|
return "", nil
|
|
}
|