v1alpha1

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2018 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package v1alpha1 is the v1alpha1 version of the API. +groupName=mysql.presslabs.org

Index

Constants

View Source
const (
	KB int64 = 1 << (10 * iota)
	MB
	GB
)
View Source
const (
	ResourceKindMysqlCluster = "MysqlCluster"
	ResourceKindMysqlBackup  = "MysqlBackup"
)
View Source
const (
	EventReasonInitDefaults               = "InitDefaults"
	EventReasonInitDefaultsFailed         = "InitDefaultsFailed"
	EventReasonDbSecretUpdated            = "DbSecretUpdated"
	EventReasonDbSecretFailed             = "DbSecretFailed"
	EventReasonUtilitySecretFailed        = "UtilitySecretFailed"
	EventReasonUtilitySecretUpdated       = "UtilitySecretUpdated"
	EventReasonConfigMapFailed            = "MysqlConfigMapFailed"
	EventReasonConfigMapUpdated           = "MysqlConfigMapUpdated"
	EventReasonServiceFailed              = "HLServiceFailed"
	EventReasonServiceUpdated             = "HLServiceUpdated"
	EventReasonSFSFailed                  = "StatefulSetFailed"
	EventReasonSFSUpdated                 = "StatefulSetUpdated"
	EventReasonMasterServiceFailed        = "MasterServiceFailed"
	EventReasonMasterServiceUpdated       = "MasterServiceUpdated"
	EventReasonHealthyNodesServiceFailed  = "HealthyNodesServiceFailed"
	EventReasonHealthyNodesServiceUpdated = "HealthyNodesServiceUpdated"
)

Mysql events reason

View Source
const (
	EventNormal  = "Normal"
	EventWarning = "Warning"
)

Event types

View Source
const (
	ClusterConditionReady       ClusterConditionType = "Ready"
	ClusterConditionConfig                           = "ConfigReady"
	ClusterConditionFailoverAck                      = "PendingFailoverAck"
)
View Source
const (
	NodeConditionLagged      NodeConditionType = "Lagged"
	NodeConditionReplicating                   = "Replicating"
	NodeConditionMaster                        = "Master"
)

Variables

View Source
var (
	// ResourceMysqlCluster contains the definition bits for Mysql Cluster CRD
	ResourceMysqlCluster = kutil.Config{
		Group:   SchemeGroupVersion.Group,
		Version: SchemeGroupVersion.Version,

		Kind:       ResourceKindMysqlCluster,
		Plural:     "mysqlclusters",
		Singular:   "mysqlcluster",
		ShortNames: []string{"mysql", "cluster"},

		SpecDefinitionName:    fmt.Sprintf("%s/%s.%s", myapiPkg, SchemeGroupVersion.Version, ResourceKindMysqlCluster),
		ResourceScope:         string(apiextensions.NamespaceScoped),
		GetOpenAPIDefinitions: myopenapi.GetOpenAPIDefinitions,

		EnableValidation:        true,
		EnableStatusSubresource: true,
	}
	// ResourceMysqlClusterCRDName is the fully qualified MysqlCluster CRD name (ie. mysqlclusters.mysql.presslabs.org)
	ResourceMysqlClusterCRDName = fmt.Sprintf("%s.%s", ResourceMysqlCluster.Plural, ResourceMysqlCluster.Group)
	// ResourceMysqlClusterCRD is the Custrom Resource Definition object for MysqlCluster
	ResourceMysqlClusterCRD = kutil.NewCustomResourceDefinition(ResourceMysqlCluster)

	ResourceMysqlBackup = kutil.Config{
		Group:   SchemeGroupVersion.Group,
		Version: SchemeGroupVersion.Version,

		Kind:       ResourceKindMysqlBackup,
		Plural:     "mysqlbackups",
		Singular:   "mysqlbackup",
		ShortNames: []string{"backup"},

		SpecDefinitionName:    fmt.Sprintf("%s/%s.%s", myapiPkg, SchemeGroupVersion.Version, ResourceKindMysqlBackup),
		ResourceScope:         string(apiextensions.NamespaceScoped),
		GetOpenAPIDefinitions: myopenapi.GetOpenAPIDefinitions,

		EnableValidation:        true,
		EnableStatusSubresource: true,
	}
	// ResourceMysqlBackupCRDName is the fully qualified MysqlBackup CRD name (ie. mysqlbackups.mysql.presslabs.org)
	ResourceMysqlBackupCRDName = fmt.Sprintf("%s.%s", ResourceMysqlBackup.Plural, ResourceMysqlBackup.Group)
	// ResourceMysqlBackupCRD is the Custrom Resource Definition object for MysqlBackup
	ResourceMysqlBackupCRD = kutil.NewCustomResourceDefinition(ResourceMysqlBackup)
)

Mysql Operator Custom Resource Definition

View Source
var (
	// SchemeBuilder the scheme builder
	SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
	// AddToScheme function
	AddToScheme = SchemeBuilder.AddToScheme
	// SchemeGroupVersion ..
	SchemeGroupVersion = schema.GroupVersion{Group: mysql.GroupName, Version: "v1alpha1"}
)

Functions

func GetNameForResource added in v0.1.1

func GetNameForResource(name ResourceName, clusterName string) string

func Resource

func Resource(resource string) schema.GroupResource

Resource gets an MysqlCluster GroupResource for a specified resource

Types

type BackupCondition

type BackupCondition struct {
	// type of cluster condition, values in (\"Ready\")
	Type BackupConditionType `json:"type"`
	// Status of the condition, one of (\"True\", \"False\", \"Unknown\")
	Status core.ConditionStatus `json:"status"`

	// LastTransitionTime
	LastTransitionTime metav1.Time `json:"lastTransitionTime"`
	// Reason
	Reason string `json:"reason"`
	// Message
	Message string `json:"message"`
}

func (*BackupCondition) DeepCopy

func (in *BackupCondition) DeepCopy() *BackupCondition

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackupCondition.

func (*BackupCondition) DeepCopyInto

func (in *BackupCondition) DeepCopyInto(out *BackupCondition)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type BackupConditionType

type BackupConditionType string
const (
	// BackupComplete means the backup has finished his execution
	BackupComplete BackupConditionType = "Complete"
	// BackupFailed means backup has failed
	BackupFailed BackupConditionType = "Failed"
)

type BackupSpec

type BackupSpec struct {
	// ClustterName represents the cluster for which to take backup
	ClusterName string `json:"clusterName"`
	// BucketUri a fully specified bucket URI where to put backup.
	// Default is used the one specified in cluster.
	// optional
	BackupUri string `json:"backupUri,omitempty"`
	// BackupSecretName the name of secrets that contains the credentials to
	// access the bucket. Default is used the secret specified in cluster.
	// optinal
	BackupSecretName string `json:"backupSecretName,omitempty"`
}

func (*BackupSpec) DeepCopy

func (in *BackupSpec) DeepCopy() *BackupSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackupSpec.

func (*BackupSpec) DeepCopyInto

func (in *BackupSpec) DeepCopyInto(out *BackupSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type BackupStatus

type BackupStatus struct {
	// Complete marks the backup in final state
	Completed bool `json:"completed"`

	// BackupUri represent the fully uri to the backup location
	BackupUri string `json:"backupUri,omitempty"`

	Conditions []BackupCondition `json:"conditions"`
}

func (*BackupStatus) DeepCopy

func (in *BackupStatus) DeepCopy() *BackupStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackupStatus.

func (*BackupStatus) DeepCopyInto

func (in *BackupStatus) DeepCopyInto(out *BackupStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ClusterCondition

type ClusterCondition struct {
	// type of cluster condition, values in (\"Ready\")
	Type ClusterConditionType `json:"type"`
	// Status of the condition, one of (\"True\", \"False\", \"Unknown\")
	Status core.ConditionStatus `json:"status"`

	// LastTransitionTime
	LastTransitionTime metav1.Time `json:"lastTransitionTime"`
	// Reason
	Reason string `json:"reason"`
	// Message
	Message string `json:"message"`
}

func (*ClusterCondition) DeepCopy

func (in *ClusterCondition) DeepCopy() *ClusterCondition

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterCondition.

func (*ClusterCondition) DeepCopyInto

func (in *ClusterCondition) DeepCopyInto(out *ClusterCondition)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ClusterConditionType

type ClusterConditionType string

type ClusterSpec

type ClusterSpec struct {
	// The number of pods. This updates replicas filed
	// Defaults to 0
	// +optional
	Replicas int32 `json:"replicas"`
	// The secret name that contains connection information to initialize database, like
	// USER, PASSWORD, ROOT_PASSWORD and so on
	// This secret will be updated with DB_CONNECT_URL and some more configs.
	// Can be specified partially
	// Defaults is <name>-db-credentials (with random values)
	// +optional
	SecretName string `json:"secretName"`

	// Represents the percona image tag.
	// Defaults to 5.7
	// +optional
	MysqlVersion string `json:"mysqlVersion"`

	// A bucket URI that contains a xtrabackup to initialize the mysql database.
	// +optional
	InitBucketUri        string `json:"initBucketUri,omitempty"`
	InitBucketSecretName string `json:"initBucketSecretName,omitempty"`

	// Specify under crontab format interval to take backups
	// leave it empty to deactivate the backup process
	// Defaults to ""
	// +optional
	BackupSchedule   string `json:"backupSchedule,omitempty"`
	BackupUri        string `json:"backupUri,omitempty"`
	BackupSecretName string `json:"backupSecretName,omitempty"`

	// A map[string]string that will be passed to my.cnf file.
	// +optional
	MysqlConf MysqlConf `json:"mysqlConf,omitempty"`

	// Pod extra specification
	// +optional
	PodSpec PodSpec `json:"podSpec,omitempty"`

	// PVC extra specifiaction
	// +optional
	VolumeSpec `json:"volumeSpec,omitempty"`

	// MaxSlaveLatency represents the allowed latency for a slave node in
	// seconds. If set then the node with a latency grater than this is removed
	// from service.
	// +optional
	MaxSlaveLatency *int64 `json:"maxSlaveLatency,omitempty"`
}

func (*ClusterSpec) DeepCopy

func (in *ClusterSpec) DeepCopy() *ClusterSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterSpec.

func (*ClusterSpec) DeepCopyInto

func (in *ClusterSpec) DeepCopyInto(out *ClusterSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*ClusterSpec) GetHelperImage

func (c *ClusterSpec) GetHelperImage() string

GetHelperImage return helper image from options

func (*ClusterSpec) GetMetricsExporterImage

func (c *ClusterSpec) GetMetricsExporterImage() string

GetMetricsExporterImage return helper image from options

func (*ClusterSpec) GetMysqlImage

func (c *ClusterSpec) GetMysqlImage() string

GetMysqlImage returns mysql image, composed from oprions and Spec.MysqlVersion

func (*ClusterSpec) GetOrcUri

func (c *ClusterSpec) GetOrcUri() string

GetOrcUri return the orchestrator uri

func (*ClusterSpec) UpdateDefaults

func (c *ClusterSpec) UpdateDefaults(opt *options.Options, cluster *MysqlCluster) error

UpdateDefaults updates Spec defaults

type ClusterStatus

type ClusterStatus struct {
	// ReadyNodes represents number of the nodes that are in ready state
	ReadyNodes int
	// Conditions contains the list of the cluster conditions fulfilled
	Conditions []ClusterCondition `json:"conditions,omitempty"`
	// Nodes contains informations from orchestrator
	Nodes []NodeStatus `json:"nodes,omitempty"`
}

func (*ClusterStatus) DeepCopy

func (in *ClusterStatus) DeepCopy() *ClusterStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterStatus.

func (*ClusterStatus) DeepCopyInto

func (in *ClusterStatus) DeepCopyInto(out *ClusterStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*ClusterStatus) GetNodeStatusIndex added in v0.1.4

func (s *ClusterStatus) GetNodeStatusIndex(name string) int

type MysqlBackup

type MysqlBackup struct {
	// +k8s:openapi-gen=false
	metav1.TypeMeta `json:",inline"`
	// +k8s:openapi-gen=false
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec BackupSpec `json:"spec"`
	// +k8s:openapi-gen=false
	Status BackupStatus `json:"status,omitempty"`
}

func (*MysqlBackup) AsOwnerReference

func (c *MysqlBackup) AsOwnerReference() metav1.OwnerReference

AsOwnerReference returns the MysqlCluster owner references.

func (*MysqlBackup) DeepCopy

func (in *MysqlBackup) DeepCopy() *MysqlBackup

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MysqlBackup.

func (*MysqlBackup) DeepCopyInto

func (in *MysqlBackup) DeepCopyInto(out *MysqlBackup)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*MysqlBackup) DeepCopyObject

func (in *MysqlBackup) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*MysqlBackup) GetCondition

func (b *MysqlBackup) GetCondition(ty BackupConditionType) *BackupCondition

func (*MysqlBackup) GetHelperImage

func (c *MysqlBackup) GetHelperImage() string

func (*MysqlBackup) UpdateStatusCondition

func (c *MysqlBackup) UpdateStatusCondition(condType BackupConditionType,
	status core.ConditionStatus, reason, msg string)

UpdateStatusCondition sets the condition to a status. for example Ready condition to True, or False

type MysqlBackupList

type MysqlBackupList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []MysqlBackup `json:"items"`
}

func (*MysqlBackupList) DeepCopy

func (in *MysqlBackupList) DeepCopy() *MysqlBackupList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MysqlBackupList.

func (*MysqlBackupList) DeepCopyInto

func (in *MysqlBackupList) DeepCopyInto(out *MysqlBackupList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*MysqlBackupList) DeepCopyObject

func (in *MysqlBackupList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type MysqlCluster

type MysqlCluster struct {
	// +k8s:openapi-gen=false
	metav1.TypeMeta `json:",inline"`
	// +k8s:openapi-gen=false
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              ClusterSpec `json:"spec"`
	// +k8s:openapi-gen=false
	Status ClusterStatus `json:"status,omitempty"`
}

func (*MysqlCluster) AsOwnerReference

func (c *MysqlCluster) AsOwnerReference() metav1.OwnerReference

AsOwnerReference returns the MysqlCluster owner references.

func (*MysqlCluster) DeepCopy

func (in *MysqlCluster) DeepCopy() *MysqlCluster

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MysqlCluster.

func (*MysqlCluster) DeepCopyInto

func (in *MysqlCluster) DeepCopyInto(out *MysqlCluster)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*MysqlCluster) DeepCopyObject

func (in *MysqlCluster) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*MysqlCluster) GetBackupCandidate added in v0.1.4

func (c *MysqlCluster) GetBackupCandidate() string

GetBackupCandidate returns the hostname of the first not-lagged and replicating slave node, else returns the master node.

func (*MysqlCluster) GetLabels

func (c *MysqlCluster) GetLabels() map[string]string

func (*MysqlCluster) GetNameForResource

func (c *MysqlCluster) GetNameForResource(name ResourceName) string

func (*MysqlCluster) GetPodHostname added in v0.1.4

func (c *MysqlCluster) GetPodHostname(p int) string

func (*MysqlCluster) UpdateDefaults

func (c *MysqlCluster) UpdateDefaults(opt *options.Options) error

UpdateDefaults sets the defaults for Spec and Status

func (*MysqlCluster) UpdateStatusCondition

func (c *MysqlCluster) UpdateStatusCondition(condType ClusterConditionType,
	status core.ConditionStatus, reason, msg string)

UpdateStatusCondition sets the condition to a status. for example Ready condition to True, or False

type MysqlClusterList

type MysqlClusterList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []MysqlCluster `json:"items"`
}

func (*MysqlClusterList) DeepCopy

func (in *MysqlClusterList) DeepCopy() *MysqlClusterList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MysqlClusterList.

func (*MysqlClusterList) DeepCopyInto

func (in *MysqlClusterList) DeepCopyInto(out *MysqlClusterList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*MysqlClusterList) DeepCopyObject

func (in *MysqlClusterList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type MysqlConf

type MysqlConf map[string]string

type NodeCondition added in v0.1.4

type NodeCondition struct {
	Type               NodeConditionType    `json:"type"`
	Status             core.ConditionStatus `json:"status"`
	LastTransitionTime metav1.Time          `json:"lastTransitionTime`
}

func (*NodeCondition) DeepCopy added in v0.1.4

func (in *NodeCondition) DeepCopy() *NodeCondition

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeCondition.

func (*NodeCondition) DeepCopyInto added in v0.1.4

func (in *NodeCondition) DeepCopyInto(out *NodeCondition)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type NodeConditionType added in v0.1.4

type NodeConditionType string

type NodeStatus added in v0.1.4

type NodeStatus struct {
	Name       string          `json:"name`
	Conditions []NodeCondition `json:"conditions,omitempty`
}

func (*NodeStatus) DeepCopy added in v0.1.4

func (in *NodeStatus) DeepCopy() *NodeStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeStatus.

func (*NodeStatus) DeepCopyInto added in v0.1.4

func (in *NodeStatus) DeepCopyInto(out *NodeStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*NodeStatus) GetCondition added in v0.1.4

func (ns *NodeStatus) GetCondition(cType NodeConditionType) *NodeCondition

func (*NodeStatus) UpdateNodeCondition added in v0.1.4

func (ns *NodeStatus) UpdateNodeCondition(cType NodeConditionType,
	cStatus core.ConditionStatus) bool

type PodSpec

type PodSpec struct {
	ImagePullPolicy  core.PullPolicy             `json:"imagePullPolicy,omitempty"`
	ImagePullSecrets []core.LocalObjectReference `json:"imagePullSecrets,omitempty"`

	Labels       map[string]string         `json:"labels,omitempty"`
	Annotations  map[string]string         `json:"annotations,omitempty"`
	Resources    core.ResourceRequirements `json:"resources,omitempty"`
	Affinity     core.Affinity             `json:"affinity,omitempty"`
	NodeSelector map[string]string         `json:"nodeSelector,omitempty"`
}

func (*PodSpec) DeepCopy

func (in *PodSpec) DeepCopy() *PodSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodSpec.

func (*PodSpec) DeepCopyInto

func (in *PodSpec) DeepCopyInto(out *PodSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*PodSpec) UpdateDefaults

func (ps *PodSpec) UpdateDefaults(opt *options.Options, cluster *MysqlCluster) error

UpdateDefaults for PodSpec

type ResourceName

type ResourceName string

ResourceName is the type for aliasing resources that will be created.

const (
	// HeadlessSVC is the alias of the headless service resource
	HeadlessSVC ResourceName = "headless"
	// StatefulSet is the alias of the statefulset resource
	StatefulSet ResourceName = "mysql"
	// ConfigMap is the alias for mysql configs, the config map resource
	ConfigMap ResourceName = "config-files"
	// BackupCronJob is the name of cron job
	BackupCronJob ResourceName = "backup-cron"
	// MasterService is the name of the service that points to master node
	MasterService ResourceName = "master-service"
	// HealthyNodes is the name of a service that continas all healthy nodes
	HealthyNodesService ResourceName = "healthy-nodes-service"
)

type VolumeSpec

type VolumeSpec struct {
	core.PersistentVolumeClaimSpec `json:",inline"`
}

func (*VolumeSpec) DeepCopy

func (in *VolumeSpec) DeepCopy() *VolumeSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSpec.

func (*VolumeSpec) DeepCopyInto

func (in *VolumeSpec) DeepCopyInto(out *VolumeSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*VolumeSpec) UpdateDefaults

func (vs *VolumeSpec) UpdateDefaults() error

UpdateDefaults for VolumeSpec

Jump to

Keyboard shortcuts

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