Add compose support for cluster volumes
Signed-off-by: Drew Erny <derny@mirantis.com>
This commit is contained in:
@ -384,14 +384,15 @@ type ServicePortConfig struct {
|
||||
|
||||
// ServiceVolumeConfig are references to a volume used by a service
|
||||
type ServiceVolumeConfig struct {
|
||||
Type string `yaml:",omitempty" json:"type,omitempty"`
|
||||
Source string `yaml:",omitempty" json:"source,omitempty"`
|
||||
Target string `yaml:",omitempty" json:"target,omitempty"`
|
||||
ReadOnly bool `mapstructure:"read_only" yaml:"read_only,omitempty" json:"read_only,omitempty"`
|
||||
Consistency string `yaml:",omitempty" json:"consistency,omitempty"`
|
||||
Bind *ServiceVolumeBind `yaml:",omitempty" json:"bind,omitempty"`
|
||||
Volume *ServiceVolumeVolume `yaml:",omitempty" json:"volume,omitempty"`
|
||||
Tmpfs *ServiceVolumeTmpfs `yaml:",omitempty" json:"tmpfs,omitempty"`
|
||||
Type string `yaml:",omitempty" json:"type,omitempty"`
|
||||
Source string `yaml:",omitempty" json:"source,omitempty"`
|
||||
Target string `yaml:",omitempty" json:"target,omitempty"`
|
||||
ReadOnly bool `mapstructure:"read_only" yaml:"read_only,omitempty" json:"read_only,omitempty"`
|
||||
Consistency string `yaml:",omitempty" json:"consistency,omitempty"`
|
||||
Bind *ServiceVolumeBind `yaml:",omitempty" json:"bind,omitempty"`
|
||||
Volume *ServiceVolumeVolume `yaml:",omitempty" json:"volume,omitempty"`
|
||||
Tmpfs *ServiceVolumeTmpfs `yaml:",omitempty" json:"tmpfs,omitempty"`
|
||||
Cluster *ServiceVolumeCluster `yaml:",omitempty" json:"cluster,omitempty"`
|
||||
}
|
||||
|
||||
// ServiceVolumeBind are options for a service volume of type bind
|
||||
@ -409,6 +410,10 @@ type ServiceVolumeTmpfs struct {
|
||||
Size int64 `yaml:",omitempty" json:"size,omitempty"`
|
||||
}
|
||||
|
||||
// ServiceVolumeCluster are options for a service volume of type cluster.
|
||||
// Deliberately left blank for future options, but unused now.
|
||||
type ServiceVolumeCluster struct{}
|
||||
|
||||
// FileReferenceConfig for a reference to a swarm file object
|
||||
type FileReferenceConfig struct {
|
||||
Source string `yaml:",omitempty" json:"source,omitempty"`
|
||||
@ -480,6 +485,63 @@ type VolumeConfig struct {
|
||||
External External `yaml:",omitempty" json:"external,omitempty"`
|
||||
Labels Labels `yaml:",omitempty" json:"labels,omitempty"`
|
||||
Extras map[string]interface{} `yaml:",inline" json:"-"`
|
||||
Spec *ClusterVolumeSpec `mapstructure:"x-cluster-spec" yaml:"x-cluster-spec,omitempty" json:"x-cluster-spec,omitempty"`
|
||||
}
|
||||
|
||||
// ClusterVolumeSpec defines all the configuration and options specific to a
|
||||
// cluster (CSI) volume.
|
||||
type ClusterVolumeSpec struct {
|
||||
Group string `yaml:",omitempty" json:"group,omitempty"`
|
||||
AccessMode *AccessMode `mapstructure:"access_mode" yaml:"access_mode,omitempty" json:"access_mode,omitempty"`
|
||||
AccessibilityRequirements *TopologyRequirement `mapstructure:"accessibility_requirements" yaml:"accessibility_requirements,omitempty" json:"accessibility_requirements,omitempty"`
|
||||
CapacityRange *CapacityRange `mapstructure:"capacity_range" yaml:"capacity_range,omitempty" json:"capacity_range,omitempty"`
|
||||
|
||||
Secrets []VolumeSecret `yaml:",omitempty" json:"secrets,omitempty"`
|
||||
|
||||
Availability string `yaml:",omitempty" json:"availability,omitempty"`
|
||||
}
|
||||
|
||||
// AccessMode defines the way a cluster volume is accessed by the tasks
|
||||
type AccessMode struct {
|
||||
Scope string `yaml:",omitempty" json:"scope,omitempty"`
|
||||
Sharing string `yaml:",omitempty" json:"sharing,omitempty"`
|
||||
|
||||
MountVolume *MountVolume `mapstructure:"mount_volume" yaml:"mount_volume,omitempty" json:"mount_volume,omitempty"`
|
||||
BlockVolume *BlockVolume `mapstructure:"block_volume" yaml:"block_volume,omitempty" json:"block_volume,omitempty"`
|
||||
}
|
||||
|
||||
// MountVolume defines options for using a volume as a Mount
|
||||
type MountVolume struct {
|
||||
FsType string `mapstructure:"fs_type" yaml:"fs_type,omitempty" json:"fs_type,omitempty"`
|
||||
MountFlags []string `mapstructure:"mount_flags" yaml:"mount_flags,omitempty" json:"mount_flags,omitempty"`
|
||||
}
|
||||
|
||||
// BlockVolume is deliberately empty
|
||||
type BlockVolume struct{}
|
||||
|
||||
// TopologyRequirement defines the requirements for volume placement in the
|
||||
// cluster.
|
||||
type TopologyRequirement struct {
|
||||
Requisite []Topology `yaml:",omitempty" json:"requisite,omitempty"`
|
||||
Preferred []Topology `yaml:",omitempty" json:"preferred,omitempty"`
|
||||
}
|
||||
|
||||
// Topology defines a particular topology group
|
||||
type Topology struct {
|
||||
Segments Mapping `yaml:",omitempty" json:"segments,omitempty"`
|
||||
}
|
||||
|
||||
// CapacityRange defines the minimum and maximum size of a volume.
|
||||
type CapacityRange struct {
|
||||
RequiredBytes UnitBytes `mapstructure:"required_bytes" yaml:"required_bytes,omitempty" json:"required_bytes,omitempty"`
|
||||
LimitBytes UnitBytes `mapstructure:"limit_bytes" yaml:"limit_bytes,omitempty" json:"limit_bytes,omitempty"`
|
||||
}
|
||||
|
||||
// VolumeSecret defines a secret that needs to be passed to the CSI plugin when
|
||||
// using the volume.
|
||||
type VolumeSecret struct {
|
||||
Key string `yaml:",omitempty" json:"key,omitempty"`
|
||||
Secret string `yaml:",omitempty" json:"secret,omitempty"`
|
||||
}
|
||||
|
||||
// External identifies a Volume or Network as a reference to a resource that is
|
||||
|
||||
Reference in New Issue
Block a user