diff --git a/api/apis.go b/api/apis.go index a9d134a1..93635dac 100644 --- a/api/apis.go +++ b/api/apis.go @@ -29,16 +29,21 @@ limitations under the License. // Generate default for pytorch apis. //go:generate go run $GOPATH/src/k8s.io/code-generator/cmd/defaulter-gen/main.go -O zz_generated.defaults -i ./pytorch/... -h ../hack/boilerplate.go.txt -// Generate deepcopy for elasticdljob apis. -//go:generate go run $GOPATH/src/k8s.io/code-generator/cmd/deepcopy-gen/main.go -O zz_generated.deepcopy -i ./elasticdljob/... -h ../hack/boilerplate.go.txt -// Generate default for elasticdljob apis. -//go:generate go run $GOPATH/src/k8s.io/code-generator/cmd/defaulter-gen/main.go -O zz_generated.defaults -i ./elasticdljob/... -h ../hack/boilerplate.go.txt - // Generate deepcopy for xgboost apis. //go:generate go run $GOPATH/src/k8s.io/code-generator/cmd/deepcopy-gen/main.go -O zz_generated.deepcopy -i ./xgboost/... -h ../hack/boilerplate.go.txt // Generate default for xgboost apis. //go:generate go run $GOPATH/src/k8s.io/code-generator/cmd/defaulter-gen/main.go -O zz_generated.defaults -i ./xgboost/... -h ../hack/boilerplate.go.txt +// Generate deepcopy for marsjob apis. +//go:generate go run $GOPATH/src/k8s.io/code-generator/cmd/deepcopy-gen/main.go -O zz_generated.deepcopy -i ./marsjob/... -h ../hack/boilerplate.go.txt +// Generate default for elasticdljob apis. +//go:generate go run $GOPATH/src/k8s.io/code-generator/cmd/defaulter-gen/main.go -O zz_generated.defaults -i ./marsjob/... -h ../hack/boilerplate.go.txt + +// Generate deepcopy for elasticdljob apis. +//go:generate go run $GOPATH/src/k8s.io/code-generator/cmd/deepcopy-gen/main.go -O zz_generated.deepcopy -i ./elasticdljob/... -h ../hack/boilerplate.go.txt +// Generate default for elasticdljob apis. +//go:generate go run $GOPATH/src/k8s.io/code-generator/cmd/defaulter-gen/main.go -O zz_generated.defaults -i ./elasticdljob/... -h ../hack/boilerplate.go.txt + package api import ( diff --git a/config/rbac/role.yaml b/config/rbac/role.yaml index e00f95db..70c8e7f2 100644 --- a/config/rbac/role.yaml +++ b/config/rbac/role.yaml @@ -18,6 +18,34 @@ rules: - patch - update - watch +- apiGroups: + - "" + resources: + - pods/status + verbs: + - get + - patch + - update +- apiGroups: + - "" + resources: + - services + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - "" + resources: + - services/status + verbs: + - get + - patch + - update - apiGroups: - elasticdl.org resources: @@ -58,3 +86,83 @@ rules: - get - patch - update +- apiGroups: + - kubeflow.org + resources: + - pytorchjobs + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - kubeflow.org + resources: + - pytorchjobs/status + verbs: + - get + - patch + - update +- apiGroups: + - kubeflow.org + resources: + - tfjobs + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - kubeflow.org + resources: + - tfjobs/status + verbs: + - get + - patch + - update +- apiGroups: + - xdl.kubedl.io + resources: + - xdljobs + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - xdl.kubedl.io + resources: + - xdljobs/status + verbs: + - get + - patch + - update +- apiGroups: + - xgboostjob.kubeflow.org + resources: + - xgboostjobs + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - xgboostjob.kubeflow.org + resources: + - xgboostjobs/status + verbs: + - get + - patch + - update diff --git a/controllers/pytorch/pytorchjob_controller.go b/controllers/pytorch/pytorchjob_controller.go index f2ec6584..83138f48 100644 --- a/controllers/pytorch/pytorchjob_controller.go +++ b/controllers/pytorch/pytorchjob_controller.go @@ -83,6 +83,7 @@ type PytorchJobReconciler struct { // +kubebuilder:rbac:groups="",resources=services/status,verbs=get;update;patch // +kubebuilder:rbac:groups=kubeflow.org,resources=pytorchjobs,verbs=get;list;watch;create;update;patch;delete // +kubebuilder:rbac:groups=kubeflow.org,resources=pytorchjobs/status,verbs=get;update;patch + func (r *PytorchJobReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) { // Fetch latest pytorch job instance. sharedPytorchJob := &pytorchv1.PyTorchJob{} diff --git a/controllers/tensorflow/tfjob_controller.go b/controllers/tensorflow/tfjob_controller.go index 4cef9568..62c5bc34 100644 --- a/controllers/tensorflow/tfjob_controller.go +++ b/controllers/tensorflow/tfjob_controller.go @@ -87,6 +87,7 @@ type TFJobReconciler struct { // +kubebuilder:rbac:groups="",resources=services/status,verbs=get;update;patch // +kubebuilder:rbac:groups=kubeflow.org,resources=tfjobs,verbs=get;list;watch;create;update;patch;delete // +kubebuilder:rbac:groups=kubeflow.org,resources=tfjobs/status,verbs=get;update;patch + func (r *TFJobReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) { // Fetch the TFJob tfJob sharedTfJob := &tfv1.TFJob{} diff --git a/controllers/xdl/xdljob_controller.go b/controllers/xdl/xdljob_controller.go index 3f4f13f7..711d9dfa 100644 --- a/controllers/xdl/xdljob_controller.go +++ b/controllers/xdl/xdljob_controller.go @@ -91,6 +91,7 @@ type XDLJobReconciler struct { // +kubebuilder:rbac:groups="",resources=services/status,verbs=get;update;patch // +kubebuilder:rbac:groups=xdl.kubedl.io,resources=xdljobs,verbs=get;list;watch;create;update;patch;delete // +kubebuilder:rbac:groups=xdl.kubedl.io,resources=xdljobs/status,verbs=get;update;patch + func (r *XDLJobReconciler) Reconcile(request reconcile.Request) (reconcile.Result, error) { // Fetch the latest xdlJob instance. sharedXdlJob := &xdlv1alpha1.XDLJob{} diff --git a/controllers/xgboost/xgboostjob_controller.go b/controllers/xgboost/xgboostjob_controller.go index f6e31402..ee47359a 100644 --- a/controllers/xgboost/xgboostjob_controller.go +++ b/controllers/xgboost/xgboostjob_controller.go @@ -79,6 +79,7 @@ type XgboostJobReconciler struct { // +kubebuilder:rbac:groups="",resources=services/status,verbs=get;update;patch // +kubebuilder:rbac:groups=xgboostjob.kubeflow.org,resources=xgboostjobs,verbs=get;list;watch;create;update;patch;delete // +kubebuilder:rbac:groups=xgboostjob.kubeflow.org,resources=xgboostjobs/status,verbs=get;update;patch + func (r *XgboostJobReconciler) Reconcile(req reconcile.Request) (reconcile.Result, error) { // Fetch the XGBoostJob instance xgboostjob := &v1alpha1.XGBoostJob{}