mysqlcluster

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: Apache-2.0 Imports: 15 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.

func IsMysqlClusterKind added in v0.5.0

func IsMysqlClusterKind(kind string) bool

IsMysqlClusterKind for the given kind checks if CRD kind is for MysqlCluster CRD

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) ExporterDataSourcePort added in v0.4.0

func (c *MysqlCluster) ExporterDataSourcePort() int

ExporterDataSourcePort returns a MySQL port mysqld-exporter should connect to. Returns `extra_port` if defined in the cluster spec and if `extra_max_connections` is defined and larger than the default 1. Otherwise, returns the default MySQL port. https://www.percona.com/doc/percona-server/5.7/performance/threadpool.html#extra_port

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.5

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

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) GetNamespacedName added in v0.5.0

func (c *MysqlCluster) GetNamespacedName() types.NamespacedName

GetNamespacedName return the cluster key. Usually used for logging or for runtime.Client.Get as key

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.5

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

GetSelectorLabels returns the labels that will be used as selector

func (*MysqlCluster) GetSidecarImage added in v0.5.0

func (c *MysqlCluster) GetSidecarImage() string

GetSidecarImage selects the sidecar docker image based on mysql version

func (*MysqlCluster) IsPerconaImage added in v0.5.0

func (c *MysqlCluster) IsPerconaImage() bool

IsPerconaImage checks the MySQL image is percona or not

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) String added in v0.4.0

func (c *MysqlCluster) String() string

String returns the cluster name and namespace

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.5

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

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"
	// HealthyReplicasService is the name of a service that points healthy replicas (excludes master)
	HealthyReplicasService ResourceName = "healthy-replicas-service"
	// HealthyNodesService is the name of a service that contains 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