This is an automated email from the ASF dual-hosted git repository.
pingsutw pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/submarine.git
The following commit(s) were added to refs/heads/master by this push:
new 7b0482a SUBMARINE-1223. Update Submarine Operator CRD to v1
7b0482a is described below
commit 7b0482a1434a507d45681a35a2ada18ffdf5a1e7
Author: chenx <[email protected]>
AuthorDate: Sun Mar 20 16:48:21 2022 +0800
SUBMARINE-1223. Update Submarine Operator CRD to v1
### What is this PR for?
Update Submarine Operator CRD:
* Unify the CRD (upgrade apiextensions.k8s.io/v1beta1 to
apiextensions.k8s.io/v1)
* Add some details to support the new CRD (The adjusted CRD can support
multiple CRDs to share group resources)
### What type of PR is it?
Refactoring
### Todos
* [x] - Update Submarine Operator CRD
### What is the Jira issue?
https://issues.apache.org/jira/browse/SUBMARINE-1223
### How should this be tested?
Can be tested by exists cicd.
### Screenshots (if appropriate)
No
### Questions:
* Do the license files need updating? No
* Are there breaking changes for older versions? No
* Does this need new documentation? No
Author: chenx <[email protected]>
Author: cdmikechen <[email protected]>
Signed-off-by: Kevin <[email protected]>
Closes #905 from cdmikechen/SUBMARINE-1223 and squashes the following
commits:
d84f29fe [chenx] add submarines/status rbac
1b3bd5b1 [chenx] Fix status problem
1a703f17 [cdmikechen] SUBMARINE-1223. Update Submarine Operator CRD
---
helm-charts/submarine/crds/crd.yaml | 143 +++++++++++++++---------
helm-charts/submarine/templates/rbac.yaml | 2 +
submarine-cloud-v2/pkg/controller/controller.go | 3 +-
3 files changed, 92 insertions(+), 56 deletions(-)
diff --git a/helm-charts/submarine/crds/crd.yaml
b/helm-charts/submarine/crds/crd.yaml
index 48fa7e8..dbd90db 100644
--- a/helm-charts/submarine/crds/crd.yaml
+++ b/helm-charts/submarine/crds/crd.yaml
@@ -15,67 +15,100 @@
# limitations under the License.
#
-apiVersion: apiextensions.k8s.io/v1beta1
+apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: submarines.submarine.apache.org
+ labels:
+ app.kubernetes.io/name: submarine-operator
+ app.kubernetes.io/version: "0.7.0"
+ app.kubernetes.io/component: submarine-operator
+ app.kubernetes.io/managed-by: helm
spec:
group: submarine.apache.org
- version: v1alpha1
names:
kind: Submarine
+ listKind: SubmarineList
plural: submarines
+ singular: submarine
+ shortNames:
+ - sm
+ categories:
+ - all
scope: Namespaced
- validation:
- openAPIV3Schema:
- type: object
- required: ["spec"]
- properties:
- spec:
- type: object
- required:
- - version
- properties:
- version: # submarine docker image version
- type: string
- server:
- type: object
- properties:
- image: # Use this to overwrite the image when development
- type: string
- replicas:
- type: integer
- minimum: 1
- database:
- type: object
- properties:
- image: # Use this to overwrite the image when development
- type: string
- replicas:
- type: integer
- minimum: 1
- storageSize:
- type: string
- mysqlRootPasswordSecret:
- type: string
- tensorboard:
- type: object
- properties:
- enabled:
- type: boolean
- storageSize:
- type: string
- mlflow:
- type: object
- properties:
- enabled:
- type: boolean
- storageSize:
- type: string
- minio:
- type: object
- properties:
- enabled:
- type: boolean
- storageSize:
- type: string
+ versions:
+ - name: v1alpha1
+ schema:
+ openAPIV3Schema:
+ type: object
+ required: ["spec"]
+ properties:
+ spec:
+ type: object
+ required:
+ - version
+ properties:
+ version:
+ description: submarine docker image version
+ type: string
+ server:
+ type: object
+ properties:
+ image:
+ description: Use this to overwrite the image when
development
+ type: string
+ replicas:
+ type: integer
+ minimum: 1
+ database:
+ type: object
+ properties:
+ image:
+ description: Use this to overwrite the image when
development
+ type: string
+ replicas:
+ type: integer
+ minimum: 1
+ storageSize:
+ type: string
+ mysqlRootPasswordSecret:
+ type: string
+ tensorboard:
+ type: object
+ properties:
+ enabled:
+ type: boolean
+ storageSize:
+ type: string
+ mlflow:
+ type: object
+ properties:
+ enabled:
+ type: boolean
+ storageSize:
+ type: string
+ minio:
+ type: object
+ properties:
+ enabled:
+ type: boolean
+ storageSize:
+ type: string
+ status:
+ type: object
+ properties:
+ availableServerReplicas:
+ type: integer
+ availableDatabaseReplicas:
+ type: integer
+ submarineState:
+ type: object
+ properties:
+ state:
+ type: string
+ errorMessage:
+ type: string
+ served: true
+ storage: true
+ subresources:
+ status: {}
\ No newline at end of file
diff --git a/helm-charts/submarine/templates/rbac.yaml
b/helm-charts/submarine/templates/rbac.yaml
index e7101b0..f54a60d 100644
--- a/helm-charts/submarine/templates/rbac.yaml
+++ b/helm-charts/submarine/templates/rbac.yaml
@@ -24,6 +24,7 @@ rules:
- submarine.apache.org
resources:
- submarines
+ - submarines/status
verbs:
- "*"
- apiGroups:
@@ -85,6 +86,7 @@ rules:
- apiextensions.k8s.io
resources:
- customresourcedefinitions
+ - customresourcedefinitions/status
verbs:
- "*"
---
diff --git a/submarine-cloud-v2/pkg/controller/controller.go
b/submarine-cloud-v2/pkg/controller/controller.go
index d28fce3..cc69025 100644
--- a/submarine-cloud-v2/pkg/controller/controller.go
+++ b/submarine-cloud-v2/pkg/controller/controller.go
@@ -324,7 +324,8 @@ func (c *Controller) updateSubmarineStatus(submarine,
submarineCopy *v1alpha1.Su
return nil
}
- _, err =
c.submarineclientset.SubmarineV1alpha1().Submarines(submarine.Namespace).Update(context.TODO(),
submarineCopy, metav1.UpdateOptions{})
+ // Update submarine status
+ _, err =
c.submarineclientset.SubmarineV1alpha1().Submarines(submarine.Namespace).UpdateStatus(context.TODO(),
submarineCopy, metav1.UpdateOptions{})
if err != nil {
return err
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]