diff --git a/storage/volume/config.go b/storage/volume/config.go index 7154242e2..79acc64ef 100644 --- a/storage/volume/config.go +++ b/storage/volume/config.go @@ -6,10 +6,10 @@ import ( // Config represents volume config struct. type Config struct { - ControlAddress string - Timeout time.Duration // operation timeout. - RemoveVolume bool - DefaultBackend string `json:"volume-default-driver"` - VolumeMetaPath string `json:"volume-meta-dir"` - DriverAlias string `json:"volume-driver-alias"` + ControlServerAddress string `json:"control-server-address"` // control server address in csi. + Timeout time.Duration `json:"volume-timeout"` // operation timeout. + RemoveVolume bool `json:"remove-volume"` // remove volume add data or volume's metadata when remove pouch volume. + DefaultBackend string `json:"volume-default-driver"` // default volume backend. + VolumeMetaPath string `json:"volume-meta-dir"` // volume metadata store path. + DriverAlias string `json:"volume-driver-alias"` // driver alias configure. } diff --git a/storage/volume/core.go b/storage/volume/core.go index 41f3cdf41..946290c31 100644 --- a/storage/volume/core.go +++ b/storage/volume/core.go @@ -27,9 +27,9 @@ type Core struct { // NewCore returns Core struct instance with volume config. func NewCore(cfg Config) (*Core, error) { c := &Core{Config: cfg} - if cfg.ControlAddress != "" { + if cfg.ControlServerAddress != "" { c.EnableControl = true - c.BaseURL = cfg.ControlAddress + c.BaseURL = cfg.ControlServerAddress } else { c.EnableControl = false } diff --git a/storage/volume/modules/ceph/ceph.go b/storage/volume/modules/ceph/ceph.go index 9a2418ab4..6c107f053 100644 --- a/storage/volume/modules/ceph/ceph.go +++ b/storage/volume/modules/ceph/ceph.go @@ -126,7 +126,7 @@ func (c *Ceph) Options() map[string]types.Option { func (c *Ceph) Format(ctx driver.Context, v *types.Volume, s *types.Storage) error { ctx.Log.Debugf("Ceph format volume: %s", v.Name) - device, err := rbdMap(ctx, v, s.Spec.Address, s.Spec.Key) + device, err := rbdMap(ctx, v, s.Spec.Address, s.Spec.Keyring) if err != nil { ctx.Log.Errorf("Ceph map volume: %s failed: %v", v.Name, err) return err @@ -159,7 +159,7 @@ func (c *Ceph) Attach(ctx driver.Context, v *types.Volume, s *types.Storage) err volumePath := v.Path() // Map rbd device - devName, err := rbdMap(ctx, v, s.Spec.Address, s.Spec.Key) + devName, err := rbdMap(ctx, v, s.Spec.Address, s.Spec.Keyring) if err != nil { ctx.Log.Errorf("Ceph volume: %s map error: %v", v.Name, err) return err @@ -257,7 +257,7 @@ func (c *Ceph) Report(ctx driver.Context) ([]*types.Storage, error) { } keyring := fmt.Sprintf("%s:%s", "admin", key.Value()) encoded := base64.StdEncoding.EncodeToString([]byte(keyring)) - s.Spec.Key = encoded + s.Spec.Keyring = encoded // get ceph quorum status cmd := NewCephCommand("ceph", conf) diff --git a/storage/volume/types/storage.go b/storage/volume/types/storage.go index b45305d29..e1425e930 100644 --- a/storage/volume/types/storage.go +++ b/storage/volume/types/storage.go @@ -8,13 +8,13 @@ import ( // StorageSpec represents storage spec. type StorageSpec struct { - Type string `json:"type"` // storage type - ID string `json:"id,omitempty"` // storage uid or unique name - Name string `json:"name,omitempty"` // storage cluster name - Key string `json:"key,omitempty"` // storage access key - API string `json:"api"` // gateway address - Address string `json:"address"` // for ceph it's monitor ip:port,ip:port, pangu2's river master - PoolSpec map[string]PoolSpec `json:"poolspec"` // storage pool spec + Type string `json:"type"` // storage type + ID string `json:"id,omitempty"` // storage uid or unique name + Address string `json:"address"` // storage address, such as ceph it's monitor ip:port,ip:port + PoolSpec map[string]PoolSpec `json:"poolspec"` // storage pool spec + + ClusterName string `json:"clustername,omitempty"` // storage cluster name + Keyring string `json:"keyring,omitempty"` // storage access key, such as ceph's keyring user:secret } // PoolSpec represents storage pool spec. diff --git a/storage/volume/types/volume.go b/storage/volume/types/volume.go index 4990365f1..fcd95d5af 100644 --- a/storage/volume/types/volume.go +++ b/storage/volume/types/volume.go @@ -87,6 +87,7 @@ type VolumeSpec struct { Selector Selector `json:"selector"` Operable bool `json:"operable"` Backend string `json:"backend,omitempty"` + MountMode string `json:"mountMode,omitempty"` *VolumeConfig `json:"config,inline"` Extra map[string]string `json:"extra"` }