spec

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2017 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BackupStorageTypeDefault          = ""
	BackupStorageTypePersistentVolume = "PersistentVolume"
	BackupStorageTypeS3               = "S3"
)
View Source
const (
	TPRKind        = "cluster"
	TPRKindPlural  = "clusters"
	TPRGroup       = "etcd.coreos.com"
	TPRVersion     = "v1beta1"
	TPRDescription = "Managed etcd clusters"
)
View Source
const (
	ClusterPhaseNone     ClusterPhase = ""
	ClusterPhaseCreating              = "Creating"
	ClusterPhaseRunning               = "Running"
	ClusterPhaseFailed                = "Failed"
)
View Source
const (
	ClusterConditionReady = "Ready"

	ClusterConditionRemovingDeadMember = "RemovingDeadMember"

	ClusterConditionRecovering = "Recovering"

	ClusterConditionScalingUp   = "ScalingUp"
	ClusterConditionScalingDown = "ScalingDown"

	ClusterConditionUpgrading = "Upgrading"
)

Variables

View Source
var (
	ErrBackupUnsetRestoreSet = errors.New("spec: backup policy must be set if restore policy is set")
)

Functions

func TPRName added in v0.2.0

func TPRName() string

Types

type BackupPolicy

type BackupPolicy struct {
	// StorageType specifies the type of storage device to store backup files.
	// If it's not set by user, the default is "PersistentVolume".
	StorageType BackupStorageType `json:"storageType"`

	StorageSource `json:",inline"`

	// BackupIntervalInSecond specifies the interval between two backups.
	// The default interval is 1800 seconds.
	BackupIntervalInSecond int `json:"backupIntervalInSecond"`

	// MaxBackups is the maximum number of backup files to retain. 0 is disable backup.
	// If backup is disabled, the etcd cluster cannot recover from a
	// disaster failure (lose more than half of its members at the same
	// time).
	MaxBackups int `json:"maxBackups"`

	// CleanupBackupsOnClusterDelete tells whether to cleanup backup data if cluster is deleted.
	// By default, operator will keep the backup data.
	CleanupBackupsOnClusterDelete bool `json:"cleanupBackupsOnClusterDelete"`
}

func (*BackupPolicy) Validate added in v0.2.5

func (bp *BackupPolicy) Validate() error

type BackupServiceStatus added in v0.2.1

type BackupServiceStatus struct {
	// RecentBackup is status of the most recent backup created by
	// the backup service
	RecentBackup *BackupStatus `json:"recentBackup,omitempty"`

	// Backups is the totoal number of existing backups
	Backups int `json:"backups"`

	// BackupSize is the total size of existing backups in MB.
	BackupSize float64 `json:"backupSize"`
}

type BackupStatus added in v0.2.1

type BackupStatus struct {
	// Creation time of the backup.
	CreationTime string `json:"creationTime"`

	// Size is the size of the backup in MB.
	Size float64 `json:"size"`

	// Version is the version of the backup cluster.
	Version string `json:"version"`

	// TimeTookInSecond is the total time took to create the backup.
	TimeTookInSecond int `json:"timeTookInSecond"`
}

type BackupStorageType

type BackupStorageType string

type Cluster added in v0.2.1

type Cluster struct {
	metav1.TypeMeta `json:",inline"`
	Metadata        metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec            ClusterSpec       `json:"spec"`
	Status          ClusterStatus     `json:"status"`
}

func (*Cluster) AsOwner added in v0.2.1

func (c *Cluster) AsOwner() metav1.OwnerReference

func (*Cluster) UnmarshalJSON added in v0.2.1

func (c *Cluster) UnmarshalJSON(data []byte) error

type ClusterCondition added in v0.2.0

type ClusterCondition struct {
	Type ClusterConditionType `json:"type"`

	Reason string `json:"reason"`

	TransitionTime string `json:"transitionTime"`
}

type ClusterConditionType added in v0.2.0

type ClusterConditionType string

type ClusterCopy added in v0.2.1

type ClusterCopy Cluster

type ClusterList added in v0.2.1

type ClusterList struct {
	metav1.TypeMeta `json:",inline"`
	// Standard list metadata
	// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
	Metadata metav1.ListMeta `json:"metadata,omitempty"`
	// Items is a list of third party objects
	Items []Cluster `json:"items"`
}

ClusterList is a list of etcd clusters.

func (*ClusterList) UnmarshalJSON added in v0.2.1

func (cl *ClusterList) UnmarshalJSON(data []byte) error

type ClusterListCopy added in v0.2.1

type ClusterListCopy ClusterList

type ClusterPhase added in v0.2.0

type ClusterPhase string

type ClusterSpec

type ClusterSpec struct {
	// Size is the expected size of the etcd cluster.
	// The etcd-operator will eventually make the size of the running
	// cluster equal to the expected size.
	// The vaild range of the size is from 1 to 7.
	Size int `json:"size"`

	// Version is the expected version of the etcd cluster.
	// The etcd-operator will eventually make the etcd cluster version
	// equal to the expected version.
	//
	// The version must follow the [semver]( http://semver.org) format, for example "3.1.4".
	// Only etcd released versions are supported: https://github.com/coreos/etcd/releases
	//
	// If version is not set, default is "3.1.4".
	Version string `json:"version"`

	// Paused is to pause the control of the operator for the etcd cluster.
	Paused bool `json:"paused,omitempty"`

	// Pod defines the policy to create pod for the etcd container.
	Pod *PodPolicy `json:"pod,omitempty"`

	// Backup defines the policy to backup data of etcd cluster if not nil.
	// If backup policy is set but restore policy not, and if a previous backup exists,
	// this cluster would face conflict and fail to start.
	Backup *BackupPolicy `json:"backup,omitempty"`

	// Restore defines the policy to restore cluster form existing backup if not nil.
	// It's not allowed if restore policy is set and backup policy not.
	Restore *RestorePolicy `json:"restore,omitempty"`

	// SelfHosted determines if the etcd cluster is used for a self-hosted
	// Kubernetes cluster.
	SelfHosted *SelfHostedPolicy `json:"selfHosted,omitempty"`

	// NOTE: This field is half finished. It will be ignored.
	// etcd cluster TLS configuration
	TLS *TLSPolicy `json:"TLS,omitempty"`
}

func (*ClusterSpec) Cleanup added in v0.2.0

func (c *ClusterSpec) Cleanup()

Cleanup cleans up user passed spec, e.g. defaulting, transforming fields. TODO: move this to admission controller

func (*ClusterSpec) Validate added in v0.2.0

func (c *ClusterSpec) Validate() error

type ClusterStatus added in v0.2.0

type ClusterStatus struct {
	// Phase is the cluster running phase
	Phase  ClusterPhase `json:"phase"`
	Reason string       `json:"reason"`

	// ControlPuased indicates the operator pauses the control of the cluster.
	ControlPaused bool `json:"controlPaused"`

	// Condition keeps ten most recent cluster conditions
	Conditions []ClusterCondition `json:"conditions"`

	// Size is the current size of the cluster
	Size int `json:"size"`
	// Members are the etcd members in the cluster
	Members MembersStatus `json:"members"`
	// CurrentVersion is the current cluster version
	CurrentVersion string `json:"currentVersion"`
	// TargetVersion is the version the cluster upgrading to.
	// If the cluster is not upgrading, TargetVersion is empty.
	TargetVersion string `json:"targetVersion"`

	// BackupServiceStatus is the status of the backup service.
	// BackupServiceStatus only exists when backup is enabled in the
	// cluster spec.
	BackupServiceStatus *BackupServiceStatus `json:"backupServiceStatus,omitempty"`
}

func (*ClusterStatus) AppendRecoveringCondition added in v0.2.0

func (cs *ClusterStatus) AppendRecoveringCondition()

func (*ClusterStatus) AppendRemovingDeadMember added in v0.2.0

func (cs *ClusterStatus) AppendRemovingDeadMember(name string)

func (*ClusterStatus) AppendScalingDownCondition added in v0.2.0

func (cs *ClusterStatus) AppendScalingDownCondition(from, to int)

func (*ClusterStatus) AppendScalingUpCondition added in v0.2.0

func (cs *ClusterStatus) AppendScalingUpCondition(from, to int)

func (*ClusterStatus) AppendUpgradingCondition added in v0.2.0

func (cs *ClusterStatus) AppendUpgradingCondition(to string, member string)

func (*ClusterStatus) Control added in v0.2.0

func (cs *ClusterStatus) Control()

func (ClusterStatus) Copy added in v0.2.0

func (cs ClusterStatus) Copy() ClusterStatus

func (*ClusterStatus) IsFailed added in v0.2.0

func (cs *ClusterStatus) IsFailed() bool

func (*ClusterStatus) PauseControl added in v0.2.0

func (cs *ClusterStatus) PauseControl()

func (*ClusterStatus) SetPhase added in v0.2.0

func (cs *ClusterStatus) SetPhase(p ClusterPhase)

func (*ClusterStatus) SetReadyCondition added in v0.2.0

func (cs *ClusterStatus) SetReadyCondition()

func (*ClusterStatus) SetReason added in v0.2.0

func (cs *ClusterStatus) SetReason(r string)

func (*ClusterStatus) SetVersion added in v0.2.0

func (cs *ClusterStatus) SetVersion(v string)

func (*ClusterStatus) UpgradeVersionTo added in v0.2.0

func (cs *ClusterStatus) UpgradeVersionTo(v string)

type MemberSecret added in v0.2.5

type MemberSecret struct {
	// PeerSecret is the secret containing TLS certs used by each etcd member pod
	// for the communication between etcd peers.
	PeerSecret string `json:"peerSecret"`
	// ClientSecret is the secret containing TLS certs used by each etcd member pod
	// for the communication between etcd and its clients.
	ClientSecret string `json:"clientSecret"`
}

type MembersStatus added in v0.2.2

type MembersStatus struct {
	// Ready are the etcd members that are ready to serve requests
	// The member names are the same as the etcd pod names
	Ready []string `json:"ready,omitempty"`
	// Unready are the etcd members not ready to serve requests
	Unready []string `json:"unready,omitempty"`
}

type PVSource added in v0.2.0

type PVSource struct {
	// VolumeSizeInMB specifies the required volume size to perform backups.
	// Operator will claim the required size before creating the etcd cluster for backup
	// purpose.
	// If the snapshot size is larger than the size specified, backup fails.
	VolumeSizeInMB int `json:"volumeSizeInMB"`
}

type PodPolicy added in v0.2.0

type PodPolicy struct {
	// NodeSelector specifies a map of key-value pairs. For the pod to be eligible
	// to run on a node, the node must have each of the indicated key-value pairs as
	// labels.
	NodeSelector map[string]string `json:"nodeSelector,omitempty"`

	// AntiAffinity determines if the etcd-operator tries to avoid putting
	// the etcd members in the same cluster onto the same node.
	AntiAffinity bool `json:"antiAffinity"`

	// Resources is the resource requirements for the etcd container.
	// This field cannot be updated once the cluster is created.
	Resources v1.ResourceRequirements `json:"resources"`

	// Tolerations specifies the pod's tolerations.
	Tolerations []v1.Toleration `json:"tolerations"`
}

PodPolicy defines the policy to create pod for the etcd container.

type RestorePolicy added in v0.2.0

type RestorePolicy struct {
	// BackupClusterName is the cluster name of the backup to recover from.
	BackupClusterName string `json:"backupClusterName"`

	// StorageType specifies the type of storage device to store backup files.
	// If not set, the default is "PersistentVolume".
	StorageType BackupStorageType `json:"storageType"`
}

RestorePolicy defines the policy to restore cluster form existing backup if not nil.

type S3Source added in v0.2.0

type S3Source struct {
}

type SelfHostedPolicy added in v0.2.0

type SelfHostedPolicy struct {
	// BootMemberClientEndpoint specifies a bootstrap member for the cluster.
	// If there is no bootstrap member, a completely new cluster will be created.
	// The boot member will be removed from the cluster once the self-hosted cluster
	// setup successfully.
	BootMemberClientEndpoint string `json:"bootMemberClientEndpoint"`
}

type StaticTLS added in v0.2.4

type StaticTLS struct {
	// Member contains secrets containing TLS certs used by each etcd member pod.
	Member *MemberSecret `json:"member"`
	// OperatorSecret is the secret containing TLS certs used by operator to
	// talk securely to this cluster.
	OperatorSecret string `json:"operatorSecret"`
}

type StorageSource added in v0.2.0

type StorageSource struct {
	PV *PVSource `json:"pv,omitempty"`
	S3 *S3Source `json:"s3,omitempty"`
}

type TLSPolicy added in v0.2.4

type TLSPolicy struct {
	// StaticTLS enables user to generate static x509 certificates and keys,
	// put them into Kubernetes secrets, and specify them into here.
	Static *StaticTLS `json:"static"`
}

TLSPolicy defines the TLS policy of an etcd cluster

Jump to

Keyboard shortcuts

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