Custom Resources

Sub Resources

BackupStatus

BackupStatus represents the status of the last successful backup.

FieldDescriptionSchemeRequired
timeThe time of the backup. This is used to generate object keys of backup files in a bucket.metav1.Timetrue
elapsedElapsed is the time spent on the backup.metav1.Durationtrue
sourceIndexSourceIndex is the ordinal of the backup source instance.inttrue
sourceUUIDSourceUUID is the server_uuid of the backup source instance.stringtrue
uuidSetUUIDSet is the server_uuid set of all candidate instances for the backup source.map[string]stringtrue
binlogFilenameBinlogFilename is the binlog filename that the backup source instance was writing to at the backup.stringtrue
gtidSetGTIDSet is the GTID set of the full dump of database.stringtrue
dumpSizeDumpSize is the size in bytes of a full dump of database stored in an object storage bucket.int64true
binlogSizeBinlogSize is the size in bytes of a tarball of binlog files stored in an object storage bucket.int64true
workDirUsageWorkDirUsage is the max usage in bytes of the woking directory.int64true
warningsWarnings are list of warnings from the last backup, if any.[]stringtrue

Back to Custom Resources

MySQLCluster

MySQLCluster is the Schema for the mysqlclusters API

FieldDescriptionSchemeRequired
metadatametav1.ObjectMetafalse
specMySQLClusterSpecfalse
statusMySQLClusterStatusfalse

Back to Custom Resources

MySQLClusterList

MySQLClusterList contains a list of MySQLCluster

FieldDescriptionSchemeRequired
metadatametav1.ListMetafalse
items[]MySQLClustertrue

Back to Custom Resources

MySQLClusterSpec

MySQLClusterSpec defines the desired state of MySQLCluster

FieldDescriptionSchemeRequired
replicasReplicas is the number of instances. Available values are positive odd numbers.int32false
podTemplatePodTemplate is a Pod template for MySQL server container.PodTemplateSpectrue
volumeClaimTemplatesVolumeClaimTemplates is a list of PersistentVolumeClaim templates for MySQL server container. A claim named "mysql-data" must be included in the list.[]PersistentVolumeClaimtrue
primaryServiceTemplatePrimaryServiceTemplate is a Service template for primary.*ServiceTemplatefalse
replicaServiceTemplateReplicaServiceTemplate is a Service template for replica.*ServiceTemplatefalse
mysqlConfigMapNameMySQLConfigMapName is a ConfigMap name of MySQL config.*stringfalse
replicationSourceSecretNameReplicationSourceSecretName is a Secret name which contains replication source info. If this field is given, the MySQLCluster works as an intermediate primary.*stringfalse
collectorsCollectors is the list of collector flag names of mysqld_exporter. If this field is not empty, MOCO adds mysqld_exporter as a sidecar to collect and export mysqld metrics in Prometheus format.\n\nSee https://github.com/prometheus/mysqld_exporter/blob/master/README.md#collector-flags for flag names.\n\nExample: ["engine_innodb_status", "info_schema.innodb_metrics"][]stringfalse
serverIDBaseServerIDBase, if set, will become the base number of server-id of each MySQL instance of this cluster. For example, if this is 100, the server-ids will be 100, 101, 102, and so on. If the field is not given or zero, MOCO automatically sets a random positive integer.int32false
maxDelaySecondsMaxDelaySeconds configures the readiness probe of mysqld container. For a replica mysqld instance, if it is delayed to apply transactions over this threshold, the mysqld instance will be marked as non-ready. The default is 60 seconds. Setting this field to 0 disables the delay check in the probe.*intfalse
startupWaitSecondsStartupWaitSeconds is the maximum duration to wait for mysqld container to start working. The default is 3600 seconds.int32false
logRotationScheduleLogRotationSchedule specifies the schedule to rotate MySQL logs. If not set, the default is to rotate logs every 5 minutes. See https://pkg.go.dev/github.com/robfig/cron/v3#hdr-CRON_Expression_Format for the field format.stringfalse
backupPolicyNameThe name of BackupPolicy custom resource in the same namespace. If this is set, MOCO creates a CronJob to take backup of this MySQL cluster periodically.*stringfalse
restoreRestore is the specification to perform Point-in-Time-Recovery from existing cluster. If this field is not null, MOCO restores the data as specified and create a new cluster with the data. This field is not editable.*RestoreSpecfalse
disableSlowQueryLogContainerDisableSlowQueryLogContainer controls whether to add a sidecar container named "slow-log" to output slow logs as the containers output. If set to true, the sidecar container is not added. The default is false.boolfalse
agentUseLocalhostAgentUseLocalhost configures the mysqld interface to bind and be accessed over localhost instead of pod name. During container init moco-agent will set mysql admin interface is bound to localhost. The moco-agent will also communicate with mysqld over localhost when acting as a sidecar.boolfalse
offlineOffline sets the cluster offline, releasing compute resources. Data is not removed.boolfalse

Back to Custom Resources

MySQLClusterStatus

MySQLClusterStatus defines the observed state of MySQLCluster

FieldDescriptionSchemeRequired
conditionsConditions is an array of conditions.[]metav1.Conditionfalse
currentPrimaryIndexCurrentPrimaryIndex is the index of the current primary Pod in StatefulSet. Initially, this is zero.inttrue
syncedReplicasSyncedReplicas is the number of synced instances including the primary.intfalse
errantReplicasErrantReplicas is the number of instances that have errant transactions.intfalse
errantReplicaListErrantReplicaList is the list of indices of errant replicas.[]intfalse
backupBackup is the status of the last successful backup.BackupStatustrue
restoredTimeRestoredTime is the time when the cluster data is restored.*metav1.Timefalse
clonedCloned indicates if the initial cloning from an external source has been completed.boolfalse
reconcileInfoReconcileInfo represents version information for reconciler.ReconcileInfotrue

Back to Custom Resources

ObjectMeta

ObjectMeta is metadata of objects. This is partially copied from metav1.ObjectMeta.

FieldDescriptionSchemeRequired
nameName is the name of the object.stringfalse
labelsLabels is a map of string keys and values.map[string]stringfalse
annotationsAnnotations is a map of string keys and values.map[string]stringfalse

Back to Custom Resources

OverwriteContainer

OverwriteContainer defines the container spec used for overwriting.

FieldDescriptionSchemeRequired
nameName of the container to overwrite.OverwriteableContainerNametrue
resourcesResources is the container resource to be overwritten.*ResourceRequirementsApplyConfigurationfalse

Back to Custom Resources

PersistentVolumeClaim

PersistentVolumeClaim is a user's request for and claim to a persistent volume. This is slightly modified from corev1.PersistentVolumeClaim.

FieldDescriptionSchemeRequired
metadataStandard object's metadata.ObjectMetatrue
specSpec defines the desired characteristics of a volume requested by a pod author.PersistentVolumeClaimSpecApplyConfigurationtrue

Back to Custom Resources

PodTemplateSpec

PodTemplateSpec describes the data a pod should have when created from a template. This is slightly modified from corev1.PodTemplateSpec.

FieldDescriptionSchemeRequired
metadataStandard object's metadata. The name in this metadata is ignored.ObjectMetafalse
specSpecification of the desired behavior of the pod. The name of the MySQL server container in this spec must be mysqld.PodSpecApplyConfigurationtrue
overwriteContainersOverwriteContainers overwrites the container definitions provided by default by the system.[]OverwriteContainerfalse

Back to Custom Resources

ReconcileInfo

ReconcileInfo is the type to record the last reconciliation information.

FieldDescriptionSchemeRequired
generationGeneration is the metadata.generation value of the last reconciliation. See also https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/#status-subresourceint64false
reconcileVersionReconcileVersion is the version of the operator reconciler.inttrue

Back to Custom Resources

RestoreSpec

RestoreSpec represents a set of parameters for Point-in-Time Recovery.

FieldDescriptionSchemeRequired
sourceNameSourceName is the name of the source MySQLCluster.stringtrue
sourceNamespaceSourceNamespace is the namespace of the source MySQLCluster.stringtrue
restorePointRestorePoint is the target date and time to restore data. The format is RFC3339. e.g. "2006-01-02T15:04:05Z"metav1.Timetrue
jobConfigSpecifies parameters for restore Pod.JobConfigtrue
schemaSchema is the name of the schema to restore. If empty, all schemas are restored. This is used for mysqlbinlog option --database. Thus, this option changes behavior depending on binlog_format. For more information, please read the following documentation. https://dev.mysql.com/doc/refman/8.0/en/mysqlbinlog.html#option_mysqlbinlog_databasestringfalse

Back to Custom Resources

ServiceTemplate

ServiceTemplate defines the desired spec and annotations of Service

FieldDescriptionSchemeRequired
metadataStandard object's metadata. Only annotations and labels are valid.ObjectMetafalse
specSpec is the ServiceSpec*ServiceSpecApplyConfigurationfalse

Back to Custom Resources

BucketConfig

BucketConfig is a set of parameter to access an object storage bucket.

FieldDescriptionSchemeRequired
bucketNameThe name of the bucketstringtrue
regionThe region of the bucket. This can also be set through AWS_REGION environment variable.stringfalse
endpointURLThe API endpoint URL. Set this for non-S3 object storages.stringfalse
usePathStyleAllows you to enable the client to use path-style addressing, i.e., https?://ENDPOINT/BUCKET/KEY. By default, a virtual-host addressing is used (https?://BUCKET.ENDPOINT/KEY).boolfalse
backendTypeBackendType is an identifier for the object storage to be used.stringfalse
caCertPath to SSL CA certificate file used in addition to system default.stringfalse

Back to Custom Resources

JobConfig

JobConfig is a set of parameters for backup and restore job Pods.

FieldDescriptionSchemeRequired
serviceAccountNameServiceAccountName specifies the ServiceAccount to run the Pod.stringtrue
bucketConfigSpecifies how to access an object storage bucket.BucketConfigtrue
workVolumeWorkVolume is the volume source for the working directory. Since the backup or restore task can use a lot of bytes in the working directory, You should always give a volume with enough capacity.\n\nThe recommended volume source is a generic ephemeral volume. https://kubernetes.io/docs/concepts/storage/ephemeral-volumes/#generic-ephemeral-volumesVolumeSourceApplyConfigurationtrue
threadsThreads is the number of threads used for backup or restoration.intfalse
cpuCPU is the amount of CPU requested for the Pod.*resource.Quantityfalse
maxCpuMaxCPU is the amount of maximum CPU for the Pod.*resource.Quantityfalse
memoryMemory is the amount of memory requested for the Pod.*resource.Quantityfalse
maxMemoryMaxMemory is the amount of maximum memory for the Pod.*resource.Quantityfalse
envFromList of sources to populate environment variables in the container. The keys defined within a source must be a C_IDENTIFIER. All invalid keys will be reported as an event when the container is starting. When a key exists in multiple sources, the value associated with the last source will take precedence. Values defined by an Env with a duplicate key will take precedence.\n\nYou can configure S3 bucket access parameters through environment variables. See https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/config#EnvConfig[]EnvFromSourceApplyConfigurationfalse
envList of environment variables to set in the container.\n\nYou can configure S3 bucket access parameters through environment variables. See https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/config#EnvConfig[]EnvVarApplyConfigurationfalse
affinityIf specified, the pod's scheduling constraints.*AffinityApplyConfigurationfalse
volumesVolumes defines the list of volumes that can be mounted by containers in the Pod.[]VolumeApplyConfigurationfalse
volumeMountsVolumeMounts describes a list of volume mounts that are to be mounted in a container.[]VolumeMountApplyConfigurationfalse

Back to Custom Resources