sidecar

package
v0.3.9 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2020 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// MysqlServerIDOffset represents the offset with which all server ids are shifted from 0
	MysqlServerIDOffset = 100
)

Functions

func RunCloneCommand

func RunCloneCommand(cfg *Config) error

RunCloneCommand clone the data from source.

func RunConfigCommand

func RunConfigCommand(cfg *Config) error

RunConfigCommand generates my.cnf, client.cnf and 10-dynamic.cnf files. nolint: gocyclo

func RunSidecarCommand

func RunSidecarCommand(cfg *Config, stop <-chan struct{}) error

RunSidecarCommand is the main command, and represents the runtime helper that configures the mysql server

func RunTakeBackupCommand

func RunTakeBackupCommand(cfg *Config, srcHost, destBucket string) error

RunTakeBackupCommand starts a backup command

Types

type Config

type Config struct {
	// Hostname represents the pod hostname
	Hostname string
	// ClusterName is the MySQL cluster name
	ClusterName string
	// Namespace represents the namespace where the pod is in
	Namespace string
	// ServiceName is the name of the headless service
	ServiceName string

	// InitBucketURL represents the init bucket to initialize mysql
	InitBucketURL string

	// OperatorUser represents the credentials that the operator will use to connect to the mysql
	OperatorUser     string
	OperatorPassword string

	// backup user and password for http endpoint
	BackupUser     string
	BackupPassword string

	// replication user and password
	ReplicationUser     string
	ReplicationPassword string

	// metrics exporter user and password
	MetricsUser     string
	MetricsPassword string

	// orchestrator credentials
	OrchestratorUser     string
	OrchestratorPassword string

	// heartbeat credentials
	HeartBeatUser     string
	HeartBeatPassword string

	// ExistsMySQLData checks if MySQL data is initialized by checking if the mysql dir exists
	ExistsMySQLData bool

	// Offset for assigning MySQL Server ID
	MyServerIDOffset int
}

Config contains information related with the pod.

func NewConfig

func NewConfig() *Config

NewConfig returns a pointer to Config configured from environment variables

func (*Config) ClusterFQDN

func (cfg *Config) ClusterFQDN() string

ClusterFQDN returns the cluster FQ Name of the cluster from which the node belongs

func (*Config) FQDNForServer

func (cfg *Config) FQDNForServer(id int) string

FQDNForServer returns the pod hostname for given MySQL server id

func (*Config) MasterFQDN

func (cfg *Config) MasterFQDN() string

MasterFQDN the FQ Name of the cluster's master

func (*Config) MysqlDSN

func (cfg *Config) MysqlDSN() string

MysqlDSN returns the connection string to MySQL server

func (*Config) ServerID

func (cfg *Config) ServerID() int

ServerID returns the MySQL server id

func (*Config) ShouldCloneFromBucket added in v0.3.0

func (cfg *Config) ShouldCloneFromBucket() bool

ShouldCloneFromBucket returns true if it's time to initialize from a bucket URL provided

Jump to

Keyboard shortcuts

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