types

package
v0.0.0-...-1b9e8c6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 27, 2018 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// APIVersion defined control server api version.
	APIVersion = "/api/v1"
)

Functions

This section is empty.

Types

type ConditionStatus

type ConditionStatus string

ConditionStatus string enum.

const (
	// ConditionTrue NodeConditionType is true.
	ConditionTrue ConditionStatus = "True"
	// ConditionFalse NodeConditionType is false.
	ConditionFalse ConditionStatus = "False"
	// ConditionUnknown NodeConditionType is Unknown.
	ConditionUnknown ConditionStatus = "Unknown"
)

type Option

type Option struct {
	Value string
	Desc  string
}

Option represents volume option struct.

type PoolSpec

type PoolSpec struct {
	WriteBps   int64 `json:"iowbps"`         // storage write bytes per second
	ReadBps    int64 `json:"iorbps"`         // storage read bytes per second
	ReadIOps   int64 `json:"ioriops"`        // storage read io count per second
	WriteIOps  int64 `json:"iowiops"`        // storage write io count per second
	IOps       int64 `json:"ioiops"`         // storage total io count per second
	Capacity   int64 `json:"capacity"`       // storage capacity like: MB/GB/TB/PB
	Available  int64 `json:"available"`      // storage available like: MB/GB/TB/PB
	MaxVolumes int64 `json:"maxvolume"`      // max disks in this storage cluster
	NicSendBps int64 `json:"networkSendBps"` // nic card send bytes per second
	NicRecvBps int64 `json:"networkRecvBps"` // nic card recv bytes per second
}

PoolSpec represents storage pool spec.

type Selector

type Selector []SelectorRequirement

Selector defines SelectorRequirement slice type.

func (*Selector) AsRequirement

func (n *Selector) AsRequirement() []labels.Requirement

AsRequirement returns requirement.

func (*Selector) AsSelector

func (n *Selector) AsSelector() labels.Selector

AsSelector returns selector.

type SelectorRequirement

type SelectorRequirement struct {
	// The label key that the selector applies to.
	Key string `json:"key"`
	// Represents a key's relationship to a set of values.
	// Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.
	Operator selection.Operator `json:"operator"`
	// An array of string values. If the operator is In or NotIn,
	// the values array must be non-empty. If the operator is Exists or DoesNotExist,
	// the values array must be empty. If the operator is Gt or Lt, the values
	// array must have a single element.
	Values []string `json:"values,omitempty"`
}

SelectorRequirement is a selector that contains values, a key, and an operator that relates the key and values.

type Storage

type Storage struct {
	meta.ObjectMeta `json:",inline"`
	Spec            *StorageSpec   `json:"spec,omitempty"`
	Status          *StorageStatus `json:"status,omitempty"`
}

Storage represents storage struct.

func (*Storage) Address

func (s *Storage) Address() string

Address return storage operate address.

func (*Storage) SetAddress

func (s *Storage) SetAddress(address string)

SetAddress set storage operate address.

func (*Storage) StorageID

func (s *Storage) StorageID() StorageID

StorageID returns storage's uid.

type StorageID

type StorageID struct {
	UID string
}

StorageID represents storage uid.

func NewStorageID

func NewStorageID(uid string) StorageID

NewStorageID is used to set uid.

func (StorageID) String

func (si StorageID) String() string

String returns storage uid.

type StorageList

type StorageList struct {
	meta.ListMeta `json:",inline,omitempty"`
	Items         []Storage `json:"items,omitempty"`
}

StorageList represents storage list type.

type StorageSpec

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
}

StorageSpec represents storage spec.

type StorageStatus

type StorageStatus struct {
	Schedulable    bool       `json:"schedulable,omitempty"`
	LastUpdateTime *time.Time `json:"lastUpdateTime,omitempty"`
	HealthyStatus  string     `json:"message"`
}

StorageStatus represents storage status.

type Volume

type Volume struct {
	meta.ObjectMeta `json:",inline"`
	Spec            *VolumeSpec   `json:"Spec,omitempty"`
	Status          *VolumeStatus `json:"Status,omitempty"`
}

Volume defined volume struct.

func (*Volume) Driver

func (v *Volume) Driver() string

Driver return driver's name of the volume.

func (*Volume) FileSystem

func (v *Volume) FileSystem() []string

FileSystem returns volume's file system.

func (*Volume) Key

func (v *Volume) Key() string

Key returns the volume's name

func (*Volume) Label

func (v *Volume) Label(label string) string

Label returns volume's label.

func (*Volume) MountOption

func (v *Volume) MountOption() []string

MountOption returns volume's mount options.

func (*Volume) Option

func (v *Volume) Option(name string) string

Option use to get the common options or module's options by name.

func (*Volume) Options

func (v *Volume) Options() map[string]string

Options returns all the options of volume.

func (*Volume) Path

func (v *Volume) Path() string

Path return the volume's path on host.

func (*Volume) SetLabel

func (v *Volume) SetLabel(label, value string)

SetLabel use to set label to volume.

func (*Volume) SetOption

func (v *Volume) SetOption(name, value string)

SetOption use to set the common options or module's options by name.

func (*Volume) SetPath

func (v *Volume) SetPath(p string)

SetPath save the volume's path on host into volume meta data.

func (*Volume) SetStorageUID

func (v *Volume) SetStorageUID(uid string)

SetStorageUID save storage uid into volume.

func (*Volume) Size

func (v *Volume) Size() string

Size returns volume's size(MB).

func (*Volume) StorageID

func (v *Volume) StorageID() StorageID

StorageID return driver's storage identity.

func (*Volume) VolumeID

func (v *Volume) VolumeID() VolumeID

VolumeID return volume's identity.

type VolumeCondition

type VolumeCondition struct {
	Type               VolumeConditionType `json:"type"`
	Status             ConditionStatus     `json:"status"`
	LastProbeTime      *time.Time          `json:"lastProbeTime,omitempty"`
	LastTransitionTime *time.Time          `json:"lastTransitionTime,omitempty"`
	Reason             string              `json:"reason,omitempty"`
	Message            string              `json:"message,omitempty"`
	Retry              int                 `json:"retry,omitempty"`
}

VolumeCondition represents volume condition struct.

type VolumeConditionType

type VolumeConditionType string

VolumeConditionType defines volume condition type.

const (
	// VolumeScheduledrepresents status of the scheduling process for this Volume.
	VolumeScheduled VolumeConditionType = "Scheduled"
	// VolumeInitialized means that all init containers in the Volume have started successfully.
	VolumeInitialized VolumeConditionType = "Initialized"
	// VolumeStopped means that all init containers in the Volume have stopped successfully.
	VolumeStopped VolumeConditionType = "Stopped"
	// VolumeStarted means that all init containers in the Volume have started successfully.
	VolumeStarted VolumeConditionType = "Started"
	// VolumeRestarted means that all init containers in the Volume have restarted successfully
	VolumeRestarted VolumeConditionType = "Restarted"
	// VolumeUpdated means that all init containers in the Volume have updated successfully
	VolumeUpdated VolumeConditionType = "Updated"
	// VolumeDeleted means that all init containers in the Volume have deleted successfully
	VolumeDeleted VolumeConditionType = "Deleted"
)

These are valid conditions of pod.

type VolumeConfig

type VolumeConfig struct {
	Size       string `json:"size"`
	FileSystem string `json:"filesystem"`
	MountOpt   string `json:"mountopt"`
	WriteBPS   int64  `json:"wbps"`
	ReadBPS    int64  `json:"rbps"`
	WriteIOPS  int64  `json:"wiops"`
	ReadIOPS   int64  `json:"riops"`
	TotalIOPS  int64  `json:"iops"`
}

VolumeConfig represents volume config.

type VolumeID

type VolumeID struct {
	Name      string
	Driver    string
	Options   map[string]string
	Labels    map[string]string
	Selectors map[string]string
}

VolumeID use to define the volume's identity.

func NewVolumeID

func NewVolumeID(name, driver string) VolumeID

NewVolumeID returns VolumeID instance.

func (VolumeID) Equal

func (v VolumeID) Equal(v1 VolumeID) bool

Equal check VolumeID is equal or not.

func (VolumeID) Invalid

func (v VolumeID) Invalid() bool

Invalid is used to check VolumeID's name is valid or not.

func (VolumeID) String

func (v VolumeID) String() string

String return VolumeID with string.

type VolumeList

type VolumeList struct {
	meta.ListMeta `json:",inline,omitempty"`
	Items         []Volume `json:"Items,omitempty"`
}

VolumeList represents volume list.

type VolumePhase

type VolumePhase string

VolumePhase defines volume phase's status.

var (
	// VolumePhasePending represents volume pending status.
	VolumePhasePending VolumePhase = "Pending"

	// VolumePhaseReady represents volume ready status.
	VolumePhaseReady VolumePhase = "Ready"

	// VolumePhaseUnknown represents volume unknown status.
	VolumePhaseUnknown VolumePhase = "Unknown"

	// VolumePhaseFailed represents volume failed status.
	VolumePhaseFailed VolumePhase = "Failed"
)

type VolumeSpec

type VolumeSpec struct {
	ClusterID     string   `json:"clusterid"`
	Selector      Selector `json:"selector"`
	Operable      bool     `json:"operable"`
	Backend       string   `json:"backend,omitempty"`
	*VolumeConfig `json:"config,inline"`
	Extra         map[string]string `json:"extra"`
}

VolumeSpec represents volume spec.

type VolumeStatus

type VolumeStatus struct {
	Phase               VolumePhase       `json:"phase"`
	StartTimestamp      *time.Time        `json:"startTimestamp"`
	LastUpdateTimestamp *time.Time        `json:"lastUpdateTime"`
	Conditions          []VolumeCondition `json:"Conditions,omitempty"`
	HostIP              string            `json:"hostip,omitempty"`
	MountPoint          string            `json:"mountpath,omitempty"`
	Reason              string            `json:"reason"`
	Message             string            `json:"message"`
}

VolumeStatus represent volume status.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL