diff --git a/api/handler/service.go b/api/handler/service.go index 30c790a59..0e29ecaa9 100644 --- a/api/handler/service.go +++ b/api/handler/service.go @@ -565,13 +565,26 @@ func (s *ServiceAction) ServiceCreate(sc *api_model.ServiceStruct) error { for _, volumn := range volumns { v := dbmodel.TenantServiceVolume{ - ServiceID: ts.ServiceID, - Category: volumn.Category, - VolumeType: volumn.VolumeType, - VolumeName: volumn.VolumeName, - HostPath: volumn.HostPath, - VolumePath: volumn.VolumePath, - IsReadOnly: volumn.IsReadOnly, + ServiceID: ts.ServiceID, + Category: volumn.Category, + VolumeType: volumn.VolumeType, + VolumeName: volumn.VolumeName, + HostPath: volumn.HostPath, + VolumePath: volumn.VolumePath, + IsReadOnly: volumn.IsReadOnly, + VolumeCapacity: volumn.VolumeCapacity, + // AccessMode 读写模式(Important! A volume can only be mounted using one access mode at a time, even if it supports many. For example, a GCEPersistentDisk can be mounted as ReadWriteOnce by a single node or ReadOnlyMany by many nodes, but not at the same time. #https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes) + AccessMode: volumn.AccessMode, + // SharePolicy 共享模式 + SharePolicy: volumn.SharePolicy, + // BackupPolicy 备份策略 + BackupPolicy: volumn.BackupPolicy, + // ReclaimPolicy 回收策略 + ReclaimPolicy: volumn.ReclaimPolicy, + // AllowExpansion 是否支持扩展 + AllowExpansion: volumn.AllowExpansion, + // VolumeProviderName 使用的存储驱动别名 + VolumeProviderName: volumn.VolumeProviderName, } v.ServiceID = ts.ServiceID if volumn.VolumeType == "" { diff --git a/api/model/model.go b/api/model/model.go index 1ab31b85a..a46e5086b 100644 --- a/api/model/model.go +++ b/api/model/model.go @@ -351,7 +351,6 @@ type Endpoints struct { //TenantServiceVolumeStruct - type TenantServiceVolumeStruct struct { - Model ServiceID string ` json:"service_id"` //服务类型 Category string `json:"category"` @@ -367,6 +366,20 @@ type TenantServiceVolumeStruct struct { IsReadOnly bool `json:"is_read_only"` FileContent string `json:"file_content"` + // VolumeCapacity 存储大小 + VolumeCapacity int64 `json:"volume_capacity"` + // AccessMode 读写模式(Important! A volume can only be mounted using one access mode at a time, even if it supports many. For example, a GCEPersistentDisk can be mounted as ReadWriteOnce by a single node or ReadOnlyMany by many nodes, but not at the same time. #https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes) + AccessMode string `json:"access_mode"` + // SharePolicy 共享模式 + SharePolicy string `json:"share_policy"` + // BackupPolicy 备份策略 + BackupPolicy string `json:"backup_policy"` + // ReclaimPolicy 回收策略 + ReclaimPolicy string `json:"reclaim_policy"` + // AllowExpansion 是否支持扩展 + AllowExpansion bool `json:"allow_expansion"` + // VolumeProviderName 使用的存储驱动别名 + VolumeProviderName string `json:"volume_provider_name"` } //DependService struct for depend service diff --git a/go.mod b/go.mod index 36dd5758e..d73f53841 100644 --- a/go.mod +++ b/go.mod @@ -40,7 +40,7 @@ require ( github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b github.com/golang/mock v1.4.3 github.com/golang/protobuf v1.4.2 - github.com/goodrain/rainbond-oam v0.0.0-20210206060607-d781c2f593de + github.com/goodrain/rainbond-oam v0.0.0-20210206075623-511d0796af43 github.com/goodrain/rainbond-operator v1.0.0 github.com/gorilla/mux v1.7.4 // indirect github.com/gorilla/websocket v1.4.2 diff --git a/go.sum b/go.sum index 8fee9ec96..dd3763071 100644 --- a/go.sum +++ b/go.sum @@ -684,8 +684,8 @@ github.com/golangplus/bytes v0.0.0-20160111154220-45c989fe5450/go.mod h1:Bk6SMAO github.com/golangplus/fmt v0.0.0-20150411045040-2a5d6d7d2995/go.mod h1:lJgMEyOkYFkPcDKwRXegd+iM6E7matEszMG5HhwytU8= github.com/golangplus/testing v0.0.0-20180327235837-af21d9c3145e/go.mod h1:0AA//k/eakGydO4jKRoRL2j92ZKSzTgj9tclaCrvXHk= github.com/gomarkdown/markdown v0.0.0-20190222000725-ee6a7931a1e4/go.mod h1:gmFANS06wAVmF0B9yi65QKsRmPQ97tze7FRLswua+OY= -github.com/goodrain/rainbond-oam v0.0.0-20210206060607-d781c2f593de h1:UJ3YuWzXcWH9MP3oIHD4BWonaLBWawZ/AnYJ9MGB+n4= -github.com/goodrain/rainbond-oam v0.0.0-20210206060607-d781c2f593de/go.mod h1:/dRehR3e1pGexOaIDjA44AHBlVPbb7v+O7GWAVyo740= +github.com/goodrain/rainbond-oam v0.0.0-20210206075623-511d0796af43 h1:xhUwEWQKk+maL6CmV5Y6kxKb+jA/RvN6SZcDbNm51FM= +github.com/goodrain/rainbond-oam v0.0.0-20210206075623-511d0796af43/go.mod h1:/dRehR3e1pGexOaIDjA44AHBlVPbb7v+O7GWAVyo740= github.com/goodrain/rainbond-operator v1.0.0 h1:8b/yGjwRC+wPKNq3THiddZyf1KKnb59CG0c/esEXUfI= github.com/goodrain/rainbond-operator v1.0.0/go.mod h1:uJ2ZEOtNG8bEa5yRov8u7ydWfjCnWJWHttfR8f1dozk= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=