Documentation ¶
Index ¶
- Constants
- Variables
- func GetHost(cluster *mocov1alpha1.MySQLCluster, index int) string
- func GetPassword(ctx context.Context, cluster *mocov1alpha1.MySQLCluster, c client.Client, ...) (string, error)
- func GetSecretNameForController(cluster *mocov1alpha1.MySQLCluster) (string, string)
- func UniqueName(cluster *mocov1alpha1.MySQLCluster) string
- type MOCOEvent
- type OperationPhase
Constants ¶
View Source
const ( // OperatorUser is a name of MOCO operator user in the MySQL context. OperatorUser = "moco" // OperatorAdminUser is a name of MOCO operator-admin user in the MySQL context. // This user is a super user especially for creating and granting privileges to other users. OperatorAdminUser = "moco-admin" // ReplicationUser is a name of MOCO replicator user in the MySQL context. ReplicationUser = "moco-repl" // CloneDonorUser is a name of MOCO clone-donor user in the MySQL context. CloneDonorUser = "moco-clone-donor" // MiscUser is a name of MOCO misc user in the MySQL context. MiscUser = "moco-misc" // ReadOnlyUser is a name of MOCO predefined human user with wide read-only rights used for manual operation. ReadOnlyUser = "moco-readonly" // WritableUser is a name of MOCO predefined human user with wide read/write rights used for manual operation. WritableUser = "moco-writable" )
View Source
const ( // MySQLDataPath is a path for MySQL data dir. MySQLDataPath = "/var/lib/mysql" // MySQLConfPath is a path for MySQL conf dir. MySQLConfPath = "/etc/mysql" // MySQLConfName is a filename for MySQL conf. MySQLConfName = "my.cnf" // VarRunPath is a path for variable files which concerns MySQLd. VarRunPath = "/var/run/mysqld" // VarLogPath is a path for /var/log/mysql. VarLogPath = "/var/log/mysql" // MySQLErrorLogName is a filename of error log for MySQL. MySQLErrorLogName = "mysql.err" // MySQLSlowLogName is a filename of slow query log for MySQL. MySQLSlowLogName = "mysql.slow" // TmpPath is a path for /tmp. TmpPath = "/tmp" // MySQLConfTemplatePath is MySQLConfTemplatePath = "/etc/mysql_template" // DonorPasswordPath is the path to donor user passsword file DonorPasswordPath = MySQLDataPath + "/donor-password" // MiscPasswordPath is the path to misc user passsword file MiscPasswordPath = MySQLDataPath + "/misc-password" // ReplicationSourceSecretPath is the path to replication source secret file ReplicationSourceSecretPath = MySQLDataPath + "/replication-source-secret" // InnoDBBufferPoolRatioPercent is the ratio of InnoDB buffer pool size to resource.limits.memory or resource.requests.memory // Note that the pool size doesn't set to lower than 128MiB, which is the default innodb_buffer_pool_size value InnoDBBufferPoolRatioPercent = 70 )
View Source
const ( // MySQLPort is a port number for MySQL MySQLPort = 3306 // MySQLAdminPort is a port number for MySQL Admin MySQLAdminPort = 33062 // MySQLXPort is a port number for MySQL XProtocol MySQLXPort = 33060 )
View Source
const ( // AgentPort is a port number for agent container AgentPort = 9080 // AgentTokenEnvName is a name of the environment variable of agent token. AgentTokenEnvName = "MOCO_AGENT_TOKEN" // AgentTokenParam is a name of the param of agent token. AgentTokenParam = "token" )
View Source
const ( // PodNameEnvName is a name of the environment variable of a pod name. PodNameEnvName = "POD_NAME" // PodNameFlag is a name of the flag of a pod name. PodNameFlag = "pod-name" // PodNamespaceEnvName is a name of the environment variable of a pod namespace. PodNamespaceEnvName = "POD_NAMESPACE" // PodNamespaceFlag is a name of the flag of a pod namespace. PodNamespaceFlag = "pod-namespace" // PodIPEnvName is a name of the environment variable of a pod IP. PodIPEnvName = "POD_IP" // PodNameFlag is a name of the flag of a pod IP. PodIPFlag = "pod-ip" // NodeNameEnvName is a name of the environment variable of a node name where the pod runs. NodeNameEnvName = "NODE_NAME" // NodeNameFlag is a name of the flag of a node name where the pod runs. NodeNameFlag = "node-name" // RootPasswordEnvName is a name of the environment variable of a root password. RootPasswordEnvName = "ROOT_PASSWORD" // OperatorPasswordEnvName is a name of the environment variable of a password for both operator and operator-admin. OperatorPasswordEnvName = "OPERATOR_PASSWORD" // ReplicationPasswordEnvName is a name of the environment variable of a password for replication user. ReplicationPasswordEnvName = "REPLICATION_PASSWORD" // ClonePasswordEnvName is a name of the environment variable of a password for donor user. ClonePasswordEnvName = "CLONE_DONOR_PASSWORD" // MiscPasswordEnvName is a name of the environment variable of a password for the misc user. MiscPasswordEnvName = "MISC_PASSWORD" // ReadOnlyPasswordEnvName is a name of the environment variable of a password for moco-readonly. ReadOnlyPasswordEnvName = "READONLY_PASSWORD" // WritablePasswordEnvName is a name of the environment variable of a password for moco-writable. WritablePasswordEnvName = "WRITABLE_PASSWORD" )
env names must correspond to options in entrypoint/init.go
View Source
const ( // RootPasswordKey is a Secret key for root password. RootPasswordKey = "ROOT_PASSWORD" // OperatorPasswordKey is a Secret key for operator password. OperatorPasswordKey = "OPERATOR_PASSWORD" // ReplicationPasswordKey is a Secret key for operator replication password. ReplicationPasswordKey = "REPLICATION_PASSWORD" // CloneDonorPasswordKey is a Secret key for operator donor password. CloneDonorPasswordKey = "CLONE_DONOR_PASSWORD" // MiscPasswordKey is a Secret key for misc user password. MiscPasswordKey = "MISC_PASSWORD" // ReadOnlyPasswordKey is a Secret key for moco-readonly user password. ReadOnlyPasswordKey = "READONLY_PASSWORD" // ReadOnlyPasswordKey is a Secret key for moco-writable user password. WritablePasswordKey = "WRITABLE_PASSWORD" // ReplicationSourcePrimaryHostKey etc. are Secret key for replication source secret ReplicationSourcePrimaryHostKey = "PRIMARY_HOST" ReplicationSourcePrimaryUserKey = "PRIMARY_USER" ReplicationSourcePrimaryPasswordKey = "PRIMARY_PASSWORD" ReplicationSourcePrimaryPortKey = "PRIMARY_PORT" ReplicationSourceCloneUserKey = "CLONE_USER" ReplicationSourceClonePasswordKey = "CLONE_PASSWORD" ReplicationSourceInitAfterCloneUserKey = "INIT_AFTER_CLONE_USER" ReplicationSourceInitAfterClonePasswordKey = "INIT_AFTER_CLONE_PASSWORD" )
View Source
const ( MyName = "moco" AppName = "moco-mysql" ClusterKey = "app.kubernetes.io/instance" ManagedByKey = "app.kubernetes.io/managed-by" AppNameKey = "app.kubernetes.io/name" RoleKey = "moco.cybozu.com/role" PrimaryRole = "primary" ReplicaRole = "replica" MysqldContainerName = "mysqld" )
View Source
const ( CloneParamDonorHostName = "donor_hostname" CloneParamDonorPort = "donor_port" CloneParamExternal = "external" )
View Source
const ( ReplicaRunConnect = "Yes" ReplicaNotRun = "No" ReplicaRunNotConnect = "Connecting" CloneStatusNotStarted = "Not Started" CloneStatusInProgress = "In Progress" CloneStatusCompleted = "Completed" CloneStatusFailed = "Failed" )
View Source
const ( PhaseInitializing = OperationPhase("initializing") PhaseWaitRelayLog = OperationPhase("wait-relay-log") PhaseRestoreInstance = OperationPhase("restoring-instance") PhaseCompleted = OperationPhase("completed") )
View Source
const (
// InitializedClusterIndexField is an index name for Initialized MySQL Clusters
InitializedClusterIndexField = ".status.conditions.type.initialized"
)
View Source
const (
// Version is the MOCO version
Version = "0.3.0"
)
Variables ¶
View Source
var ( // ErrConstraintsViolation is returned when the constraints violation occurs ErrConstraintsViolation = errors.New("constraints violation occurs") // ErrConstraintsRecovered is returned when the constrains recovered but once violated ErrConstraintsRecovered = errors.New("constrains recovered but once violated") // ErrCannotCompareGTIDs is returned if GTID comparison returns error ErrCannotCompareGTIDs = errors.New("cannot compare gtids") )
View Source
var ( EventInitializationSucceeded = MOCOEvent{ corev1.EventTypeNormal, "Initialization Succeeded", "Initialization phase finished successfully.", } EventInitializationFailed = MOCOEvent{ corev1.EventTypeWarning, "Initialization Failed", "Initialization phase failed. err=%s", } EventWaitingAllInstancesAvailable = MOCOEvent{ corev1.EventTypeNormal, "Waiting All Instances Available", "Waiting for all instances to become connected from MOCO. unavailable=%v", } EventViolationOccurred = MOCOEvent{ corev1.EventTypeWarning, "Violation Occurred", "Constraint violation occurred. Please resolve via manual operation. err=%v", } EventWatingRelayLogExecution = MOCOEvent{ corev1.EventTypeNormal, "Waiting Relay Log Execution", "Waiting relay log execution on replica instance(s).", } EventWaitingCloneFromExternal = MOCOEvent{ corev1.EventTypeNormal, "Waiting External Clone", "Waiting for the intermediate primary to clone from the external primary", } EventRestoringReplicaInstances = MOCOEvent{ corev1.EventTypeNormal, "Restoring Replica Instance(s)", "Restoring replica instance(s) by cloning with primary instance.", } EventPrimaryChanged = MOCOEvent{ corev1.EventTypeNormal, "Primary Changed", "Primary instance was changed from %s to %s because of failover or switchover.", } EventIntermediatePrimaryConfigured = MOCOEvent{ corev1.EventTypeNormal, "Intermediate Primary Configured", "Intermediate primary instance was configured with host=%s", } EventIntermediatePrimaryUnset = MOCOEvent{ corev1.EventTypeNormal, "Intermediate Primary Unset", "Intermediate primary instance was unset.", } EventClusteringCompletedSynced = MOCOEvent{ corev1.EventTypeNormal, "Clustering Completed and Synced", "Clustering are completed. All instances are synced.", } EventClusteringCompletedNotSynced = MOCOEvent{ corev1.EventTypeWarning, "Clustering Completed but Not Synced", "Clustering are completed. Some instance(s) are not synced. out_of_sync=%v", } )
View Source
var AllOperationPhases = []OperationPhase{ PhaseInitializing, PhaseWaitRelayLog, PhaseRestoreInstance, PhaseCompleted, }
Functions ¶
func GetHost ¶ added in v0.2.0
func GetHost(cluster *mocov1alpha1.MySQLCluster, index int) string
GetHost returns host url of the given cluster and instance
func GetPassword ¶ added in v0.2.0
func GetPassword(ctx context.Context, cluster *mocov1alpha1.MySQLCluster, c client.Client, passwordKey string) (string, error)
GetPassword gets a password from secret
func GetSecretNameForController ¶ added in v0.2.0
func GetSecretNameForController(cluster *mocov1alpha1.MySQLCluster) (string, string)
GetSecretNameForController returns the namespace and Secret name of the cluster
func UniqueName ¶ added in v0.2.0
func UniqueName(cluster *mocov1alpha1.MySQLCluster) string
UniqueName returns unique name of the cluster
Types ¶
type MOCOEvent ¶ added in v0.3.0
func (MOCOEvent) FillVariables ¶ added in v0.3.0
type OperationPhase ¶ added in v0.3.0
type OperationPhase string
Directories ¶
Path | Synopsis |
---|---|
api
|
|
v1alpha1
Package v1alpha1 contains API Schema definitions for the moco v1alpha1 API group +kubebuilder:object:generate=true +groupName=moco.cybozu.com
|
Package v1alpha1 contains API Schema definitions for the moco v1alpha1 API group +kubebuilder:object:generate=true +groupName=moco.cybozu.com |
cmd
|
|
Click to show internal directories.
Click to hide internal directories.