mysqlcluster

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// HeadlessSVCName is the name of the headless service that is commonly used for all clusters
	HeadlessSVCName = "mysql"
)
View Source
const NodeInitializedConditionType core.PodConditionType = "mysql.presslabs.org/NodeInitialized"

NodeInitializedConditionType is the extended new pod condition that marks the pod as initialized from MySQL point of view.

Variables

This section is empty.

Functions

func GetNameForResource

func GetNameForResource(name ResourceName, clusterName string) string

GetNameForResource returns the name of a resource for a cluster

func GetNodeConditionIndex

func GetNodeConditionIndex(nodeStatus *api.NodeStatus, condType api.NodeConditionType) (int, bool)

GetNodeConditionIndex returns the index of a condition. The boolean value is true if the conditions exists otherwise is false.

Types

type MysqlCluster

type MysqlCluster struct {
	*api.MysqlCluster
}

MysqlCluster is the wrapper for api.MysqlCluster type

func New

func New(mc *api.MysqlCluster) *MysqlCluster

New returns a wrapper for mysqlcluster

func (*MysqlCluster) GetClusterAlias

func (c *MysqlCluster) GetClusterAlias() string

GetClusterAlias returns the cluster alias that as it is in orchestrator

func (*MysqlCluster) GetClusterCondition added in v0.2.4

func (c *MysqlCluster) GetClusterCondition(condType api.ClusterConditionType) *api.ClusterCondition

GetClusterCondition returns the cluster condition of the given type

func (*MysqlCluster) GetLabels

func (c *MysqlCluster) GetLabels() labels.Set

GetLabels returns cluster labels

func (*MysqlCluster) GetMasterHost

func (c *MysqlCluster) GetMasterHost() string

GetMasterHost returns name of current master host in a cluster

func (*MysqlCluster) GetMySQLSemVer added in v0.3.0

func (c *MysqlCluster) GetMySQLSemVer() semver.Version

GetMySQLSemVer returns the MySQL server version in semver format, or the default one

func (*MysqlCluster) GetMysqlImage added in v0.2.2

func (c *MysqlCluster) GetMysqlImage() string

GetMysqlImage returns the mysql image for current mysql cluster

func (*MysqlCluster) GetNameForResource

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

GetNameForResource returns the name of a resource from above

func (*MysqlCluster) GetNodeCondition

func (c *MysqlCluster) GetNodeCondition(name string, condType api.NodeConditionType) *api.NodeCondition

GetNodeCondition get NodeCondigion given the name and condType

func (*MysqlCluster) GetNodeStatusFor

func (c *MysqlCluster) GetNodeStatusFor(name string) api.NodeStatus

GetNodeStatusFor returns the node status for specified hostname

func (*MysqlCluster) GetNodeStatusIndex

func (c *MysqlCluster) GetNodeStatusIndex(name string) int

GetNodeStatusIndex get index of node given the name

func (*MysqlCluster) GetPodHostname

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

GetPodHostname returns for an index the pod hostname of a cluster

func (*MysqlCluster) GetSelectorLabels added in v0.2.3

func (c *MysqlCluster) GetSelectorLabels() labels.Set

GetSelectorLabels returns the labels that will be used as selector

func (*MysqlCluster) SetDefaults

func (cluster *MysqlCluster) SetDefaults(opt *options.Options)

SetDefaults set defaults from options nolint: gocyclo

func (*MysqlCluster) ShouldHaveInitContainerForMysql added in v0.3.0

func (c *MysqlCluster) ShouldHaveInitContainerForMysql() bool

ShouldHaveInitContainerForMysql checks the MySQL version and returns true or false if the docker image supports or not init only

func (*MysqlCluster) Unwrap

func (c *MysqlCluster) Unwrap() *api.MysqlCluster

Unwrap returns the api mysqlcluster object

func (*MysqlCluster) UpdateNodeConditionStatus

func (c *MysqlCluster) UpdateNodeConditionStatus(nodeName string, condType api.NodeConditionType, status core.ConditionStatus) bool

UpdateNodeConditionStatus updates the status of the condition for a given name and type

func (*MysqlCluster) UpdateSpec added in v0.2.3

func (c *MysqlCluster) UpdateSpec()

UpdateSpec updates the cluster specs that need to be saved

func (*MysqlCluster) UpdateStatusCondition

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

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

func (*MysqlCluster) Validate added in v0.2.2

func (c *MysqlCluster) Validate() error

Validate checks if the cluster spec is validated

type ResourceName

type ResourceName string

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

const (
	// OldHeadlessSVC is the name of the old headless service
	// DEPRECATED
	OldHeadlessSVC = "old-headless"

	// 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"
	// MasterService is the name of the service that points to master node
	MasterService ResourceName = "master-service"
	// HealthyNodesService is the name of a service that continas all healthy nodes
	HealthyNodesService ResourceName = "healthy-nodes-service"
	// PodDisruptionBudget is the name of pod disruption budget for the stateful set
	PodDisruptionBudget ResourceName = "pdb"
	// Secret is the name of the "private" secret that contains operator related credentials
	Secret ResourceName = "operated-secret"
)

Jump to

Keyboard shortcuts

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