Cennso Database User
A Cennso Database User is represented by the DBUser Custom Resource (CR). Applying this CR to a Management Cluster creates a Kubernetes Job that provisions a MySQL user account on an existing Cennso Database Instance and applies the requested GRANT statements.
Important
Before provisioning a user account, 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 DBUser CR. For more information on how to provision a new user account with privileges, see the Create a database user document.
Kubernetes cluster secret reference
To deploy the Cennso Database User, 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 user account 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 user account 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 user-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.
User identity
To define the MySQL user account that should be created, use the following configuration parameters:
The spec.username must be a valid MySQL identifier (alphanumeric characters and underscore, up to 32 characters).
The spec.host configures the host part of the MySQL account identity. Typical values are %, localhost, or a CIDR-style pattern such as 10.0.0.%. The default value is %.
The spec.authPlugin configures the MySQL authentication pluginOpens in a new tab used when creating the account. The supported values are:
mysql_native_passwordcaching_sha2_password
The default value is mysql_native_password.
Password secret reference
Important
The Kubernetes secret with the user's password must be provisioned before you apply the DBUser Crossplane claim on your Management Cluster.
The password for the new MySQL user account is read from a Kubernetes Secret on the Core Cluster, in the same Kubernetes Namespace as the provisioning Job. You can configure it using the following parameters:
The spec.passwordSecretRef.name is the name of the Kubernetes Secret that holds the user password. The spec.passwordSecretRef.key is the key within the Secret whose value is used as the password. The default value of spec.passwordSecretRef.key is password.
Grants
To configure the privileges of the new MySQL user account, you can use the spec.grants configuration option. Each item in the list produces a GRANTOpens in a new tab statement that applies the listed privileges to the specified object:
The spec.grants[].privileges is the list of MySQL privileges to grant, such as ALL PRIVILEGES, SELECT, or REPLICATION CLIENT. The spec.grants[].target is the MySQL object specification for the GRANT, such as mydb.* or *.*. For the full list of supported privileges, see the MySQL privileges documentationOpens in a new tab.
If spec.grants is empty or omitted, the user account is created without any additional privileges.
Job retries, lifetime, and deadline
To control how the user-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 user-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.