Documentation
¶
Index ¶
- Constants
- Variables
- func AutoConfigMapName(cr *apiv1.PerconaServerMySQL) string
- func CanonicalVariableName(key string) string
- func ConfigMapName(cr *apiv1.PerconaServerMySQL) string
- func DataVolumeSize(cr *apiv1.PerconaServerMySQL) int64
- func EffectiveResource(res corev1.ResourceRequirements, name corev1.ResourceName) *resource.Quantity
- func FQDN(cr *apiv1.PerconaServerMySQL, idx int) string
- func FormatConfigValue(value string) string
- func GetAppliedCRVersion(ctx context.Context, cl client.Reader, cr *apiv1.PerconaServerMySQL) (string, error)
- func GetAutoConfigParams(cr *apiv1.PerconaServerMySQL, version string, cpu, memory *resource.Quantity, ...) (string, error)
- func GetAutoTuneParams(cr *apiv1.PerconaServerMySQL, q *resource.Quantity) (string, error)
- func GetConfig(ctx context.Context, cl client.Reader, cr *apiv1.PerconaServerMySQL, ...) (config.Section, error)
- func GetLastAppliedConfig(sts *appsv1.StatefulSet) (config.Section, error)
- func GetPod(ctx context.Context, cl client.Reader, cr *apiv1.PerconaServerMySQL, idx int) (*corev1.Pod, error)
- func GetReadyPod(ctx context.Context, cl client.Reader, cr *apiv1.PerconaServerMySQL) (*corev1.Pod, error)
- func HasUserConfig(ctx context.Context, cl client.Reader, cr *apiv1.PerconaServerMySQL) (bool, error)
- func HeadlessService(cr *apiv1.PerconaServerMySQL) *corev1.Service
- func IsLooseVariable(key string) bool
- func Labels(cr *apiv1.PerconaServerMySQL) map[string]string
- func MatchLabels(cr *apiv1.PerconaServerMySQL) map[string]string
- func MatchesConfigValue(current, formatted string) bool
- func Name(cr *apiv1.PerconaServerMySQL) string
- func NamespacedName(cr *apiv1.PerconaServerMySQL) types.NamespacedName
- func PodFQDN(cr *apiv1.PerconaServerMySQL, pod *corev1.Pod) string
- func PodName(cr *apiv1.PerconaServerMySQL, idx int) string
- func PodService(cr *apiv1.PerconaServerMySQL, t corev1.ServiceType, podName string) *corev1.Service
- func PrimaryService(cr *apiv1.PerconaServerMySQL) *corev1.Service
- func PrimaryServiceName(cr *apiv1.PerconaServerMySQL) string
- func ProxyService(cr *apiv1.PerconaServerMySQL) *corev1.Service
- func ProxyServiceName(cr *apiv1.PerconaServerMySQL) string
- func QuoteLiteral(value string) string
- func ServiceFQDN(cr *apiv1.PerconaServerMySQL) string
- func ServiceName(cr *apiv1.PerconaServerMySQL) string
- func StatefulSet(cr *apiv1.PerconaServerMySQL, ...) *appsv1.StatefulSet
- func UnreadyService(cr *apiv1.PerconaServerMySQL) *corev1.Service
- func UnreadyServiceName(cr *apiv1.PerconaServerMySQL) string
- type Component
- func (c *Component) Labels() map[string]string
- func (c *Component) MatchLabels() map[string]string
- func (c *Component) Name() string
- func (c *Component) Object(ctx context.Context, cl client.Client) (client.Object, error)
- func (c *Component) PerconaServerMySQL() *apiv1.PerconaServerMySQL
- func (c *Component) PodSpec() *apiv1.PodSpec
- type Configurable
- func (c *Configurable) ExecuteConfigurationTemplate(input string, memory *resource.Quantity) (string, error)
- func (c *Configurable) GetConfigMapKey() string
- func (c *Configurable) GetConfigMapName() string
- func (c *Configurable) GetConfiguration() string
- func (c *Configurable) GetResources() corev1.ResourceRequirements
- type Exposer
- type User
Constants ¶
const ( AppName = "mysql" DataVolumeName = "datadir" DataMountPath = "/var/lib/mysql" CustomConfigKey = "my.cnf" CustomMyCnfPath = "/etc/mysql/config/my-config.cnf" AutoConfigCnfPath = "/etc/mysql/config/auto-config.cnf" SecretMyCnfPath = "/etc/mysql/config/my-secret.cnf" TLSMountPath = "/etc/mysql/mysql-tls-secret" BackupLogDir = "/var/log/xtrabackup" )
const ( DefaultPort = 3306 DefaultGRPort = 33061 DefaultAdminPort = 33062 DefaultXPort = 33060 SidecarHTTPPort = 6450 DefaultReadTimeoutSecondsSeconds = 3600 // DefaultCloneTimeoutSeconds is the default for the bootstrap clone timeout // (BOOTSTRAP_CLONE_TIMEOUT) when it is not set via spec.mysql.env. It is // generous (6h) because multi-TiB clones can run for hours; it is a safety // net that lets a genuinely hung clone abort and retry, not a tuning knob. DefaultCloneTimeoutSeconds = 21600 // DefaultCloneStallTimeoutSeconds is the default for the bootstrap clone // progress watchdog (BOOTSTRAP_CLONE_STALL_TIMEOUT): the clone is aborted // only if it transfers no bytes for this long. A progressing clone runs // unbounded; set the env to 0 (via spec.mysql.env) to disable the watchdog. DefaultCloneStallTimeoutSeconds = 900 DefaultAsyncSourceRetryCount = 3 DefaultAsyncSourceConnectRetry = 60 DatetimeFormat = "2006-01-02 15:04:05" )
Variables ¶
var ErrInsufficientStorage = errors.New("data volume is too small for the calculated configuration")
ErrInsufficientStorage reports that the data volume cannot host the redo log the calculated configuration asks for.
var (
ErrNoReadyPods = errors.New("no ready pods")
)
var ErrRolloutInProgress = errors.New("rollout in progress")
Functions ¶
func AutoConfigMapName ¶ added in v0.2.0
func AutoConfigMapName(cr *apiv1.PerconaServerMySQL) string
func CanonicalVariableName ¶ added in v1.3.0
CanonicalVariableName strips the loose prefix.
func ConfigMapName ¶
func ConfigMapName(cr *apiv1.PerconaServerMySQL) string
func DataVolumeSize ¶ added in v1.3.0
func DataVolumeSize(cr *apiv1.PerconaServerMySQL) int64
DataVolumeSize returns the size the cr asks for the MySQL data volume, or zero when nothing in the spec bounds it.
func EffectiveResource ¶ added in v1.3.0
func EffectiveResource(res corev1.ResourceRequirements, name corev1.ResourceName) *resource.Quantity
EffectiveResource returns the limit, else the request, else nil.
func FormatConfigValue ¶ added in v1.3.0
func GetAppliedCRVersion ¶ added in v1.3.0
func GetAppliedCRVersion(ctx context.Context, cl client.Reader, cr *apiv1.PerconaServerMySQL) (string, error)
GetAppliedCRVersion returns the version of the CR that is currently applied to the StatefulSet. It returns the current CR_VERSION env variable value from the StatefulSet container spec. If the StatefulSet has not yet rolled out, it returns ErrRolloutInProgress.
func GetAutoConfigParams ¶ added in v1.3.0
func GetAutoConfigParams(cr *apiv1.PerconaServerMySQL, version string, cpu, memory *resource.Quantity, storage int64) (string, error)
GetAutoConfigParams derives a full set of mysqld parameters from the pod's CPU/memory allocation, the workload profile, the version and the topology.
func GetAutoTuneParams ¶ added in v0.2.0
GetAutoTuneParams derives innodb_buffer_pool_size, innodb_buffer_pool_chunk_size and max_connections from the given memory quantity.
func GetConfig ¶ added in v1.3.0
func GetConfig( ctx context.Context, cl client.Reader, cr *apiv1.PerconaServerMySQL, autoConf string, ) (config.Section, error)
GetConfig merges the configuration mysqld runs with, in order: autoConf, the user configuration and the user secret.
func GetLastAppliedConfig ¶ added in v1.3.0
func GetLastAppliedConfig( sts *appsv1.StatefulSet, ) (config.Section, error)
func GetReadyPod ¶ added in v0.12.0
func HasUserConfig ¶ added in v1.3.0
func HasUserConfig( ctx context.Context, cl client.Reader, cr *apiv1.PerconaServerMySQL, ) (bool, error)
HasUserConfig reports whether the user supplied a MySQL configuration of their own, through mysql.configuration or by creating the ConfigMap or Secret directly.
func HeadlessService ¶
func HeadlessService(cr *apiv1.PerconaServerMySQL) *corev1.Service
func IsLooseVariable ¶ added in v1.3.0
IsLooseVariable reports whether key carries the loose prefix.
func MatchLabels ¶
func MatchLabels(cr *apiv1.PerconaServerMySQL) map[string]string
func MatchesConfigValue ¶ added in v1.3.0
MatchesConfigValue reports whether the raw value mysqld currently holds is the one the already formatted value asks for.
func Name ¶
func Name(cr *apiv1.PerconaServerMySQL) string
func NamespacedName ¶
func NamespacedName(cr *apiv1.PerconaServerMySQL) types.NamespacedName
func PodService ¶
func PodService(cr *apiv1.PerconaServerMySQL, t corev1.ServiceType, podName string) *corev1.Service
func PrimaryService ¶
func PrimaryService(cr *apiv1.PerconaServerMySQL) *corev1.Service
PrimaryService constructs a service which exposes the pods that has the primary label. For now this service should be available only for group replication.
func PrimaryServiceName ¶
func PrimaryServiceName(cr *apiv1.PerconaServerMySQL) string
func ProxyService ¶ added in v0.6.0
func ProxyService(cr *apiv1.PerconaServerMySQL) *corev1.Service
func ProxyServiceName ¶ added in v0.6.0
func ProxyServiceName(cr *apiv1.PerconaServerMySQL) string
func QuoteLiteral ¶ added in v1.3.0
QuoteLiteral renders value as a single SQL string literal. Quotes are doubled rather than backslash-escaped so it holds under NO_BACKSLASH_ESCAPES too.
func ServiceFQDN ¶ added in v1.2.0
func ServiceFQDN(cr *apiv1.PerconaServerMySQL) string
func ServiceName ¶
func ServiceName(cr *apiv1.PerconaServerMySQL) string
func StatefulSet ¶
func StatefulSet(cr *apiv1.PerconaServerMySQL, initImage, configHash, tlsHash, logCollectorHash string, secret *corev1.Secret) *appsv1.StatefulSet
func UnreadyService ¶
func UnreadyService(cr *apiv1.PerconaServerMySQL) *corev1.Service
func UnreadyServiceName ¶
func UnreadyServiceName(cr *apiv1.PerconaServerMySQL) string
Types ¶
type Component ¶ added in v0.12.0
type Component apiv1.PerconaServerMySQL
func (*Component) MatchLabels ¶ added in v0.12.0
func (*Component) PerconaServerMySQL ¶ added in v0.12.0
func (c *Component) PerconaServerMySQL() *apiv1.PerconaServerMySQL
type Configurable ¶ added in v0.6.0
type Configurable apiv1.PerconaServerMySQL
func (*Configurable) ExecuteConfigurationTemplate ¶ added in v0.6.0
func (*Configurable) GetConfigMapKey ¶ added in v0.6.0
func (c *Configurable) GetConfigMapKey() string
func (*Configurable) GetConfigMapName ¶ added in v0.6.0
func (c *Configurable) GetConfigMapName() string
func (*Configurable) GetConfiguration ¶ added in v0.6.0
func (c *Configurable) GetConfiguration() string
func (*Configurable) GetResources ¶ added in v0.6.0
func (c *Configurable) GetResources() corev1.ResourceRequirements
type Exposer ¶ added in v0.2.0
type Exposer apiv1.PerconaServerMySQL