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 1ae1b7a  SUBMARINE-997. Redefinition of submarine CRD
1ae1b7a is described below

commit 1ae1b7a4ec6ee0a4fe26e4b6afdb63b2d4e81c84
Author: MortalHappiness <[email protected]>
AuthorDate: Fri Aug 27 15:04:29 2021 +0800

    SUBMARINE-997. Redefinition of submarine CRD
    
    ### What is this PR for?
    Since we use StorageClass to replace PersistentVolume in the operator, we 
need to redefine the submarine CRD.
    
    ### What type of PR is it?
    [Improvement]
    
    ### Todos
    
    ### What is the Jira issue?
    https://issues.apache.org/jira/projects/SUBMARINE/issues/SUBMARINE-997
    
    ### How should this be tested?
    
    ### Screenshots (if appropriate)
    
    ### Questions:
    * Do the license files need updating? No
    * Are there breaking changes for older versions? No
    * Does this need new documentation? No
    
    Author: MortalHappiness <[email protected]>
    
    Signed-off-by: Kevin <[email protected]>
    
    Closes #725 from MortalHappiness/SUBMARINE-997 and squashes the following 
commits:
    
    60afc1ff [MortalHappiness] SUBMARINE-997. Redefinition of submarine CRD
---
 submarine-cloud-v2/README.md                       |  1 -
 .../artifacts/examples/example-submarine.yaml      |  6 --
 .../helm-charts/submarine-operator/crds/crd.yaml   | 12 ----
 .../pkg/apis/submarine/v1alpha1/types.go           | 30 ++++-----
 .../submarine/v1alpha1/zz_generated.deepcopy.go    | 71 ++++++++--------------
 submarine-cloud-v2/pkg/controller/controller.go    |  7 ---
 6 files changed, 36 insertions(+), 91 deletions(-)

diff --git a/submarine-cloud-v2/README.md b/submarine-cloud-v2/README.md
index 4b7fbbc..e8f2b0f 100644
--- a/submarine-cloud-v2/README.md
+++ b/submarine-cloud-v2/README.md
@@ -53,7 +53,6 @@ make
 ./submarine-operator
 
 # Step3: Deploy a Submarine
-kubectl apply -f helm-charts/submarine-operator/crds/crd.yaml
 kubectl create ns submarine-user-test
 kubectl apply -n submarine-user-test -f 
artifacts/examples/example-submarine.yaml
 
diff --git a/submarine-cloud-v2/artifacts/examples/example-submarine.yaml 
b/submarine-cloud-v2/artifacts/examples/example-submarine.yaml
index 788741c..37145e8 100644
--- a/submarine-cloud-v2/artifacts/examples/example-submarine.yaml
+++ b/submarine-cloud-v2/artifacts/examples/example-submarine.yaml
@@ -38,9 +38,3 @@ spec:
   minio:
     enabled: true
     storageSize: "10Gi"
-  storage:
-    # storageType: "nfs"
-    # nfsPath: "/"
-    # nfsIP: "10.96.0.2"
-    storageType: "host"
-    hostPath: "/tmp/submarine/host"
diff --git a/submarine-cloud-v2/helm-charts/submarine-operator/crds/crd.yaml 
b/submarine-cloud-v2/helm-charts/submarine-operator/crds/crd.yaml
index bd7be82..48fa7e8 100644
--- a/submarine-cloud-v2/helm-charts/submarine-operator/crds/crd.yaml
+++ b/submarine-cloud-v2/helm-charts/submarine-operator/crds/crd.yaml
@@ -79,15 +79,3 @@ spec:
                   type: boolean
                 storageSize:
                   type: string
-            storage:
-              type: object
-              properties:
-                storageType:
-                  type: string
-                  pattern: "^(host|nfs)$"
-                hostPath:
-                  type: string
-                nfsPath:
-                  type: string
-                nfsIP:
-                  type: string
diff --git a/submarine-cloud-v2/pkg/apis/submarine/v1alpha1/types.go 
b/submarine-cloud-v2/pkg/apis/submarine/v1alpha1/types.go
index 3fb2830..a1cc489 100644
--- a/submarine-cloud-v2/pkg/apis/submarine/v1alpha1/types.go
+++ b/submarine-cloud-v2/pkg/apis/submarine/v1alpha1/types.go
@@ -32,49 +32,41 @@ type Submarine struct {
        Status SubmarineStatus `json:"status"`
 }
 
-type SubmarineServer struct {
+type SubmarineServerSpec struct {
        Image    string `json:"image"`
        Replicas *int32 `json:"replicas"`
 }
 
-type SubmarineDatabase struct {
+type SubmarineDatabaseSpec struct {
        Image                   string `json:"image"`
        Replicas                *int32 `json:"replicas"`
        StorageSize             string `json:"storageSize"`
        MysqlRootPasswordSecret string `json:"mysqlRootPasswordSecret"`
 }
 
-type SubmarineTensorboard struct {
+type SubmarineTensorboardSpec struct {
        Enabled     *bool  `json:"enabled"`
        StorageSize string `json:"storageSize"`
 }
 
-type SubmarineMlflow struct {
+type SubmarineMlflowSpec struct {
        Enabled     *bool  `json:"enabled"`
        StorageSize string `json:"storageSize"`
 }
 
-type SubmarineMinio struct {
+type SubmarineMinioSpec struct {
        Enabled     *bool  `json:"enabled"`
        StorageSize string `json:"storageSize"`
 }
 
-type SubmarineStorage struct {
-       StorageType string `json:"storageType"`
-       HostPath    string `json:"hostPath"`
-       NfsPath     string `json:"nfsPath"`
-       NfsIP       string `json:"nfsIP"`
-}
-
 // SubmarineSpec is the spec for a Submarine resource
 type SubmarineSpec struct {
-       Version     string                `json:"version"`
-       Server      *SubmarineServer      `json:"server"`
-       Database    *SubmarineDatabase    `json:"database"`
-       Tensorboard *SubmarineTensorboard `json:"tensorboard"`
-       Mlflow      *SubmarineMlflow      `json:"mlflow"`
-       Minio       *SubmarineMinio       `json:"minio"`
-       Storage     *SubmarineStorage     `json:"storage"`
+       Version     string                    `json:"version"`
+       Server      *SubmarineServerSpec      `json:"server"`
+       Database    *SubmarineDatabaseSpec    `json:"database"`
+       Tensorboard *SubmarineTensorboardSpec `json:"tensorboard"`
+       Mlflow      *SubmarineMlflowSpec      `json:"mlflow"`
+       Minio       *SubmarineMinioSpec       `json:"minio"`
 }
 
 // SubmarineStateType represents the type of the current state of a submarine.
diff --git 
a/submarine-cloud-v2/pkg/apis/submarine/v1alpha1/zz_generated.deepcopy.go 
b/submarine-cloud-v2/pkg/apis/submarine/v1alpha1/zz_generated.deepcopy.go
index ee083d3..fe813e3 100644
--- a/submarine-cloud-v2/pkg/apis/submarine/v1alpha1/zz_generated.deepcopy.go
+++ b/submarine-cloud-v2/pkg/apis/submarine/v1alpha1/zz_generated.deepcopy.go
@@ -54,7 +54,7 @@ func (in *Submarine) DeepCopyObject() runtime.Object {
 }
 
 // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, 
writing into out. in must be non-nil.
-func (in *SubmarineDatabase) DeepCopyInto(out *SubmarineDatabase) {
+func (in *SubmarineDatabaseSpec) DeepCopyInto(out *SubmarineDatabaseSpec) {
        *out = *in
        if in.Replicas != nil {
                in, out := &in.Replicas, &out.Replicas
@@ -64,12 +64,12 @@ func (in *SubmarineDatabase) DeepCopyInto(out 
*SubmarineDatabase) {
        return
 }
 
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, 
creating a new SubmarineDatabase.
-func (in *SubmarineDatabase) DeepCopy() *SubmarineDatabase {
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, 
creating a new SubmarineDatabaseSpec.
+func (in *SubmarineDatabaseSpec) DeepCopy() *SubmarineDatabaseSpec {
        if in == nil {
                return nil
        }
-       out := new(SubmarineDatabase)
+       out := new(SubmarineDatabaseSpec)
        in.DeepCopyInto(out)
        return out
 }
@@ -108,7 +108,7 @@ func (in *SubmarineList) DeepCopyObject() runtime.Object {
 }
 
 // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, 
writing into out. in must be non-nil.
-func (in *SubmarineMinio) DeepCopyInto(out *SubmarineMinio) {
+func (in *SubmarineMinioSpec) DeepCopyInto(out *SubmarineMinioSpec) {
        *out = *in
        if in.Enabled != nil {
                in, out := &in.Enabled, &out.Enabled
@@ -118,18 +118,18 @@ func (in *SubmarineMinio) DeepCopyInto(out 
*SubmarineMinio) {
        return
 }
 
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, 
creating a new SubmarineMinio.
-func (in *SubmarineMinio) DeepCopy() *SubmarineMinio {
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, 
creating a new SubmarineMinioSpec.
+func (in *SubmarineMinioSpec) DeepCopy() *SubmarineMinioSpec {
        if in == nil {
                return nil
        }
-       out := new(SubmarineMinio)
+       out := new(SubmarineMinioSpec)
        in.DeepCopyInto(out)
        return out
 }
 
 // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, 
writing into out. in must be non-nil.
-func (in *SubmarineMlflow) DeepCopyInto(out *SubmarineMlflow) {
+func (in *SubmarineMlflowSpec) DeepCopyInto(out *SubmarineMlflowSpec) {
        *out = *in
        if in.Enabled != nil {
                in, out := &in.Enabled, &out.Enabled
@@ -139,18 +139,18 @@ func (in *SubmarineMlflow) DeepCopyInto(out 
*SubmarineMlflow) {
        return
 }
 
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, 
creating a new SubmarineMlflow.
-func (in *SubmarineMlflow) DeepCopy() *SubmarineMlflow {
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, 
creating a new SubmarineMlflowSpec.
+func (in *SubmarineMlflowSpec) DeepCopy() *SubmarineMlflowSpec {
        if in == nil {
                return nil
        }
-       out := new(SubmarineMlflow)
+       out := new(SubmarineMlflowSpec)
        in.DeepCopyInto(out)
        return out
 }
 
 // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, 
writing into out. in must be non-nil.
-func (in *SubmarineServer) DeepCopyInto(out *SubmarineServer) {
+func (in *SubmarineServerSpec) DeepCopyInto(out *SubmarineServerSpec) {
        *out = *in
        if in.Replicas != nil {
                in, out := &in.Replicas, &out.Replicas
@@ -160,12 +160,12 @@ func (in *SubmarineServer) DeepCopyInto(out 
*SubmarineServer) {
        return
 }
 
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, 
creating a new SubmarineServer.
-func (in *SubmarineServer) DeepCopy() *SubmarineServer {
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, 
creating a new SubmarineServerSpec.
+func (in *SubmarineServerSpec) DeepCopy() *SubmarineServerSpec {
        if in == nil {
                return nil
        }
-       out := new(SubmarineServer)
+       out := new(SubmarineServerSpec)
        in.DeepCopyInto(out)
        return out
 }
@@ -175,34 +175,29 @@ func (in *SubmarineSpec) DeepCopyInto(out *SubmarineSpec) 
{
        *out = *in
        if in.Server != nil {
                in, out := &in.Server, &out.Server
-               *out = new(SubmarineServer)
+               *out = new(SubmarineServerSpec)
                (*in).DeepCopyInto(*out)
        }
        if in.Database != nil {
                in, out := &in.Database, &out.Database
-               *out = new(SubmarineDatabase)
+               *out = new(SubmarineDatabaseSpec)
                (*in).DeepCopyInto(*out)
        }
        if in.Tensorboard != nil {
                in, out := &in.Tensorboard, &out.Tensorboard
-               *out = new(SubmarineTensorboard)
+               *out = new(SubmarineTensorboardSpec)
                (*in).DeepCopyInto(*out)
        }
        if in.Mlflow != nil {
                in, out := &in.Mlflow, &out.Mlflow
-               *out = new(SubmarineMlflow)
+               *out = new(SubmarineMlflowSpec)
                (*in).DeepCopyInto(*out)
        }
        if in.Minio != nil {
                in, out := &in.Minio, &out.Minio
-               *out = new(SubmarineMinio)
+               *out = new(SubmarineMinioSpec)
                (*in).DeepCopyInto(*out)
        }
-       if in.Storage != nil {
-               in, out := &in.Storage, &out.Storage
-               *out = new(SubmarineStorage)
-               **out = **in
-       }
        return
 }
 
@@ -250,23 +245,7 @@ func (in *SubmarineStatus) DeepCopy() *SubmarineStatus {
 }
 
 // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, 
writing into out. in must be non-nil.
-func (in *SubmarineStorage) DeepCopyInto(out *SubmarineStorage) {
-       *out = *in
-       return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, 
creating a new SubmarineStorage.
-func (in *SubmarineStorage) DeepCopy() *SubmarineStorage {
-       if in == nil {
-               return nil
-       }
-       out := new(SubmarineStorage)
-       in.DeepCopyInto(out)
-       return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, 
writing into out. in must be non-nil.
-func (in *SubmarineTensorboard) DeepCopyInto(out *SubmarineTensorboard) {
+func (in *SubmarineTensorboardSpec) DeepCopyInto(out 
*SubmarineTensorboardSpec) {
        *out = *in
        if in.Enabled != nil {
                in, out := &in.Enabled, &out.Enabled
@@ -276,12 +255,12 @@ func (in *SubmarineTensorboard) DeepCopyInto(out 
*SubmarineTensorboard) {
        return
 }
 
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, 
creating a new SubmarineTensorboard.
-func (in *SubmarineTensorboard) DeepCopy() *SubmarineTensorboard {
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, 
creating a new SubmarineTensorboardSpec.
+func (in *SubmarineTensorboardSpec) DeepCopy() *SubmarineTensorboardSpec {
        if in == nil {
                return nil
        }
-       out := new(SubmarineTensorboard)
+       out := new(SubmarineTensorboardSpec)
        in.DeepCopyInto(out)
        return out
 }
diff --git a/submarine-cloud-v2/pkg/controller/controller.go 
b/submarine-cloud-v2/pkg/controller/controller.go
index e965416..0fe6244 100644
--- a/submarine-cloud-v2/pkg/controller/controller.go
+++ b/submarine-cloud-v2/pkg/controller/controller.go
@@ -591,13 +591,6 @@ func (c *Controller) validateSubmarine(submarine 
*v1alpha1.Submarine) error {
                return err
        }
 
-       // Check storage type
-       storageType := submarine.Spec.Storage.StorageType
-       if storageType != "nfs" && storageType != "host" {
-               err = fmt.Errorf("invalid storageType '%s' found in submarine 
spec, nothing will be created. Valid storage types are 'nfs' and 'host'", 
storageType)
-               return err
-       }
-
        return nil
 }
 

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to