Skip to main content

API Reference

Field tables on this page are auto-generated from the CRD OpenAPI schemas via crd-ref-docs. Narrative sections with YAML examples, behavioral semantics, and constraints are hand-maintained.

The API group is:

mysql.cnmsql.co/v1alpha1

The API is still v1alpha1, so fields may change while the operator is under active development.

Packages

mysql.cnmsql.co/v1alpha1

Package v1alpha1 contains API Schema definitions for the mysql v1alpha1 API group.

Resource Types

AffinityConfiguration

AffinityConfiguration contains the info we need to create the affinity rules for Pods.

Appears in:

FieldDescriptionDefaultValidation
enablePodAntiAffinity booleanActivates anti-affinity for the pods. The operator will define pods
anti-affinity unless this field is explicitly set to false
Optional: {}
topologyKey stringTopologyKey to use for anti-affinity configuration. See Kubernetes
documentation for more information on how this works
Optional: {}
nodeSelector object (keys:string, values:string)NodeSelector is map of key-value pairs used to define the nodes on which
the pods can run.
More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
Optional: {}
nodeAffinity NodeAffinityNodeAffinity describes node affinity scheduling rules for the pod.
More info: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#node-affinity
Optional: {}
tolerations Toleration arrayTolerations is a list of Tolerations that should be set for all the pods,
in order to allow them to run on tainted nodes.
More info: https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/
Optional: {}
podAntiAffinityType stringPodAntiAffinityType allows the user to decide whether pod anti-affinity
between cluster instances should be considered a strong requirement
("required") during scheduling or not ("preferred", default).
preferredEnum: [preferred required]
Optional: {}
additionalPodAntiAffinity PodAntiAffinityAdditionalPodAntiAffinity allows to specify pod anti-affinity terms to be
added to the ones generated by the operator if EnablePodAntiAffinity is
set to true (default) or to be used exclusively if set to false.
Optional: {}
additionalPodAffinity PodAffinityAdditionalPodAffinity allows to specify pod affinity terms to be passed to
all the cluster's pods.
Optional: {}

Backup

Backup is a namespaced one-shot physical backup request. Short name: mybackup

Example:

apiVersion: mysql.cnmsql.co/v1alpha1
kind: Backup
metadata:
name: backup-sample
spec:
cluster:
name: cluster-sample
method: xtrabackup
target: prefer-standby
online: true

Deleting a Backup object does not delete remote object-store data.

Backup is the Schema for the backups API.

Appears in:

FieldDescriptionDefaultValidation
apiVersion stringmysql.cnmsql.co/v1alpha1
kind stringBackup
kind stringKind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
Optional: {}
apiVersion stringAPIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
Optional: {}
metadata ObjectMetaRefer to Kubernetes API documentation for fields of metadata.Optional: {}
spec BackupSpecspec defines the desired state of BackupRequired: {}
status BackupStatusstatus defines the observed state of BackupOptional: {}

BackupConfiguration

BackupConfiguration describes the continuous archiving target for the cluster.

Appears in:

FieldDescriptionDefaultValidation
objectStore S3ObjectStoreObjectStore is the S3-compatible destination for backups and binlog
archiving.
Optional: {}
retentionPolicy stringRetentionPolicy is a duration string (e.g. "30d", "8w") describing how
long to keep backups.
Pattern: ^[1-9][0-9]*[dwm]$
Optional: {}
target BackupTargetTarget instance to take backups from, defaults to a standby if available.prefer-standbyEnum: [primary prefer-standby]
Optional: {}
xtrabackupOptions string arrayXtrabackupOptions are extra flags passed to xtrabackup.Optional: {}
continuousArchiving ContinuousArchivingConfigurationContinuousArchiving configures continuous binary-log archiving to the
object store, the foundation for point-in-time recovery. Disabled by
default.
Optional: {}

BackupList

BackupList contains a list of Backup.

FieldDescriptionDefaultValidation
apiVersion stringmysql.cnmsql.co/v1alpha1
kind stringBackupList
kind stringKind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
Optional: {}
apiVersion stringAPIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
Optional: {}
metadata ListMetaRefer to Kubernetes API documentation for fields of metadata.
items Backup array

BackupMethod

Underlying type: string

BackupMethod is the method used to take a physical backup. +kubebuilder:validation:Enum=xtrabackup;volumeSnapshot

Validation:

  • Enum: [xtrabackup volumeSnapshot]

Appears in:

FieldDescription
xtrabackupBackupMethodXtrabackup uses Percona XtraBackup to stream a physical backup
to the object store.
volumeSnapshotBackupMethodVolumeSnapshot uses CSI volume snapshots.

BackupPhase

Underlying type: string

BackupPhase is the current phase of a Backup.

Appears in:

FieldDescription
pendingBackupPhasePending means the backup has not started yet.
runningBackupPhaseRunning means the backup is in progress.
completedBackupPhaseCompleted means the backup finished successfully.
failedBackupPhaseFailed means the backup failed.

BackupSpec

BackupSpec defines the desired state of Backup.

Appears in:

FieldDescriptionDefaultValidation
cluster LocalObjectReferenceCluster references the cluster to back up.Required: {}
objectStore S3ObjectStoreObjectStore overrides the destination configured on the referenced
Cluster. When omitted, the Cluster's backup object store is used.
Optional: {}
method BackupMethodMethod is the backup method to use.xtrabackupEnum: [xtrabackup volumeSnapshot]
Optional: {}
target BackupTargetTarget instance to take the backup from.prefer-standbyEnum: [primary prefer-standby]
Optional: {}
online booleanOnline, when true, performs a non-blocking (hot) backup. Defaults to true.trueOptional: {}

BackupStatus

BackupStatus defines the observed state of Backup.

Appears in:

FieldDescriptionDefaultValidation
phase BackupPhasePhase is the current phase of the backup.Optional: {}
instanceName stringInstanceName is the instance the backup was taken from.Optional: {}
method BackupMethodMethod is the method that was used.Enum: [xtrabackup volumeSnapshot]
Optional: {}
backupId stringBackupID is a unique identifier of the backup in the object store.Optional: {}
jobName stringJobName is the Kubernetes Job running this backup.Optional: {}
destinationPath stringDestinationPath is the full path of the backup in the object store.Optional: {}
sha256 stringSHA256 is the checksum of the uploaded backup artifact.Optional: {}
beginGTID stringBeginGTID/EndGTID record the GTID range covered by the backup.Optional: {}
endGTID stringOptional: {}
beginBinlog stringBeginBinlog/EndBinlog record the binary log coordinates.Optional: {}
endBinlog stringOptional: {}
startedAt TimeStartedAt/StoppedAt record the backup timing.Optional: {}
stoppedAt TimeOptional: {}
error stringError holds the error message if the backup failed.Optional: {}
conditions Condition arrayConditions represent the latest observations of the backup state.Optional: {}

BackupTarget

Underlying type: string

BackupTarget describes which instance a backup is taken from. +kubebuilder:validation:Enum=primary;prefer-standby

Validation:

  • Enum: [primary prefer-standby]

Appears in:

FieldDescription
primaryBackupTargetPrimary takes backups from the primary instance.
prefer-standbyBackupTargetPreferStandby prefers a standby instance, falling back to the
primary if no standby is available.

BootstrapConfiguration

BootstrapConfiguration describes how the cluster is initialised.

Appears in:

FieldDescriptionDefaultValidation
initdb BootstrapInitDBInitDB bootstraps a fresh, empty cluster.Optional: {}
recovery BootstrapRecoveryRecovery bootstraps the cluster by restoring a physical backup.Optional: {}

BootstrapInitDB

BootstrapInitDB configures a fresh cluster initialisation.

Appears in:

FieldDescriptionDefaultValidation
database stringDatabase is the name of the application database to create.Optional: {}
owner stringOwner is the name of the application user that owns the database.Optional: {}
secret LocalObjectReferenceSecret references the credentials for the application user. If empty, a
secret is generated.
Optional: {}
postInitSQL string arrayPostInitSQL is a list of SQL statements run as root after the database is
created.
Optional: {}
characterSet stringEncoding/charset of the application database.Optional: {}
collation stringCollation of the application database.Optional: {}

BootstrapRecovery

BootstrapRecovery configures bootstrapping from a physical backup.

Appears in:

FieldDescriptionDefaultValidation
backup LocalObjectReferenceBackup references a Backup object to recover from.Optional: {}
source stringSource is the name of an entry in ExternalClusters to recover from.
Mutually exclusive with Backup. The entry's objectStore holds the
backups and its name is the S3 key prefix to discover them under.
Optional: {}
backupID stringBackupID narrows recovery to a specific base backup within the object
store. Only meaningful when Source is set; when empty, the latest
completed backup is selected. Ignored when Backup is set.
Optional: {}
recoveryTarget RecoveryTargetRecoveryTarget describes the point-in-time recovery target. When omitted,
recovery proceeds to the latest available point.
Optional: {}

CatalogImage

CatalogImage maps a MySQL major version to a container image.

Appears in:

FieldDescriptionDefaultValidation
major integerMajor is the MySQL major version (e.g. 8 for 8.0/8.4 lines uses the full
version where needed; values map to the image's server version).
Minimum: 5
Required: {}
image stringImage is the fully qualified Percona Server for MySQL image reference.Required: {}

CertificatesConfiguration

CertificatesConfiguration contains the needed configurations to handle server and client certificates for TLS and mTLS communication.

Appears in:

FieldDescriptionDefaultValidation
serverCASecret stringThe secret containing the Server CA certificate. If not defined, a new
secret will be created with a self-signed CA and will be used to generate
the TLS certificate ServerTLSSecret.
Optional: {}
serverTLSSecret stringThe secret of type kubernetes.io/tls containing the server TLS certificate
and key that will be set as ssl-cert and ssl-key. Should be signed by the
CA in ServerCASecret.
Optional: {}
replicationTLSSecret stringThe secret of type kubernetes.io/tls containing the client certificate to
authenticate as the replication user. Should be signed by the CA in
ClientCASecret.
Optional: {}
clientCASecret stringThe secret containing the Client CA certificate. If not defined, a new
secret will be created with a self-signed CA and will be used to generate
all the client certificates.
Optional: {}
serverAltDNSNames string arrayThe list of additional Subject Alternative Names (SANs) to be added to the
server certificate generated by the operator.
Optional: {}

CertificatesStatus

CertificatesStatus contains configuration certificates and related expiration dates.

Appears in:

FieldDescriptionDefaultValidation
serverCASecret stringThe secret containing the Server CA certificate. If not defined, a new
secret will be created with a self-signed CA and will be used to generate
the TLS certificate ServerTLSSecret.
Optional: {}
serverTLSSecret stringThe secret of type kubernetes.io/tls containing the server TLS certificate
and key that will be set as ssl-cert and ssl-key. Should be signed by the
CA in ServerCASecret.
Optional: {}
replicationTLSSecret stringThe secret of type kubernetes.io/tls containing the client certificate to
authenticate as the replication user. Should be signed by the CA in
ClientCASecret.
Optional: {}
clientCASecret stringThe secret containing the Client CA certificate. If not defined, a new
secret will be created with a self-signed CA and will be used to generate
all the client certificates.
Optional: {}
serverAltDNSNames string arrayThe list of additional Subject Alternative Names (SANs) to be added to the
server certificate generated by the operator.
Optional: {}
expirations object (keys:string, values:string)Expiration dates for all certificates.Optional: {}

Cluster

Cluster is the main namespaced resource. It describes a Percona Server for MySQL topology, bootstrap method, storage, image, backup configuration, and operational policy.

Short names: mysql, mysqlcluster

Minimal example

apiVersion: mysql.cnmsql.co/v1alpha1
kind: Cluster
metadata:
name: cluster-sample
spec:
instances: 3
imageName: ghcr.io/cnmsql/cnmsql-instance:8.4
storage:
size: 10Gi
mysql:
binlogFormat: ROW
bootstrap:
initdb:
database: app
owner: app

Image selection

Use either imageName for a direct reference or imageCatalogRef to resolve via a catalog:

spec:
imageName: ghcr.io/cnmsql/cnmsql-instance:8.4
spec:
imageCatalogRef:
apiGroup: mysql.cnmsql.co
kind: ImageCatalog
name: percona-images
major: 8

MySQL configuration

spec:
mysql:
parameters:
require_secure_transport: "ON"
max_connections: "500"
binlogFormat: ROW
semiSync:
enabled: true
timeoutMillis: 1000
dataDurability: preferred
additionalConfigFiles:
custom.cnf: |
[mysqld]
sort_buffer_size=4M

Denied and deprecated parameters: spec.mysql.parameters is validated before provisioning. Keys are compared case-insensitively with dashes and underscores treated as equivalent (log-bin equals log_bin).

Denied keys set the cluster phase: Blocked with a reason naming the offending key. These are keys the operator manages directly (replication identity, topology, TLS material, binlog durability) or keys that would relocate on-disk paths or expose the administrative interface: server_id, gtid_mode, read_only, log_bin, ssl_cert, sync_binlog, datadir, socket, tmpdir, plugin_dir, secure_file_priv, log_error, admin_address, admin_ssl_cert, tls_ciphersuites, skip_replica_start, auto_generate_certs. require_secure_transport is not denied — requiring TLS for client connections is the user's choice.

Deprecated keys are accepted but emit a DeprecatedParameter warning event pointing at the current spelling, e.g. slave_parallel_workers (use replica_parallel_workers), master_info_repository (removed on 8.0.23+).

Storage

spec:
storage:
storageClass: fast
size: 100Gi
resizeInUseVolumes: true

storage and binlogStorage share the same shape: storageClass, size, resizeInUseVolumes, and pvcTemplate for a full PVC template override.

Bootstrap

Fresh initialization:

spec:
bootstrap:
initdb:
database: app
owner: app
secret:
name: app-credentials
postInitSQL:
- CREATE TABLE app.ready (id int primary key)
characterSet: utf8mb4
collation: utf8mb4_0900_ai_ci

Recovery from a Backup:

spec:
bootstrap:
recovery:
backup:
name: backup-sample

Point-in-time recovery:

spec:
bootstrap:
recovery:
backup:
name: backup-sample
recoveryTarget:
targetGTID: "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:1-500"

Raw object-store recovery (no Backup CR) points bootstrap.recovery.source at an externalClusters entry. The entry carries its own objectStore and its name is the S3 key prefix:

spec:
bootstrap:
recovery:
source: prod-cluster
backupID: "" # empty = latest completed
recoveryTarget:
targetGTID: "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:1-500"
externalClusters:
- name: prod-cluster
objectStore:
bucket: cnmsql-backups
path: production
endpoint: http://minio.minio.svc:9000
credentials:
accessKeyId:
name: minio-creds
key: accessKey
secretAccessKey:
name: minio-creds
key: secretKey

recovery.backup and recovery.source are mutually exclusive. backupID is only meaningful with source — when empty, the operator selects the latest completed backup.

recoveryTarget accepts exactly one of targetTime (RFC3339 timestamp), targetGTID (inclusive GTID set), or targetImmediate (stop as soon as the base backup is consistent). An empty recoveryTarget: {} replays to the latest archived point. No recoveryTarget restores the base backup only.

Managed services

spec:
managed:
services:
disabledDefaultServices:
- ro
template:
metadata:
labels:
app.kubernetes.io/part-of: my-app
spec:
type: LoadBalancer
additional:
- name: mysql-lb
selectorType: rw
serviceTemplate:
spec:
type: LoadBalancer

disabledDefaultServices accepts ro and r. The rw service cannot be disabled. template is merged onto each default rw/ro/r service. additional services are rendered as `<cluster>-<name>`.

Managed roles

spec.managed.roles declares MySQL users the operator reconciles on the primary. When passwordSecret is omitted, the operator generates a password and stores it in a Secret named `<cluster>-<roleName>` (key password).

spec:
managed:
roles:
- name: app
host: "%"
ensure: present
passwordSecret:
name: app-credentials
key: password
requireTLS: x509
maxUserConnections: 50
privileges:
- privileges: [SELECT, INSERT, UPDATE, DELETE]
"on": app.*
- name: readonly
ensure: present
privileges:
- privileges: [SELECT]
"on": app.*
- name: legacy
ensure: absent

Quote the on key ("on": app.*). Unquoted, YAML parses on as boolean true and the API server rejects the manifest.

Users present in MySQL but not declared in spec.managed.roles are left untouched. To remove one, declare it with ensure: absent. Reconciliation runs after the cluster reaches Ready.

External clusters

externalClusters defines named external sources for replica or raw object-store recovery flows:

spec:
externalClusters:
- name: source-cluster
connectionParameters:
host: mysql.example.com
port: "3306"
password:
name: source-creds
key: password
objectStore:
bucket: source-backups
path: production
credentials:
inheritFromIAMRole: true

Cluster

Cluster is the Schema for the clusters API.

Appears in:

FieldDescriptionDefaultValidation
apiVersion stringmysql.cnmsql.co/v1alpha1
kind stringCluster
kind stringKind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
Optional: {}
apiVersion stringAPIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
Optional: {}
metadata ObjectMetaRefer to Kubernetes API documentation for fields of metadata.Optional: {}
spec ClusterSpecspec defines the desired state of ClusterRequired: {}
status ClusterStatusstatus defines the observed state of ClusterOptional: {}

ClusterImageCatalog

ClusterImageCatalog has the same spec.images shape as ImageCatalog, but is cluster-scoped and can be reused across namespaces. Short name: myclusterimagecatalog

Example:

apiVersion: mysql.cnmsql.co/v1alpha1
kind: ClusterImageCatalog
metadata:
name: global-percona-images
spec:
images:
- major: 8
image: ghcr.io/cnmsql/cnmsql-instance:8.4
- major: 9
image: ghcr.io/cnmsql/cnmsql-instance:9.x

Reference it from a Cluster with imageCatalogRef using kind: ClusterImageCatalog.

ClusterImageCatalog is the Schema for the clusterimagecatalogs API (cluster-scoped).

Appears in:

FieldDescriptionDefaultValidation
apiVersion stringmysql.cnmsql.co/v1alpha1
kind stringClusterImageCatalog
kind stringKind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
Optional: {}
apiVersion stringAPIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
Optional: {}
metadata ObjectMetaRefer to Kubernetes API documentation for fields of metadata.Optional: {}
spec ImageCatalogSpecspec defines the desired state of ClusterImageCatalogRequired: {}

ClusterImageCatalogList

ClusterImageCatalogList contains a list of ClusterImageCatalog.

FieldDescriptionDefaultValidation
apiVersion stringmysql.cnmsql.co/v1alpha1
kind stringClusterImageCatalogList
kind stringKind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
Optional: {}
apiVersion stringAPIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
Optional: {}
metadata ListMetaRefer to Kubernetes API documentation for fields of metadata.
items ClusterImageCatalog array

ClusterList

ClusterList contains a list of Cluster.

FieldDescriptionDefaultValidation
apiVersion stringmysql.cnmsql.co/v1alpha1
kind stringClusterList
kind stringKind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
Optional: {}
apiVersion stringAPIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
Optional: {}
metadata ListMetaRefer to Kubernetes API documentation for fields of metadata.
items Cluster array

ClusterMonitoringTLSConfig

ClusterMonitoringTLSConfig configures TLS for cluster metrics scraping.

Appears in:

FieldDescriptionDefaultValidation
enabled booleanEnabled serves metrics over TLS when true.falseOptional: {}

ClusterSpec

ClusterSpec defines the desired state of Cluster.

Appears in:

FieldDescriptionDefaultValidation
description stringDescription of this MySQL cluster.Optional: {}
inheritedMetadata EmbeddedObjectMetadataMetadata that will be inherited by all objects related to the Cluster.Optional: {}
imageName stringImageName is the name of the Percona Server for MySQL container image to
use. Mutually exclusive with ImageCatalogRef.
Optional: {}
imageCatalogRef ImageCatalogRefImageCatalogRef resolves the image from an ImageCatalog or
ClusterImageCatalog based on the MySQL major version. Mutually exclusive
with ImageName.
Optional: {}
imagePullPolicy PullPolicyImagePullPolicy is the policy used to pull the container image.Enum: [Always Never IfNotPresent]
Optional: {}
imagePullSecrets LocalObjectReference arrayImagePullSecrets is the list of pull secrets used to pull the image.Optional: {}
instances integerInstances is the number of MySQL instances (one primary + replicas).1Minimum: 1
Optional: {}
minSyncReplicas integerMinSyncReplicas is the minimum number of semi-synchronous replicas that
must acknowledge a transaction before it is committed on the primary.
Minimum: 0
Optional: {}
maxSyncReplicas integerMaxSyncReplicas is the maximum number of semi-synchronous replicas the
primary will wait for. Must be lower than the number of instances.
Minimum: 0
Optional: {}
mysql MySQLConfigurationMySQL holds the engine configuration (my.cnf parameters, replication
options).
Optional: {}
storage StorageConfigurationStorage configuration for the instance data directory.Required: {}
binlogStorage StorageConfigurationBinlogStorage, when set, places the binary logs on a separate volume from
the data directory.
Optional: {}
bootstrap BootstrapConfigurationBootstrap describes how the cluster is initialised (fresh init or recovery
from a backup).
Optional: {}
rootPasswordSecret LocalObjectReferenceRootPasswordSecret references a secret containing the password for the
MySQL root user. If not provided, a secret is generated.
Optional: {}
enableSuperuserAccess booleanEnableSuperuserAccess, when true, makes the root user reachable through the
generated/provided secret. Defaults to false.
falseOptional: {}
certificates CertificatesConfigurationCertificates configures the TLS/mTLS material used by the cluster.Optional: {}
resources ResourceRequirementsResources describes the compute resource requirements of the instance
pods.
Optional: {}
affinity AffinityConfigurationAffinity/anti-affinity rules for the instance pods.Optional: {}
topologySpreadConstraints TopologySpreadConstraint arrayTopologySpreadConstraints describes how the instance pods should be spread
across topology domains.
Optional: {}
priorityClassName stringPriorityClassName for the instance pods.Optional: {}
schedulerName stringSchedulerName to use for the instance pods.Optional: {}
primaryUpdateStrategy PrimaryUpdateStrategyPrimaryUpdateStrategy controls whether the operator performs the primary
update automatically (unsupervised) or waits for the user (supervised).
unsupervisedEnum: [unsupervised supervised]
Optional: {}
primaryUpdateMethod PrimaryUpdateMethodPrimaryUpdateMethod controls how the primary is updated: by switchover
(promoting a replica first) or by in-place restart.
switchoverEnum: [switchover restart]
Optional: {}
inPlaceInstanceManagerUpdates booleanInPlaceInstanceManagerUpdates, when true, rolls an operator upgrade out to
this cluster's instances by streaming the new instance-manager binary to each
Pod, which re-execs in place — no Pod restart and no switchover. When false
(the default) the operator instead deletes and recreates each Pod one at a
time (replicas first, primary last via switchover).
Optional: {}
maxStartDelay integerMaxStartDelay is the time in seconds allowed for an instance to start.3600Optional: {}
maxStopDelay integerMaxStopDelay is the time in seconds allowed for an instance to gracefully
shut down.
1800Optional: {}
smartShutdownTimeout integerSmartShutdownTimeout is the time in seconds reserved for a "smart"
(graceful) shutdown attempt before falling back to a "fast" shutdown.
Must be lower than maxStopDelay; the remaining time is used for the
fast/immediate fallback. Defaults to 180.
Minimum: 0
Optional: {}
maxSwitchoverDelay integerMaxSwitchoverDelay is the time in seconds allowed for a switchover to
complete before being considered failed.
3600Optional: {}
failoverDelay integerFailoverDelay is the amount of time in seconds the operator waits before
declaring an unreachable primary failed and triggering a failover.
0Optional: {}
enablePrimaryLease booleanEnablePrimaryLease, when true (default), makes the acting primary hold a
per-cluster Lease before accepting writes.
trueOptional: {}
backup BackupConfigurationBackup configures continuous archiving and the object store target.Optional: {}
replica ReplicaClusterConfigurationReplica turns this cluster into a replica cluster that follows a source
defined in ExternalClusters.
Optional: {}
externalClusters ExternalCluster arrayExternalClusters is the list of external clusters that can be used as a
replication source or a recovery origin.
Optional: {}
managed ManagedConfigurationManaged describes the resources (roles, services) managed declaratively by
the operator.
Optional: {}
monitoring MonitoringConfigurationMonitoring configuration.Optional: {}
nodeMaintenanceWindow NodeMaintenanceWindowNodeMaintenanceWindow defines if the cluster is tolerant to node failures
during maintenance (e.g. PVC may be reused).
Optional: {}
enablePDB booleanEnablePDB, when true (default), makes the operator create a
PodDisruptionBudget for the cluster.
trueOptional: {}
serviceAccountTemplate ServiceAccountTemplateServiceAccountTemplate to use for the generated service account.Optional: {}
env EnvVar arrayEnv is a list of additional environment variables added to the instance
containers.
Optional: {}
envFrom EnvFromSource arrayEnvFrom is a list of sources to populate environment variables in the
instance containers.
Optional: {}
podSecurityContext PodSecurityContextPodSecurityContext applied to the instance pods.Optional: {}
securityContext SecurityContextSecurityContext applied to the instance containers.Optional: {}
logLevel stringLogLevel sets the operator-side log level for this cluster.infoEnum: [error warning info debug trace]
Optional: {}

ClusterStatus

ClusterStatus defines the observed state of Cluster.

Appears in:

FieldDescriptionDefaultValidation
instances integerInstances is the total number of instances reported.Optional: {}
readyInstances integerReadyInstances is the number of ready instances.Optional: {}
instanceNames string arrayInstanceNames is the list of instance (pod) names.Optional: {}
currentPrimary stringCurrentPrimary is the name of the instance currently acting as primary.Optional: {}
targetPrimary stringTargetPrimary is the name of the instance that should become primary (used
during switchover/failover).
Optional: {}
currentPrimaryTimestamp stringCurrentPrimaryTimestamp is when the current primary was elected.Optional: {}
targetPrimaryTimestamp stringTargetPrimaryTimestamp is when the current switchover request to
TargetPrimary was started. It bounds the switchover by spec.maxSwitchoverDelay.
Optional: {}
divergedInstances string arrayDivergedInstances are replicas whose executed GTID set is not contained in
the primary's (errant transactions). They cannot safely rejoin; their
in-Pod reconciler reads this list and refuses to self-configure as a
replica, leaving them read-only for an operator to resolve.
Optional: {}
fencedInstances string arrayFencedInstances are instances the operator has fenced because their Pod
carries the fencing annotation. A fenced instance is pulled out of the
routing Services, kept read-only by its in-Pod reconciler (so it stops
archiving and refuses writes), and is excluded as a failover candidate.
Clearing the annotation removes it from this list and restores it.
Optional: {}
failedInstances string arrayFailedInstances are instances whose Pod shows positive evidence of being
unable to run: a Failed Pod phase, or a container stuck in CrashLoopBackOff
after repeated restarts. Unlike a not-yet-ready instance (which is expected
during initial provisioning), a failed instance is a degradation regardless
of whether the cluster ever finished provisioning, so it is surfaced
independently of the phase. It is the cluster's "unhealthy" bucket.
Optional: {}
replicationBrokenInstances string arrayReplicationBrokenInstances are reachable replicas whose replication has
aborted with a recorded error — a stopped IO or SQL thread, e.g. a
duplicate-key conflict that halts replication. Unlike a diverged instance
(detected by comparing GTID sets and listed in DivergedInstances), this is
derived from the SQL-layer replication error the in-Pod reconciler reports,
so a replica that is Running but cannot replicate is surfaced as a
degradation rather than being mistaken for one still finishing provisioning.
Optional: {}
primaryFailingSince stringPrimaryFailingSince records when the current primary first became
unreachable. It is used to enforce spec.failoverDelay before an automatic
failover, and is cleared once the primary is healthy again.
Optional: {}
latestGeneratedNode integerLatestGeneratedNode is the serial of the latest generated instance.Optional: {}
establishedAt TimeEstablishedAt records the first time the cluster reached full readiness
(every instance ready together), marking that it completed initial
provisioning at least once. It is sticky: once set it is never cleared, so a
later degradation cannot reset it. Its presence is what distinguishes a
cluster that is still being provisioned (a drop below readiness is expected)
from an established one (a drop below readiness is a degradation). It is
deliberately independent of Phase, which intermediate reconcile steps
re-stamp and which therefore cannot carry this fact reliably.
Optional: {}
phase stringPhase is a high-level human-readable cluster phase.Optional: {}
phaseReason stringPhaseReason gives more detail about the current phase.Optional: {}
image stringImage is the resolved image currently in use.Optional: {}
gtidExecutedByInstance object (keys:string, values:string)GTIDExecutedByInstance maps an instance name to its gtid_executed set.Optional: {}
gtidExecutedUpdatedAt TimeGTIDExecutedUpdatedAt records when GTIDExecutedByInstance was last
refreshed. Because gtid_executed advances on every write, the operator
throttles how often it persists the map; this timestamp marks the last
persisted snapshot.
Optional: {}
executableHashByInstance object (keys:string, values:string)ExecutableHashByInstance maps an instance name to the SHA-256 hash of its
running instance manager binary, as reported by the in-Pod control API.
The operator uses it to detect stale instance managers when upgrading.
Optional: {}
operatorExecutableHash stringOperatorExecutableHash is the SHA-256 hash of the running operator binary.
It is the target hash every instance manager should match after an upgrade.
Optional: {}
certificates CertificatesStatusCertificates reports the status of the managed certificates.Optional: {}
continuousArchiving ContinuousArchivingStatusContinuousArchiving reports the health of continuous binlog archiving when
it is enabled.
Optional: {}
lastRetentionRunTime TimeLastRetentionRunTime is when the operator last ran a backup-retention GC
pass against the object store. It throttles the periodic pass.
Optional: {}
observedGeneration integerObservedGeneration is the generation observed by the controller.Optional: {}
conditions Condition arrayConditions represent the latest available observations of the cluster's
state.
Optional: {}
managedRolesStatus ManagedRolesStatusManagedRolesStatus reports the reconciliation state of the declarative
managed roles.
Optional: {}

ConfigMapKeySelector

ConfigMapKeySelector selects a key from a ConfigMap in the same namespace.

Appears in:

FieldDescriptionDefaultValidation
name stringName of the ConfigMapRequired: {}
key stringKey within the ConfigMap to selectRequired: {}

ContinuousArchivingConfiguration

ContinuousArchivingConfiguration configures continuous binary-log (binlog) archiving: the current primary's instance manager ships rotated binlog files to the object store so the cluster keeps a gapless, GTID-addressable change history.

Appears in:

FieldDescriptionDefaultValidation
enabled booleanEnabled turns continuous binlog archiving on. Requires Backup.ObjectStore.falseOptional: {}
targetRPOSeconds integerTargetRPOSeconds bounds the recovery point objective: the primary forces a
binary-log rotation at least this often so a low-write cluster still
archives promptly. Defaults to 300 (5 minutes).
300Minimum: 10
Optional: {}
maxBinlogSizeMB integerMaxBinlogSizeMB caps the active binary log before mysqld rotates it,
bounding the size-based RPO and per-object size. Defaults to 16 MiB.
16Minimum: 1
Optional: {}
binlogExpireSeconds integerBinlogExpireSeconds is the conservative backstop after which mysqld may
expire a binary log, applied under the active purge gate. Defaults to
604800 (7 days).
604800Minimum: 0
Optional: {}

ContinuousArchivingStatus

ContinuousArchivingStatus reports the health and frontier of continuous binary-log archiving.

Appears in:

FieldDescriptionDefaultValidation
enabled booleanEnabled mirrors whether continuous archiving is configured on.Optional: {}
lastArchivedBinlog stringLastArchivedBinlog is the most recent binary-log file shipped by the
current primary.
Optional: {}
lastArchivedGTID stringLastArchivedGTID is the last GTID covered by the archive.Optional: {}
lastArchivedTime stringLastArchivedTime is when the most recent file finished archiving.Optional: {}
pendingFiles integerPendingFiles is the number of rotated binary logs not yet archived
(archive lag). A growing value means the archiver is falling behind.
Optional: {}
lastFailureReason stringLastFailureReason and LastFailureTime record the most recent archiving
failure on the current primary, if any.
Optional: {}
lastFailureTime stringOptional: {}

Database

Database is a namespaced CRD (short name mydatabase) that declares a MySQL schema and the accounts scoped to it. It references a Cluster in the same namespace, which makes it the unit you delegate to tenant teams. The controller diffs the spec against the live server and issues the minimal SQL to converge; nothing is dropped unless you ask for it.

Example:

apiVersion: mysql.cnmsql.co/v1alpha1
kind: Database
metadata:
name: tenant-a
namespace: shared # must match the Cluster's namespace
spec:
cluster:
name: shared
name: tenant_a # the MySQL schema; defaults to the resource name
ensure: present
characterSet: utf8mb4
collation: utf8mb4_0900_ai_ci
reclaimPolicy: retain
users:
- name: tenant_a_app
host: "%"
ensure: present
passwordSecret:
name: tenant-a-db
key: password
grants:
- privileges: [SELECT, INSERT, UPDATE, DELETE]
# `on` defaults to the managed schema (tenant_a.*)

Database is the Schema for the databases API.

Appears in:

FieldDescriptionDefaultValidation
apiVersion stringmysql.cnmsql.co/v1alpha1
kind stringDatabase
kind stringKind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
Optional: {}
apiVersion stringAPIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
Optional: {}
metadata ObjectMetaRefer to Kubernetes API documentation for fields of metadata.Optional: {}
spec DatabaseSpecspec defines the desired state of DatabaseRequired: {}
status DatabaseStatusstatus defines the observed state of DatabaseOptional: {}

DatabaseGrant

DatabaseGrant describes a single MySQL GRANT statement.

Appears in:

FieldDescriptionDefaultValidation
privileges string arrayPrivileges is the list of privileges (e.g. "SELECT", "INSERT", "ALL").Required: {}
on stringOn is the target of the grant (e.g. "mydb.*"). Defaults to the managed
database.
Optional: {}

DatabaseList

DatabaseList contains a list of Database.

FieldDescriptionDefaultValidation
apiVersion stringmysql.cnmsql.co/v1alpha1
kind stringDatabaseList
kind stringKind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
Optional: {}
apiVersion stringAPIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
Optional: {}
metadata ListMetaRefer to Kubernetes API documentation for fields of metadata.
items Database array

DatabaseSpec

DatabaseSpec defines the desired state of Database.

Appears in:

FieldDescriptionDefaultValidation
cluster LocalObjectReferenceCluster references the MySQL cluster this database belongs to.Required: {}
name stringName is the name of the MySQL database (schema). Defaults to the resource
name if empty.
Optional: {}
ensure EnsureOptionEnsure controls whether the database is created or dropped.presentEnum: [present absent]
Optional: {}
characterSet stringCharacterSet of the database (e.g. "utf8mb4").Optional: {}
collation stringCollation of the database (e.g. "utf8mb4_0900_ai_ci").Optional: {}
users DatabaseUser arrayUsers is the list of users managed for this database.Optional: {}
reclaimPolicy stringReclaimPolicy controls what happens to the MySQL database when the
Database object is deleted.
retainEnum: [delete retain]
Optional: {}

DatabaseStatus

DatabaseStatus defines the observed state of Database.

Appears in:

FieldDescriptionDefaultValidation
applied booleanApplied is true once the desired state has been reconciled.Optional: {}
message stringMessage provides additional detail, typically an error.Optional: {}
observedGeneration integerObservedGeneration is the generation observed by the controller.Optional: {}
passwordStatus object (keys:string, values:string)PasswordStatus records, per managed user ("name@host"), the source Secret
resourceVersion last applied to MySQL. It lets the controller re-apply a
password only when its Secret changes.
Optional: {}
conditions Condition arrayConditions represent the latest observations of the database state.Optional: {}

DatabaseUser

DatabaseUser describes a MySQL user managed declaratively.

Appears in:

FieldDescriptionDefaultValidation
name stringName of the user.Required: {}
host stringHost the user connects from. Defaults to "%".%Optional: {}
ensure EnsureOptionEnsure controls whether the user is created or dropped.presentEnum: [present absent]
Optional: {}
passwordSecret SecretKeySelectorPasswordSecret references the secret key holding the user's password.Optional: {}
grants DatabaseGrant arrayGrants is the list of grants applied to the user.Optional: {}

EmbeddedObjectMetadata

EmbeddedObjectMetadata contains metadata to be inherited by all resources related to a Cluster.

Appears in:

FieldDescriptionDefaultValidation
labels object (keys:string, values:string)Optional: {}
annotations object (keys:string, values:string)Optional: {}

EnsureOption

Underlying type: string

EnsureOption controls whether a declarative object must be present or absent. +kubebuilder:validation:Enum=present;absent

Validation:

  • Enum: [present absent]

Appears in:

FieldDescription
presentEnsurePresent means the object must exist.
absentEnsureAbsent means the object must not exist.

ExternalCluster

ExternalCluster describes a MySQL server external to this Cluster, used as a replication source or recovery origin.

Appears in:

FieldDescriptionDefaultValidation
name stringName of the external cluster, referenced by Replica.Source and
BootstrapRecovery.Source.
Required: {}
connectionParameters object (keys:string, values:string)ConnectionParameters is a key/value map of connection settings (host,
port, etc.).
Optional: {}
password SecretKeySelectorPassword references a secret key holding the password for the connection.Optional: {}
sslCert SecretKeySelectorSSLCert/SSLKey/SSLRootCert reference secret keys for mTLS to the source.Optional: {}
sslKey SecretKeySelectorOptional: {}
sslRootCert SecretKeySelectorOptional: {}
objectStore S3ObjectStoreObjectStore allows recovering from a backup stored in an object store.Optional: {}

ImageCatalog

ImageCatalog is a namespaced mapping from MySQL major version to instance image. Short name: myimagecatalog

Example:

apiVersion: mysql.cnmsql.co/v1alpha1
kind: ImageCatalog
metadata:
name: percona-images
spec:
images:
- major: 8
image: ghcr.io/cnmsql/cnmsql-instance:8.4
- major: 9
image: ghcr.io/cnmsql/cnmsql-instance:9.x

Each major value can appear at most once in the images list (minimum one, maximum eight).

ImageCatalog is the Schema for the imagecatalogs API (namespaced).

Appears in:

FieldDescriptionDefaultValidation
apiVersion stringmysql.cnmsql.co/v1alpha1
kind stringImageCatalog
kind stringKind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
Optional: {}
apiVersion stringAPIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
Optional: {}
metadata ObjectMetaRefer to Kubernetes API documentation for fields of metadata.Optional: {}
spec ImageCatalogSpecspec defines the desired state of ImageCatalogRequired: {}

ImageCatalogList

ImageCatalogList contains a list of ImageCatalog.

FieldDescriptionDefaultValidation
apiVersion stringmysql.cnmsql.co/v1alpha1
kind stringImageCatalogList
kind stringKind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
Optional: {}
apiVersion stringAPIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
Optional: {}
metadata ListMetaRefer to Kubernetes API documentation for fields of metadata.
items ImageCatalog array

ImageCatalogRef

ImageCatalogRef references an ImageCatalog or ClusterImageCatalog entry to resolve a container image for a given major version.

Appears in:

FieldDescriptionDefaultValidation
apiGroup stringAPIGroup is the group for the resource being referenced.
If APIGroup is not specified, the specified Kind must be in the core API group.
For any other third-party types, APIGroup is required.
Optional: {}
kind stringKind is the type of resource being referenced
name stringName is the name of resource being referenced
major integerMajor is the MySQL major version to resolve in the catalog.Required: {}

ImageCatalogSpec

ImageCatalogSpec is the shared spec for ImageCatalog and ClusterImageCatalog.

Appears in:

FieldDescriptionDefaultValidation
images CatalogImage arrayImages is the list of major version to container image mappings. Each
major version must appear at most once.
MaxItems: 8
MinItems: 1

LocalObjectReference

LocalObjectReference contains the reference to a Kubernetes object in the same namespace, identified by name.

Appears in:

FieldDescriptionDefaultValidation
name stringName of the referentRequired: {}

ManagedConfiguration

ManagedConfiguration describes resources managed declaratively by the operator.

Appears in:

FieldDescriptionDefaultValidation
services ManagedServicesServices describes the services managed for the cluster.Optional: {}
roles RoleConfiguration arrayRoles is the list of MySQL users (roles) managed declaratively on the
primary instance.
Optional: {}

ManagedRoleStatus

Underlying type: string

ManagedRoleStatus is the reconciliation state of a single managed role.

Appears in:

FieldDescription
reconciledManagedRoleReconciled means the role matches its desired state.
not-managedManagedRoleNotManaged means the MySQL user exists but is not managed.
pending-reconciliationManagedRolePendingReconciliation means the role still needs work.
reservedManagedRoleReserved means the role name is reserved by the operator.

ManagedRolesStatus

ManagedRolesStatus reports the reconciliation state of managed roles.

Appears in:

FieldDescriptionDefaultValidation
byStatus object (keys:ManagedRoleStatus, values:string array)ByStatus groups managed role names by their reconciliation status.Optional: {}
cannotReconcile object (keys:string, values:string array)CannotReconcile maps a role name to the reasons it could not be reconciled.Optional: {}
passwordStatus object (keys:string, values:RolePasswordState)PasswordStatus tracks the applied password Secret version per role.Optional: {}

ManagedService

ManagedService describes a user-defined managed service.

Appears in:

FieldDescriptionDefaultValidation
selectorType ServiceSelectorTypeSelectorType specifies the type of selectors the service will have.
Valid values are "rw", "r", and "ro".
Enum: [rw r ro]
Required: {}
name stringName is the name of the additional service. Must be unique among all
managed services and must not collide with the default service names
<cluster>-rw, <cluster>-ro, <cluster>-r).
Required: {}
updateStrategy ServiceUpdateStrategyUpdateStrategy describes how the service template is reconciled with the
operator defaults.
patchEnum: [patch replace]
Optional: {}
serviceTemplate ServiceTemplateSpecServiceTemplate is the template specification for the service. When
UpdateStrategy is "patch", fields here are merged on top of the
role-specific defaults. When "replace", they replace the defaults
entirely (except for selector and owner reference).
Optional: {}

ManagedServices

ManagedServices controls the services generated for the cluster.

Appears in:

FieldDescriptionDefaultValidation
disabledDefaultServices ServiceSelectorType arrayDisabledDefaultServices is the list of default services (rw, ro, r) to
disable. The rw service cannot be disabled.
Enum: [rw ro r]
Optional: {}
template ServiceTemplateSpecTemplate applies to the three default services (rw, ro, r). Fields set
here are merged into each default service. The operator still chooses the
selector and port based on the service role.
Optional: {}
additional ManagedService arrayAdditional is a list of additional managed services specified by the
user. Each entry declares a selectorType and an optional template to
overlay on top of the role-specific defaults.
Optional: {}

Metadata

Metadata is a structure similar to the metav1.ObjectMeta, but still parseable by controller-gen to create a suitable CRD for the user. The comment of PodTemplateSpec has an explanation of why we are not using the core data types.

Appears in:

FieldDescriptionDefaultValidation
name stringThe name of the resource. Only supported for certain typesOptional: {}
labels object (keys:string, values:string)Map of string keys and values that can be used to organize and categorize
(scope and select) objects. May match selectors of replication controllers
and services.
More info: http://kubernetes.io/docs/user-guide/labels
Optional: {}
annotations object (keys:string, values:string)Annotations is an unstructured key value map stored with a resource that
may be set by external tools to store and retrieve arbitrary metadata. They
are not queryable and should be preserved when modifying objects.
More info: http://kubernetes.io/docs/user-guide/annotations
Optional: {}

MonitoringConfiguration

MonitoringConfiguration configures cluster monitoring.

Appears in:

FieldDescriptionDefaultValidation
enablePodMonitor booleanEnablePodMonitor creates a PodMonitor for the cluster pods.falseOptional: {}
customQueriesConfigMap ConfigMapKeySelector arrayCustomQueriesConfigMap references config maps holding custom monitoring
queries.
Optional: {}
customQueriesSecret SecretKeySelector arrayCustomQueriesSecret references secrets holding custom monitoring queries.Optional: {}
disableDefaultQueries booleanDisableDefaultQueries disables the built-in monitoring query set.Optional: {}
metricsQueriesTTL DurationMetricsQueriesTTL is the minimum interval between executions of the
default and custom monitoring queries.
Optional: {}
tls ClusterMonitoringTLSConfigTLS configures TLS for the instance metrics endpoint.Optional: {}

MySQLConfiguration

MySQLConfiguration holds the MySQL engine configuration.

Appears in:

FieldDescriptionDefaultValidation
parameters object (keys:string, values:string)Parameters is a key/value map of my.cnf settings applied under the
[mysqld] section.
Optional: {}
binlogFormat stringBinlogFormat is the binary log format. ROW is required for safe
replication and PITR and is the default.
ROWEnum: [ROW STATEMENT MIXED]
Optional: {}
semiSync SemiSyncConfigurationSemiSync configures semi-synchronous replication.Optional: {}
additionalConfigFiles object (keys:string, values:string)AdditionalConfigFiles are extra files dropped into the MySQL configuration
directory, keyed by file name.
Optional: {}

NodeMaintenanceWindow

NodeMaintenanceWindow contains information that the operator will use while upgrading the underlying nodes.

Appears in:

FieldDescriptionDefaultValidation
reusePVC booleanReusePVC, when true, reuses the existing PVC during a node maintenance
(instead of provisioning a fresh one).
trueOptional: {}
inProgress booleanInProgress signals that a node maintenance is in progress.falseOptional: {}

ObjectMetaTemplate

ObjectMetaTemplate carries the user-configurable metadata fields.

Appears in:

FieldDescriptionDefaultValidation
labels object (keys:string, values:string)Labels added to the Service.Optional: {}
annotations object (keys:string, values:string)Annotations added to the Service.Optional: {}

PrimaryUpdateMethod

Underlying type: string

PrimaryUpdateMethod contains the method to use when upgrading the primary server of the cluster as part of rolling updates. +kubebuilder:validation:Enum=switchover;restart

Validation:

  • Enum: [switchover restart]

Appears in:

FieldDescription
switchoverPrimaryUpdateMethodSwitchover means the operator promotes a replica before
updating the former primary.
restartPrimaryUpdateMethodRestart means the operator restarts the primary in
place.

PrimaryUpdateStrategy

Underlying type: string

PrimaryUpdateStrategy contains the strategy to follow when upgrading the primary server of the cluster as part of rolling updates. +kubebuilder:validation:Enum=unsupervised;supervised

Validation:

  • Enum: [unsupervised supervised]

Appears in:

FieldDescription
unsupervisedPrimaryUpdateStrategyUnsupervised means that the operator performs the
switchover/restart of the primary automatically.
supervisedPrimaryUpdateStrategySupervised means that the operator waits for the user
to manually trigger the primary update.

RecoveryTarget

RecoveryTarget allows to specify a point in time to recover to.

Appears in:

FieldDescriptionDefaultValidation
targetTime stringTargetTime is an RFC3339 timestamp to recover to.Optional: {}
targetGTID stringTargetGTID is the GTID set to recover up to.Optional: {}
targetImmediate booleanTargetImmediate stops recovery as soon as a consistent state is reached.Optional: {}

ReplicaClusterConfiguration

ReplicaClusterConfiguration turns the cluster into a replica that follows an external source.

Appears in:

FieldDescriptionDefaultValidation
enabled booleanEnabled controls whether the cluster runs in replica mode.trueOptional: {}
source stringSource is the name of the entry in ExternalClusters to replicate from.Required: {}

RoleConfiguration

RoleConfiguration describes a MySQL user managed declaratively against the primary instance.

Appears in:

FieldDescriptionDefaultValidation
name stringName is the MySQL user name.MaxLength: 32
Required: {}
host stringHost is the MySQL host part. Defaults to "%".%Optional: {}
ensure EnsureOptionEnsure controls whether the user should exist or be absent.presentEnum: [present absent]
Optional: {}
passwordSecret SecretKeySelectorPasswordSecret references a Secret key holding the user's password. When
unset, the operator generates a password and stores it in a Secret named
<cluster>-<name> with key "password".
Optional: {}
superuser booleanSuperuser grants ALL PRIVILEGES on . WITH GRANT OPTION.falseOptional: {}
maxUserConnections integerMaxUserConnections resource limit. 0 = no limit.Minimum: 0
Optional: {}
maxQueriesPerHour integerMaxQueriesPerHour resource limit. 0 = no limit.Minimum: 0
Optional: {}
maxUpdatesPerHour integerMaxUpdatesPerHour resource limit. 0 = no limit.Minimum: 0
Optional: {}
maxConnectionsPerHour integerMaxConnectionsPerHour resource limit. 0 = no limit.Minimum: 0
Optional: {}
requireTLS stringRequireTLS sets the connection TLS requirement: x509, ssl, or none.noneEnum: [x509 ssl none]
Optional: {}
privileges RolePrivilege arrayPrivileges are grants (global or per-database). Mutually exclusive with
Superuser.
Optional: {}

RolePasswordState

RolePasswordState records the password Secret version last applied for a role.

Appears in:

FieldDescriptionDefaultValidation
secretResourceVersion stringSecretResourceVersion is the resourceVersion of the password Secret last
applied.
Optional: {}
lastApplied TimeLastApplied is when the password was last applied.Optional: {}

RolePrivilege

RolePrivilege is a grant of one or more privileges on a target.

Appears in:

FieldDescriptionDefaultValidation
privileges string arrayPrivileges is the grant list (SELECT, INSERT, ALL, etc.).MinItems: 1
on stringOn is the target (e.g. ".", "mydb."). Defaults to ".*".Optional: {}

S3Credentials

S3Credentials holds the references to the secrets containing the credentials used to access an S3-compatible object store.

Appears in:

FieldDescriptionDefaultValidation
accessKeyId SecretKeySelectorThe reference to the secret key containing the access key id.Optional: {}
secretAccessKey SecretKeySelectorThe reference to the secret key containing the secret access key.Optional: {}
sessionToken SecretKeySelectorThe reference to the secret key containing the session token, used for
temporary credentials.
Optional: {}
inheritFromIAMRole booleanInheritFromIAMRole, when true, makes the credentials be retrieved from the
pod's environment (IRSA / instance profile) instead of from a secret.
falseOptional: {}

S3ObjectStore

S3ObjectStore describes an S3-compatible object store, designed to be compatible with as many providers as possible (AWS S3, MinIO, Ceph RGW, Wasabi, Backblaze B2, etc.).

Appears in:

FieldDescriptionDefaultValidation
endpoint stringEndpoint is the URL of the S3-compatible service. Leave empty to target
AWS S3 with the region's default endpoint.
Optional: {}
region stringRegion is the bucket region. Required by most providers; for AWS it
selects the regional endpoint.
Optional: {}
bucket stringBucket is the destination bucket name.Required: {}
path stringPath is the key prefix (folder) inside the bucket under which backups are
stored.
Optional: {}
forcePathStyle booleanForcePathStyle uses path-style addressing (endpoint/bucket/key) instead of
virtual-hosted style (bucket.endpoint/key). Required by MinIO, Ceph and
most non-AWS providers; defaults to true for maximum compatibility.
trueOptional: {}
signatureVersion S3SignatureVersionSignatureVersion selects the request signing scheme. Defaults to s3v4;
set to s3v2 for legacy providers.
s3v4Enum: [s3v4 s3v2]
Optional: {}
serverSideEncryption stringServerSideEncryption sets the SSE algorithm (e.g. "AES256" or "aws:kms").Optional: {}
storageClass stringStorageClass sets the object storage class (e.g. "STANDARD_IA").Optional: {}
credentials S3CredentialsCredentials to access the object store.Required: {}
tls S3TLSConfigTLS configuration for the endpoint connection.Optional: {}

S3SignatureVersion

Underlying type: string

S3SignatureVersion is the AWS Signature version used to sign object-store requests. +kubebuilder:validation:Enum=s3v4;s3v2

Validation:

  • Enum: [s3v4 s3v2]

Appears in:

FieldDescription
s3v4SignatureVersionV4 is the default AWS Signature V4.
s3v2SignatureVersionV2 is the legacy AWS Signature V2, kept for older
S3-compatible providers.

S3TLSConfig

S3TLSConfig configures TLS verification against the object-store endpoint.

Appears in:

FieldDescriptionDefaultValidation
insecureSkipVerify booleanInsecureSkipVerify disables TLS certificate verification against the
endpoint. Use only for testing.
falseOptional: {}
caBundleSecret SecretKeySelectorCABundleSecret references a secret key holding a PEM CA bundle used to
verify the endpoint certificate (for private CAs / self-signed endpoints).
Optional: {}

ScheduledBackup

ScheduledBackup is a namespaced cron scheduler that creates Backup objects. Short name: myscheduledbackup

Example:

apiVersion: mysql.cnmsql.co/v1alpha1
kind: ScheduledBackup
metadata:
name: cluster-sample-daily
spec:
schedule: "0 0 2 * * *"
cluster:
name: cluster-sample
immediate: true
backupOwnerReference: self
method: xtrabackup
target: prefer-standby
online: true

schedule uses six-field cron format: second minute hour day-of-month month day-of-week.

Generated Backups are labelled with mysql.cnmsql.co/scheduled-backup=<name> and immediate Backups also carry mysql.cnmsql.co/immediate-backup=true.

ScheduledBackup is the Schema for the scheduledbackups API.

Appears in:

FieldDescriptionDefaultValidation
apiVersion stringmysql.cnmsql.co/v1alpha1
kind stringScheduledBackup
kind stringKind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
Optional: {}
apiVersion stringAPIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
Optional: {}
metadata ObjectMetaRefer to Kubernetes API documentation for fields of metadata.Optional: {}
spec ScheduledBackupSpecspec defines the desired state of ScheduledBackupRequired: {}
status ScheduledBackupStatusstatus defines the observed state of ScheduledBackupOptional: {}

ScheduledBackupList

ScheduledBackupList contains a list of ScheduledBackup.

FieldDescriptionDefaultValidation
apiVersion stringmysql.cnmsql.co/v1alpha1
kind stringScheduledBackupList
kind stringKind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
Optional: {}
apiVersion stringAPIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
Optional: {}
metadata ListMetaRefer to Kubernetes API documentation for fields of metadata.
items ScheduledBackup array

ScheduledBackupSpec

ScheduledBackupSpec defines the desired state of ScheduledBackup.

Appears in:

FieldDescriptionDefaultValidation
schedule stringSchedule is a cron expression (6 fields, including seconds) defining when
backups are taken.
Required: {}
cluster LocalObjectReferenceCluster references the cluster to back up.Required: {}
suspend booleanSuspend, when true, pauses the schedule.falseOptional: {}
immediate booleanImmediate, when true, takes a backup as soon as the ScheduledBackup is
created, in addition to the schedule.
falseOptional: {}
backupOwnerReference stringBackupOwnerReference controls the owner reference set on the generated
Backup objects.
selfEnum: [none self cluster]
Optional: {}
method BackupMethodMethod is the backup method used for the generated backups.xtrabackupEnum: [xtrabackup volumeSnapshot]
Optional: {}
target BackupTargetTarget instance to take the generated backups from.prefer-standbyEnum: [primary prefer-standby]
Optional: {}
online booleanOnline, when true, performs non-blocking (hot) backups.trueOptional: {}

ScheduledBackupStatus

ScheduledBackupStatus defines the observed state of ScheduledBackup.

Appears in:

FieldDescriptionDefaultValidation
lastCheckTime TimeLastCheckTime is the last time the schedule was evaluated.Optional: {}
lastScheduleTime TimeLastScheduleTime is the last time a backup was triggered.Optional: {}
nextScheduleTime TimeNextScheduleTime is the next time a backup will be triggered.Optional: {}

SecretKeySelector

SecretKeySelector selects a key from a Secret in the same namespace.

Appears in:

FieldDescriptionDefaultValidation
name stringName of the SecretRequired: {}
key stringKey within the Secret to selectRequired: {}

SemiSyncConfiguration

SemiSyncConfiguration configures semi-synchronous replication.

Appears in:

FieldDescriptionDefaultValidation
enabled booleanEnabled turns on semi-synchronous replication.falseOptional: {}
timeoutMillis integerTimeout in milliseconds the primary waits for a replica acknowledgement
before falling back to asynchronous replication.
Minimum: 0
Optional: {}
dataDurability stringDataDurability controls how strictly minSyncReplicas is enforced when
replicas are unhealthy. "preferred" (the default) keeps the primary
writable by self-healing the acknowledgement count down to the number of
healthy replicas; "required" leaves it fixed so writes block until enough
replicas acknowledge.
preferredEnum: [preferred required]
Optional: {}

ServiceAccountTemplate

ServiceAccountTemplate contains the template needed to generate the service accounts.

Appears in:

FieldDescriptionDefaultValidation
metadata MetadataRefer to Kubernetes API documentation for fields of metadata.Optional: {}

ServiceSelectorType

Underlying type: string

ServiceSelectorType is the type of a default service. +kubebuilder:validation:Enum=rw;ro;r

Validation:

  • Enum: [rw ro r]

Appears in:

FieldDescription
rwServiceSelectorTypeRW selects the read-write (primary) service.
roServiceSelectorTypeRO selects the read-only (replicas) service.
rServiceSelectorTypeR selects the read (any instance) service.

ServiceTemplateServiceSpec

ServiceTemplateServiceSpec exposes the subset of corev1.ServiceSpec fields that users are allowed to customise. The operator retains control over the selector, ports, clusterIP, and owner reference.

Appears in:

FieldDescriptionDefaultValidation
type ServiceTypeType determines how the Service is exposed. Defaults to ClusterIP.Enum: [ClusterIP NodePort LoadBalancer ExternalName]
Optional: {}
externalTrafficPolicy ServiceExternalTrafficPolicyExternalTrafficPolicy describes how nodes distribute service traffic.Optional: {}
sessionAffinity ServiceAffinitySessionAffinity configures session affinity.Optional: {}
loadBalancerSourceRanges string arrayLoadBalancerSourceRanges restricts load balancer access.Optional: {}
externalName stringExternalName is the external reference for ExternalName services.Optional: {}
healthCheckNodePort integerHealthCheckNodePort specifies the health check node port.Optional: {}

ServiceTemplateSpec

ServiceTemplateSpec describes the user-customisable parts of a managed Service.

Appears in:

FieldDescriptionDefaultValidation
metadata ObjectMetaTemplateRefer to Kubernetes API documentation for fields of metadata.Optional: {}
spec ServiceTemplateServiceSpecSpecification of the desired behavior of the Service. The selector field
is operator-managed and cannot be overridden.
Optional: {}

ServiceUpdateStrategy

Underlying type: string

ServiceUpdateStrategy describes how the service template is reconciled. +kubebuilder:validation:Enum=patch;replace

Validation:

  • Enum: [patch replace]

Appears in:

FieldDescription
patchServiceUpdateStrategyPatch merges user fields onto operator defaults.
replaceServiceUpdateStrategyReplace replaces operator defaults with the user template.

StorageConfiguration

StorageConfiguration is the configuration used to create and reconcile PVCs, usable for the instance data directory or for separate binlog storage.

Appears in:

FieldDescriptionDefaultValidation
storageClass stringStorageClass to use for PVCs. Applied after evaluating the PVC template,
if available. If not specified, the generated PVCs will use the default
storage class.
Optional: {}
size stringSize of the storage. Required if not already specified in the PVC template.
Changes to this field are automatically reapplied to the created PVCs.
Size cannot be decreased.
Optional: {}
resizeInUseVolumes booleanResize existing PVCs, defaults to truetrueOptional: {}
pvcTemplate PersistentVolumeClaimSpecTemplate to be used to generate the Persistent Volume ClaimOptional: {}

Shared Types

S3ObjectStore

S3ObjectStore appears in Cluster.spec.backup.objectStore, Backup.spec.objectStore, and Cluster.spec.externalClusters[].objectStore. All fields are documented in the generated table above under S3ObjectStore.

Common Conditions

CNMSQL - CloudNative for MySQL resources use Kubernetes metav1.Condition entries. Common condition types:

ConditionMeaning
ReadyResource is fully functional.
ProgressingResource is being created, updated, backed up, restored, or changed.
DegradedResource failed to reach or maintain the desired state.