From 05dc737d952dade02c15292d585827d18c41b8c1 Mon Sep 17 00:00:00 2001 From: Antonin Stefanutti Date: Fri, 25 Aug 2023 14:44:29 +0200 Subject: [PATCH] Move AppWrapper API to workload.codeflare.dev group --- .yamllint.yaml | 2 +- Makefile | 6 +-- .../internal/instascale/clusterrole.yaml.tmpl | 2 +- .../clusterrole_mcad-controller.yaml.tmpl | 2 +- config/rbac/role.yaml | 48 +++++++------------ controllers/defaults.go | 4 +- controllers/instascale_controller.go | 1 - controllers/mcad_controller.go | 2 +- .../case_1/clusterrole.yaml | 2 +- go.mod | 4 +- go.sum | 4 +- test/e2e/mnist_pytorch_mcad_job_test.go | 2 +- test/e2e/mnist_rayjob_mcad_raycluster_test.go | 2 +- test/support/mcad.go | 2 +- 14 files changed, 35 insertions(+), 48 deletions(-) diff --git a/.yamllint.yaml b/.yamllint.yaml index 75b22773..768bc626 100644 --- a/.yamllint.yaml +++ b/.yamllint.yaml @@ -1,5 +1,5 @@ ignore: | - bundle/manifests/mcad.ibm.com* + bundle/manifests/* extends: default rules: line-length: disable diff --git a/Makefile b/Makefile index 77b172c3..6d498b2c 100644 --- a/Makefile +++ b/Makefile @@ -12,12 +12,12 @@ VERSION ?= v0.0.0-dev BUNDLE_VERSION ?= $(VERSION:v%=%) # INSTASCALE_VERSION defines the default version of the InstaScale controller -INSTASCALE_VERSION ?= v0.0.7 +INSTASCALE_VERSION ?= dev # MCAD_VERSION defines the default version of the MCAD controller -MCAD_VERSION ?= v1.34.0 +MCAD_VERSION ?= main # MCAD_REF, MCAD_REPO and MCAD_CRD define the reference to MCAD CRD resources -MCAD_REF ?= release-${MCAD_VERSION} +MCAD_REF ?= dev MCAD_REPO ?= github.com/project-codeflare/multi-cluster-app-dispatcher # Upstream MCAD is currently only creating release tags of the form `vX.Y.Z` (i.e the version) # The image is still published using the MCAD_REF format (i.e release-vX.Y.Z) diff --git a/config/internal/instascale/clusterrole.yaml.tmpl b/config/internal/instascale/clusterrole.yaml.tmpl index 8f27f57f..90e60d37 100644 --- a/config/internal/instascale/clusterrole.yaml.tmpl +++ b/config/internal/instascale/clusterrole.yaml.tmpl @@ -60,7 +60,7 @@ rules: - patch - apiGroups: - - mcad.ibm.com + - workload.codeflare.dev resources: - appwrappers verbs: diff --git a/config/internal/mcad/clusterrole_mcad-controller.yaml.tmpl b/config/internal/mcad/clusterrole_mcad-controller.yaml.tmpl index 7d49f5fe..49dfe097 100644 --- a/config/internal/mcad/clusterrole_mcad-controller.yaml.tmpl +++ b/config/internal/mcad/clusterrole_mcad-controller.yaml.tmpl @@ -11,7 +11,7 @@ metadata: codeflare.codeflare.dev/cr-namespace: {{.Namespace}} rules: - apiGroups: - - mcad.ibm.com + - workload.codeflare.dev resources: - queuejobs - schedulingspecs diff --git a/config/rbac/role.yaml b/config/rbac/role.yaml index 9805d333..691c9dfb 100644 --- a/config/rbac/role.yaml +++ b/config/rbac/role.yaml @@ -262,37 +262,6 @@ rules: - patch - update - watch -- apiGroups: - - mcad.ibm.com - resources: - - appwrappers - - appwrappers/finalizers - - appwrappers/status - - queuejobs - - schedulingspecs - verbs: - - create - - delete - - deletecollection - - get - - list - - patch - - update - - watch -- apiGroups: - - mcad.ibm.com - resources: - - appwrappers - - queuejobs - - schedulingspecs - verbs: - - create - - delete - - get - - list - - patch - - update - - watch - apiGroups: - policy resources: @@ -349,3 +318,20 @@ rules: - get - list - watch +- apiGroups: + - workload.codeflare.dev + resources: + - appwrappers + - appwrappers/finalizers + - appwrappers/status + - queuejobs + - schedulingspecs + verbs: + - create + - delete + - deletecollection + - get + - list + - patch + - update + - watch diff --git a/controllers/defaults.go b/controllers/defaults.go index dfcb4a28..bac326fd 100644 --- a/controllers/defaults.go +++ b/controllers/defaults.go @@ -5,6 +5,6 @@ package controllers // *********************** const ( - MCADImage = "quay.io/project-codeflare/mcad-controller:release-v1.34.0" - InstaScaleImage = "quay.io/project-codeflare/instascale-controller:v0.0.7" + MCADImage = "quay.io/project-codeflare/mcad-controller:dev" + InstaScaleImage = "quay.io/project-codeflare/instascale-controller:dev" ) diff --git a/controllers/instascale_controller.go b/controllers/instascale_controller.go index 5fba37e9..9fca52a0 100644 --- a/controllers/instascale_controller.go +++ b/controllers/instascale_controller.go @@ -88,7 +88,6 @@ func (r *InstaScaleReconciler) Apply(owner mf.Owner, params *InstaScaleParams, t // +kubebuilder:rbac:groups=rbac.authorization.k8s.io,resources=roles;rolebindings,verbs=get;list;watch;create;update;patch;delete // +kubebuilder:rbac:groups=rbac.authorization.k8s.io,resources=clusterroles;clusterrolebindings,verbs=get;list;watch;create;update;delete // +kubebuilder:rbac:groups=machine.openshift.io,resources=*,verbs=get;list;watch;create;update;patch;delete -// +kubebuilder:rbac:groups=mcad.ibm.com,resources=appwrappers;queuejobs;schedulingspecs,verbs=get;list;watch;create;update;patch;delete // +kubebuilder:rbac:groups=config.openshift.io,resources=clusterversions,verbs=get;list // Reconcile is part of the main kubernetes reconciliation loop which aims to diff --git a/controllers/mcad_controller.go b/controllers/mcad_controller.go index 770df03e..9dfecc24 100644 --- a/controllers/mcad_controller.go +++ b/controllers/mcad_controller.go @@ -102,7 +102,7 @@ func (r *MCADReconciler) DeleteResource(params *MCADParams, template string, fns // +kubebuilder:rbac:groups=codeflare.codeflare.dev,resources=mcads,verbs=get;list;watch;create;update;patch;delete // +kubebuilder:rbac:groups=codeflare.codeflare.dev,resources=mcads/status,verbs=get;update;patch // +kubebuilder:rbac:groups=codeflare.codeflare.dev,resources=mcads/finalizers,verbs=update -// +kubebuilder:rbac:groups=mcad.ibm.com,resources=queuejobs;schedulingspecs;appwrappers;appwrappers/finalizers;appwrappers/status,verbs=get;list;watch;create;update;patch;delete;deletecollection +// +kubebuilder:rbac:groups=workload.codeflare.dev,resources=queuejobs;schedulingspecs;appwrappers;appwrappers/finalizers;appwrappers/status,verbs=get;list;watch;create;update;patch;delete;deletecollection // +kubebuilder:rbac:groups=core,resources=pods;lists;namespaces,verbs=get;list;watch;create;update;patch;delete;deletecollection // +kubebuilder:rbac:groups=core,resources=bindings;pods/binding,verbs=create // +kubebuilder:rbac:groups=core,resources=kube-scheduler,verbs=get;update diff --git a/controllers/testdata/instascale_test_results/case_1/clusterrole.yaml b/controllers/testdata/instascale_test_results/case_1/clusterrole.yaml index c4053cdb..150863ed 100644 --- a/controllers/testdata/instascale_test_results/case_1/clusterrole.yaml +++ b/controllers/testdata/instascale_test_results/case_1/clusterrole.yaml @@ -63,6 +63,6 @@ rules: - delete - patch apiGroups: - - mcad.ibm.com + - workload.codeflare.dev resources: - appwrappers diff --git a/go.mod b/go.mod index 764faf2e..c621d70c 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/openshift-eng/openshift-goimports v0.0.0-20230304234052-c70783e636f2 github.com/openshift/api v0.0.0-20230213134911-7ba313770556 github.com/openshift/client-go v0.0.0-20221019143426-16aed247da5c - github.com/project-codeflare/multi-cluster-app-dispatcher v1.34.0 + github.com/project-codeflare/multi-cluster-app-dispatcher v1.34.1-0.20230831150053-05b1af83014c github.com/ray-project/kuberay/ray-operator v0.0.0-20230830082034-e7fbf7d73576 go.uber.org/zap v1.24.0 k8s.io/api v0.26.3 @@ -21,6 +21,8 @@ require ( sigs.k8s.io/structured-merge-diff/v4 v4.2.3 ) +replace sigs.k8s.io/custom-metrics-apiserver => sigs.k8s.io/custom-metrics-apiserver v1.25.1-0.20230306170449-63d8c93851f3 + require ( github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.1.2 // indirect diff --git a/go.sum b/go.sum index b87ec39e..a87dbc9c 100644 --- a/go.sum +++ b/go.sum @@ -495,8 +495,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/pquerna/cachecontrol v0.0.0-20171018203845-0dec1b30a021/go.mod h1:prYjPmNq4d1NPVmpShWobRqXY3q7Vp+80DqgxxUrUIA= -github.com/project-codeflare/multi-cluster-app-dispatcher v1.34.0 h1:4J3vW+vuCBHyocd3huZy3FJhOw5acaBHFLYwutkTE/E= -github.com/project-codeflare/multi-cluster-app-dispatcher v1.34.0/go.mod h1:gtTl8Tsl+X+bGhqVudLoveINR6IkN+sVvH0J+VZIP40= +github.com/project-codeflare/multi-cluster-app-dispatcher v1.34.1-0.20230831150053-05b1af83014c h1:LjCgRcjtkd9byePczvxGBLjdM22M2BCTB76FoEk2fkU= +github.com/project-codeflare/multi-cluster-app-dispatcher v1.34.1-0.20230831150053-05b1af83014c/go.mod h1:gtTl8Tsl+X+bGhqVudLoveINR6IkN+sVvH0J+VZIP40= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= diff --git a/test/e2e/mnist_pytorch_mcad_job_test.go b/test/e2e/mnist_pytorch_mcad_job_test.go index 82f5b808..23ad3095 100644 --- a/test/e2e/mnist_pytorch_mcad_job_test.go +++ b/test/e2e/mnist_pytorch_mcad_job_test.go @@ -137,7 +137,7 @@ func TestMNISTPyTorchMCAD(t *testing.T) { }, } - _, err = test.Client().MCAD().McadV1beta1().AppWrappers(namespace.Name).Create(test.Ctx(), aw, metav1.CreateOptions{}) + _, err = test.Client().MCAD().WorkloadV1beta1().AppWrappers(namespace.Name).Create(test.Ctx(), aw, metav1.CreateOptions{}) test.Expect(err).NotTo(HaveOccurred()) test.T().Logf("Created MCAD %s/%s successfully", aw.Namespace, aw.Name) diff --git a/test/e2e/mnist_rayjob_mcad_raycluster_test.go b/test/e2e/mnist_rayjob_mcad_raycluster_test.go index bf618cbf..413c8c5e 100644 --- a/test/e2e/mnist_rayjob_mcad_raycluster_test.go +++ b/test/e2e/mnist_rayjob_mcad_raycluster_test.go @@ -217,7 +217,7 @@ func TestMNISTRayJobMCADRayCluster(t *testing.T) { }, } - aw, err = test.Client().MCAD().McadV1beta1().AppWrappers(namespace.Name).Create(test.Ctx(), aw, metav1.CreateOptions{}) + aw, err = test.Client().MCAD().WorkloadV1beta1().AppWrappers(namespace.Name).Create(test.Ctx(), aw, metav1.CreateOptions{}) test.Expect(err).NotTo(HaveOccurred()) test.T().Logf("Created MCAD %s/%s successfully", aw.Namespace, aw.Name) diff --git a/test/support/mcad.go b/test/support/mcad.go index a4d69b75..a5ce310f 100644 --- a/test/support/mcad.go +++ b/test/support/mcad.go @@ -26,7 +26,7 @@ import ( func AppWrapper(t Test, namespace *corev1.Namespace, name string) func(g gomega.Gomega) *mcadv1beta1.AppWrapper { return func(g gomega.Gomega) *mcadv1beta1.AppWrapper { - aw, err := t.Client().MCAD().McadV1beta1().AppWrappers(namespace.Name).Get(t.Ctx(), name, metav1.GetOptions{}) + aw, err := t.Client().MCAD().WorkloadV1beta1().AppWrappers(namespace.Name).Get(t.Ctx(), name, metav1.GetOptions{}) g.Expect(err).NotTo(gomega.HaveOccurred()) return aw }