Cennso Database Schema
A Cennso Database Schema is represented by the DBSchema Custom Resource (CR). Applying this CR to a Management Cluster creates a Kubernetes Job that provisions a logical MySQL database inside an existing Cennso Database Instance.
Important
Before provisioning a logical database, the target DBInstance must be deployed, and its HAProxy Kubernetes Service must be reachable from the provisioning Job. The Job connects to the MySQL cluster through that Service and authenticates with the root credentials stored in the ps-db-<dbInstanceName>-secrets Kubernetes Secret.
The sections below provide information about configuration parameters that you can specify in the DBSchema CR. For more information on how to provision a logical database, see the Create a database document.
Kubernetes cluster secret reference
To deploy the Cennso Database Schema, you must specify a reference to the Kubernetes secretOpens in a new tab so the Core Cluster is accessible. You can do this using the following configuration parameters:
Set spec.connectionSecretRef.name to the name of the Core Cluster that contains the MySQL cluster where the database should be created. The spec.connectionSecretRef.namespace configuration parameter defines the Kubernetes Namespace on the Management Cluster where the Kubernetes secret to access this Core Cluster is stored.
Target Database Instance reference
To select the MySQL cluster where the logical database is created, you must specify the DBInstance name and the Kubernetes Namespace on the Core Cluster where it is deployed:
The spec.dbInstanceName must match the metadata.name of an existing DBInstance claim. The schema-provisioning Job connects to the ps-db-<dbInstanceName>-haproxy.<namespace>.svc:3306 Kubernetes Service and uses the credentials from the ps-db-<dbInstanceName>-secrets Kubernetes Secret.
Database name, character set, and collation
Important
The spec.collate value must be compatible with the chosen spec.characterSet. Incompatible combinations are rejected by MySQL at apply time.
To define the logical database that should be created, use the following configuration parameters:
The spec.databaseName must be a valid MySQL identifier (alphanumeric characters and underscore, up to 64 characters).
The spec.characterSet configures the default character set for the logical database. The supported values are:
utf8mb4utf8mb3latin1asciibinary
The default character set is utf8mb4.
The spec.collate configures the default collation for the logical database. The supported values are:
utf8mb4_0900_ai_ciutf8mb4_unicode_ciutf8mb4_general_ciutf8mb4_bin
The default value is utf8mb4_0900_ai_ci.
For more information about the character sets and collations, see the official MySQL documentationOpens in a new tab.
Job retries, lifetime, and deadline
To control how the schema-provisioning Kubernetes JobOpens in a new tab behaves on failure and after completion, use the following configuration parameters:
The spec.backoffLimit configures the number of retries before the Job is marked as failed. For more information, see the pod backoff failure policyOpens in a new tab documentation.
The spec.ttlSecondsAfterFinished configures how long a finished Job (either Complete or Failed) is retained before it is automatically cleaned up. If omitted, the Job is not deleted automatically. For more information, see the TTL mechanism for finished JobsOpens in a new tab documentation.
The spec.activeDeadlineSeconds configures a wall-clock deadline, measured from the Job start time, after which the Job is terminated and marked as failed. The default value is 600 seconds.
The spec.restartPolicy configures the restart policy of the Job Pod. The supported values are OnFailure and Never. The default value is OnFailure. For more information, see the pod lifecycleOpens in a new tab documentation.
Image and pull secret
You can configure the image of the schema-provisioning Job and the Kubernetes Secret used to pull it with the following configuration options:
The spec.imagePullSecretRef.name refers to a Kubernetes Secret that must exist on the Core Cluster in the same Kubernetes Namespace as the Job.