This resource is namespace scoped, refer to [Namespace](./namespace.md) for details.

Note: similar to [Network](./network.md), cluster deletion will wait for all dependents to be deleted first.

Example:

```bash
# delete cluster and all dependents
> kubectl delete cluster 123
> kubectl delete import import-123
```

Bad example:

```bash
# only delete the Cluster, the deletion will be pended
> kubectl delete cluster 123
```

You may use `OwnerReference` to instruct Infra API to delete the dependents automatically when deleting a Cluster.

Note: [Backup](./backup.md) outlives the cluster, thus they have independent lifecycle. This is a design problem since a Backup represents both a backup job and a backup asset, and backup assets must outlive the cluster.

Note: to ease usage, `Restore` will be automatically adopted by the target cluster and delete the target cluster will cascading delete the `Restore` job.

### Custom Resources

* [Cluster](#cluster)

### Sub Resources

* [AWSPrivateLinkService](#awsprivatelinkservice)
* [AWSPrivateLinkServiceConnection](#awsprivatelinkserviceconnection)
* [AWSPrivateLinkServiceStatus](#awsprivatelinkservicestatus)
* [Audit](#audit)
* [ClusterCondition](#clustercondition)
* [ClusterList](#clusterlist)
* [ClusterSpec](#clusterspec)
* [ClusterStatus](#clusterstatus)
* [ClusterTopology](#clustertopology)
* [DBStatus](#dbstatus)
* [DNS](#dns)
* [MachineSpec](#machinespec)
* [MetricsStatus](#metricsstatus)
* [NodegroupSpec](#nodegroupspec)
* [ObjectStoreStatus](#objectstorestatus)
* [PD](#pd)
* [PDMember](#pdmember)
* [PDStatus](#pdstatus)
* [Path](#path)
* [PrecheckAuditStatus](#precheckauditstatus)
* [PrivateLinkService](#privatelinkservice)
* [PrivateLinkServiceStatus](#privatelinkservicestatus)
* [ProxyStatus](#proxystatus)
* [Reference](#reference)
* [ResourceSpec](#resourcespec)
* [Resources](#resources)
* [Service](#service)
* [SqlEndpointStatus](#sqlendpointstatus)
* [SqlEndpoints](#sqlendpoints)
* [SqlEndpointsStatus](#sqlendpointsstatus)
* [StoreMember](#storemember)
* [SuspendAction](#suspendaction)
* [TiDB](#tidb)
* [TiDBMember](#tidbmember)
* [TiDBSecurity](#tidbsecurity)
* [TiDBStatus](#tidbstatus)
* [TiFlash](#tiflash)
* [TiFlashStatus](#tiflashstatus)
* [TiKV](#tikv)
* [TiKVStatus](#tikvstatus)
* [VolumeStatus](#volumestatus)

#### AWSPrivateLinkService



| Field | Description | Scheme | Required |
| ----- | ----------- | ------ | -------- |
| acceptedEndpoints | AcceptedEndpoints represents the allowed VPC endpoint IDs. It has to full match with the connections list in status. | []string | true |

[Back to Custom Resources](#custom-resources)

#### AWSPrivateLinkServiceConnection



| Field | Description | Scheme | Required |
| ----- | ----------- | ------ | -------- |
| endpoint | Endpoint represents the VPC endpoint ID | string | true |
| phase | PrivateLinkServiceConnectionPhase represents the phase of the connection | PrivateLinkServiceConnectionPhase | true |
| message | Message contains the error message if in 'Failed' phase. | string | true |

[Back to Custom Resources](#custom-resources)

#### AWSPrivateLinkServiceStatus



| Field | Description | Scheme | Required |
| ----- | ----------- | ------ | -------- |
| nlb | NLB is the network LoadBalance used by the AWS endpoint service | string | true |
| serviceID | ServiceID is the ID of the the AWS endpoint service | string | true |
| serviceName | ServiceName is the name of the AWS ednpoint service | string | true |
| privateDNSName | PrivateDNSName is the private  DNS name of the AWS endpoint service, constructed from DNS identity | string | true |
| port | Port is the port to connect with privatelink service | *int32 | true |
| connections | Connections contains all the connections on the AWS endpoint service | []*[AWSPrivateLinkServiceConnection](#awsprivatelinkserviceconnection) | false |

[Back to Custom Resources](#custom-resources)

#### Audit



| Field | Description | Scheme | Required |
| ----- | ----------- | ------ | -------- |
| enable | When enable this, means tidb need to be able pushing audit log to the specific object storage. DO NOT means the plugin is enable. User can run \"admin plugins enable audit\" or \"admin plugins disable audit\". The plugins is enable default when we start tidb and load the plugin. | bool | false |
| bucketUrl |  | string | false |
| region |  | string | false |
| roleArn |  | string | false |

[Back to Custom Resources](#custom-resources)

#### Cluster

Cluster is the Schema for the clusters API

| Field | Description | Scheme | Required |
| ----- | ----------- | ------ | -------- |
| metadata |  | metav1.ObjectMeta | false |
| spec |  | [ClusterSpec](#clusterspec) | false |
| status |  | [ClusterStatus](#clusterstatus) | false |

[Back to Custom Resources](#custom-resources)

#### ClusterCondition

ClusterCondition contains details for the current condition of this cluster.

| Field | Description | Scheme | Required |
| ----- | ----------- | ------ | -------- |
| type | Type is the type of the condition. | ClusterConditionType | true |
| status | Status is the status of the condition. Can be True, False. | ConditionStatus | true |
| lastProbeTime | Last time we probed the condition. | metav1.Time | false |
| lastTransitionTime | Last time the condition transitioned from one status to another. | metav1.Time | false |
| reason | Unique, one-word, CamelCase reason for the condition's last transition. | string | false |
| message | Human-readable message indicating details about last transition. | string | false |

[Back to Custom Resources](#custom-resources)

#### ClusterList

ClusterList contains a list of Cluster

| Field | Description | Scheme | Required |
| ----- | ----------- | ------ | -------- |
| metadata |  | metav1.ListMeta | false |
| items |  | [][Cluster](#cluster) | true |

[Back to Custom Resources](#custom-resources)

#### ClusterSpec

ClusterSpec defines the desired state of Cluster

| Field | Description | Scheme | Required |
| ----- | ----------- | ------ | -------- |
| networkName | NetworkName references the Network where the Cluster is hosted, the Network must exist in the same namespace as Cluster | string | true |
| sqlEndpoints | SqlEndpoints specifies the mysql endpoints of the cluster | [SqlEndpoints](#sqlendpoints) | true |
| cluster | Cluster specifies the cluster topology | [ClusterTopology](#clustertopology) | true |
| forProvider | ForProvider encodes the provider specific spec | *runtime.RawExtension | false |
| configRevisionRef | ConfigRevisionRef specifies the ConfigRevision related to current cluster. | *[Reference](#reference) | false |

[Back to Custom Resources](#custom-resources)

#### ClusterStatus

ClusterStatus defines the observed state of Cluster

| Field | Description | Scheme | Required |
| ----- | ----------- | ------ | -------- |
| phase | Phase is lifecycle phase of the Cluster | ClusterPhase | true |
| reason | Reason explains why the cluster is in current phase to human, reason is not supposed to be parsed by program, Phase should be used instead. | string | false |
| db | DB represents the status of the TiDB cluster | *[DBStatus](#dbstatus) | false |
| sqlEndpoints | SQLEndpoints represents the status of the SQL endpoints | [SqlEndpointsStatus](#sqlendpointsstatus) | false |
| objectStore | ObjectStore represents the status of the object store for the TiDB cluster | *[ObjectStoreStatus](#objectstorestatus) | false |
| metrics | Metrics represents the status of the monitoring service for the TiDB cluster | *[MetricsStatus](#metricsstatus) | false |
| proxy | Proxy represents the status of the proxy service for the TiDB cluster. | *[ProxyStatus](#proxystatus) | false |
| lastActiveTimestamp | LastActiveTimestamp is the last active time of the cluster in RFC3339 format. | *metav1.Time | false |
| lastDetectTimestamp | LastDetectTimestamp is the last time we try to detect the cluster and update LastActiveTimestamp. | *metav1.Time | false |
| conditions | Current service state of cluster. | [][ClusterCondition](#clustercondition) | false |
| fromProvider | FromProvider encodes the provider specific status of the Cluster, e.g. AWS IAM role of the cluster | runtime.RawExtension | false |

[Back to Custom Resources](#custom-resources)

#### ClusterTopology



| Field | Description | Scheme | Required |
| ----- | ----------- | ------ | -------- |
| tidb |  | [TiDB](#tidb) | true |
| pd |  | [PD](#pd) | true |
| tikv |  | [TiKV](#tikv) | true |
| tiflash |  | [TiFlash](#tiflash) | true |
| suspendAction | SuspendAction defines the suspend actions for a cluster | *[SuspendAction](#suspendaction) | false |

[Back to Custom Resources](#custom-resources)

#### DBStatus



| Field | Description | Scheme | Required |
| ----- | ----------- | ------ | -------- |
| secondaryStatus | SecondaryStatus represents if there is a partial failure of db cluster | DBSecondaryStatus | true |
| version | Version is the current version of db cluster | string | true |
| tikv | TiKV is the current TiKV status of db cluster | *[TiKVStatus](#tikvstatus) | false |
| tidb | TiDB is the current TiDB status of db cluster | *[TiDBStatus](#tidbstatus) | false |
| pd | PD is the current PD status of db cluster | *[PDStatus](#pdstatus) | false |
| tiflash | TiFlash is the current TiFlash status of db cluster | *[TiFlashStatus](#tiflashstatus) | false |

[Back to Custom Resources](#custom-resources)

#### DNS



| Field | Description | Scheme | Required |
| ----- | ----------- | ------ | -------- |
| identity | Identity defines dns identity of tidb cluster Normally there are these dns record will be genereated 1. Public: tidb.$identity.$domain 2. Private: private-tidb.$identity.$domain 3. PrivateLink: privatelink-tidb.$identity.$domain Default is a random(11) string This field is readonly and can't be changed if it is set See https://docs.google.com/document/d/15h84VUsgWSJoH21bVRN4qVXUHrt9Dh_4vGNYy-L5juY for more help | string | false |

[Back to Custom Resources](#custom-resources)

#### MachineSpec



| Field | Description | Scheme | Required |
| ----- | ----------- | ------ | -------- |
| machineType |  | string | false |
| machineArch |  | string | false |
| machineImage | MachineImage and MachineImageVersion are deprecated they are only for gardener provider and can be inferred from MachineArch | string | false |
| machineImageVersion |  | string | false |
| systemVolumeType |  | string | false |
| systemVolumeSize |  | string | false |

[Back to Custom Resources](#custom-resources)

#### MetricsStatus



| Field | Description | Scheme | Required |
| ----- | ----------- | ------ | -------- |
| baseUrl |  | string | true |
| credentialConfig |  | string | true |

[Back to Custom Resources](#custom-resources)

#### NodegroupSpec



| Field | Description | Scheme | Required |
| ----- | ----------- | ------ | -------- |
| name |  | string | false |
| labels |  | map[string]string | false |
| componentType |  | ComponentType | false |
| annotations |  | map[string]string | false |
| machineSpec |  | *[MachineSpec](#machinespec) | false |
| taints |  | []corev1.Taint | false |
| maximum | Maximum is the maximum number of VMs to create. | int32 | false |
| minimum | Minimum is the minimum number of VMs to create. | int32 | false |
| zones | Zones is a list of availability zones that are used to evenly distribute this nodegroup. | []string | false |

[Back to Custom Resources](#custom-resources)

#### ObjectStoreStatus



| Field | Description | Scheme | Required |
| ----- | ----------- | ------ | -------- |
| s3 |  | *[Path](#path) | false |
| gcs |  | *[Path](#path) | false |

[Back to Custom Resources](#custom-resources)

#### PD



| Field | Description | Scheme | Required |
| ----- | ----------- | ------ | -------- |
| replicas |  | int | true |
| instanceType | InstanceType is specified the profile of every PD node, the InstanceType must be declared in the Provider spec | string | true |
| storageClassName |  | string | false |
| storageSize |  | resource.Quantity | false |
| suspendAction | SuspendAction defines the suspend actions for the component and overrides the value in `ClusterTopology` | *[SuspendAction](#suspendaction) | false |

[Back to Custom Resources](#custom-resources)

#### PDMember



| Field | Description | Scheme | Required |
| ----- | ----------- | ------ | -------- |
| name |  | string | true |
| labels |  | map[string]string | false |
| resources |  | [Resources](#resources) | true |
| status |  | MemberStatus | true |
| instanceType | InstanceType is the current instance type of the member, this may be empty for some providers | string | false |

[Back to Custom Resources](#custom-resources)

#### PDStatus



| Field | Description | Scheme | Required |
| ----- | ----------- | ------ | -------- |
| status |  | ComponentStatus | true |
| members |  | [][PDMember](#pdmember) | false |
| volume |  | *[VolumeStatus](#volumestatus) | false |
| updatedReplicas | UpdatedReplicas is the `UpdatedReplicas` of the PD StatefulSet | int32 | true |
| instanceTypeScalePhase |  | InstanceTypeScalePhase | false |
| conditions |  | []metav1.Condition | false |

[Back to Custom Resources](#custom-resources)

#### Path



| Field | Description | Scheme | Required |
| ----- | ----------- | ------ | -------- |
| path |  | string | true |

[Back to Custom Resources](#custom-resources)

#### PrecheckAuditStatus



| Field | Description | Scheme | Required |
| ----- | ----------- | ------ | -------- |
| pass | Pass the precheck or not. | bool | true |
| message | Human-readable message indicating details | string | false |

[Back to Custom Resources](#custom-resources)

#### PrivateLinkService



| Field | Description | Scheme | Required |
| ----- | ----------- | ------ | -------- |
| aws | PrivateLink service for AWS | *[AWSPrivateLinkService](#awsprivatelinkservice) | false |

[Back to Custom Resources](#custom-resources)

#### PrivateLinkServiceStatus



| Field | Description | Scheme | Required |
| ----- | ----------- | ------ | -------- |
| phase |  | PrivateLinkServicePhase | true |
| message |  | string | false |
| aws |  | *[AWSPrivateLinkServiceStatus](#awsprivatelinkservicestatus) | false |
| creationTimestamp | CreationTimestamp is a timestamp representing the server time when this object was created. It is represented in RFC3339 form and is in UTC. | metav1.Time | false |

[Back to Custom Resources](#custom-resources)

#### ProxyStatus



| Field | Description | Scheme | Required |
| ----- | ----------- | ------ | -------- |
| endpoint |  | string | true |
| credentialConfig |  | string | true |

[Back to Custom Resources](#custom-resources)

#### Reference

Reference to a cluster-scoped object.

| Field | Description | Scheme | Required |
| ----- | ----------- | ------ | -------- |
| name |  | string | true |

[Back to Custom Resources](#custom-resources)

#### ResourceSpec



| Field | Description | Scheme | Required |
| ----- | ----------- | ------ | -------- |
| resources |  | corev1.ResourceRequirements | false |
| storageClass |  | string | false |

[Back to Custom Resources](#custom-resources)

#### Resources



| Field | Description | Scheme | Required |
| ----- | ----------- | ------ | -------- |
| cpu |  | resource.Quantity | true |
| memory |  | resource.Quantity | true |
| storage |  | *resource.Quantity | false |

[Back to Custom Resources](#custom-resources)

#### Service



| Field | Description | Scheme | Required |
| ----- | ----------- | ------ | -------- |
| enabled |  | *bool | true |
| loadBalancerSourceRanges | LoadBalancerSourceRanges the IP whitelists of the service | []string | false |
| port | Port that will be exposed by this service. | *int32 | false |

[Back to Custom Resources](#custom-resources)

#### SqlEndpointStatus



| Field | Description | Scheme | Required |
| ----- | ----------- | ------ | -------- |
| host |  | string | true |
| port |  | int | true |
| token |  | string | false |

[Back to Custom Resources](#custom-resources)

#### SqlEndpoints



| Field | Description | Scheme | Required |
| ----- | ----------- | ------ | -------- |
| dns | DNS defines dns settings about tidb cluster | [DNS](#dns) | false |
| public | Public specifies the internet facing endpoint of the cluster | [Service](#service) | true |
| private | Private specifies the intranet facing endpoint of the cluster | *[Service](#service) | false |
| privateLinkService | PrivateLinkService specifies the private intranet facing enpoint of the cluster supported by AWS PrivateLink or GCP Private Service Connect | *[PrivateLinkService](#privatelinkservice) | false |

[Back to Custom Resources](#custom-resources)

#### SqlEndpointsStatus



| Field | Description | Scheme | Required |
| ----- | ----------- | ------ | -------- |
| publicEndpoint |  | *[SqlEndpointStatus](#sqlendpointstatus) | true |
| privateEndpoint |  | *[SqlEndpointStatus](#sqlendpointstatus) | true |
| privateLinkService |  | *[PrivateLinkServiceStatus](#privatelinkservicestatus) | false |

[Back to Custom Resources](#custom-resources)

#### StoreMember



| Field | Description | Scheme | Required |
| ----- | ----------- | ------ | -------- |
| name |  | string | true |
| labels |  | map[string]string | false |
| resources |  | [Resources](#resources) | true |
| status |  | MemberStatus | true |
| instanceType | InstanceType is the current instance type of the member, this may be empty for some providers | string | false |

[Back to Custom Resources](#custom-resources)

#### SuspendAction

SuspendAction defines the suspend actions for a cluster. For example, suspend the compute resources, or suspend the storages

| Field | Description | Scheme | Required |
| ----- | ----------- | ------ | -------- |
| suspendCompute |  | bool | false |

[Back to Custom Resources](#custom-resources)

#### TiDB



| Field | Description | Scheme | Required |
| ----- | ----------- | ------ | -------- |
| replicas |  | int | true |
| instanceType | InstanceType is specified the profile of every TiDB node, the InstanceType must be declared in the Provider spec | string | true |
| audit |  | *[Audit](#audit) | false |
| precheckAudit | Set only if you want to check the permission is granted to tidb cloud right. | *[Audit](#audit) | false |
| security | Set only if you want to overwrite the default TiDB security configurations. | *[TiDBSecurity](#tidbsecurity) | false |
| suspendAction | SuspendAction defines the suspend actions for the component and overrides the value in `ClusterTopology` | *[SuspendAction](#suspendaction) | false |

[Back to Custom Resources](#custom-resources)

#### TiDBMember



| Field | Description | Scheme | Required |
| ----- | ----------- | ------ | -------- |
| name |  | string | true |
| labels |  | map[string]string | false |
| resources |  | [Resources](#resources) | true |
| status |  | MemberStatus | true |
| instanceType | InstanceType is the current instance type of the member, this may be empty for some providers | string | false |

[Back to Custom Resources](#custom-resources)

#### TiDBSecurity

TiDBSecurity stores the TiDB cluster's security configurations.

| Field | Description | Scheme | Required |
| ----- | ----------- | ------ | -------- |
| sslCASecret | SSLCASecret references a secret containing TiDB server's CA cert. | *corev1.SecretReference | false |

[Back to Custom Resources](#custom-resources)

#### TiDBStatus



| Field | Description | Scheme | Required |
| ----- | ----------- | ------ | -------- |
| status |  | ComponentStatus | true |
| members |  | [][TiDBMember](#tidbmember) | false |
| precheckAudit |  | *[PrecheckAuditStatus](#precheckauditstatus) | false |
| auditReady | AuditReady is set to true, when tidb is ready to work as spec set in 'cluster.tidb.audit' result will be set in TiDBStatus. | bool | false |
| updatedReplicas | UpdatedReplicas is the `UpdatedReplicas` of the TiDB StatefulSet | int32 | true |
| instanceTypeScalePhase |  | InstanceTypeScalePhase | false |
| conditions |  | []metav1.Condition | false |

[Back to Custom Resources](#custom-resources)

#### TiFlash



| Field | Description | Scheme | Required |
| ----- | ----------- | ------ | -------- |
| replicas |  | int | true |
| instanceType | InstanceType is specified the profile of every TiFlash node, the InstanceType must be declared in the Provider spec | string | true |
| storageSize |  | resource.Quantity | false |
| storageClassName |  | string | false |
| useLocalStorage | UseLocalStorage specifies whethre the local disk should be used for storage | *bool | false |
| suspendAction | SuspendAction defines the suspend actions for the component and overrides the value in `ClusterTopology` | *[SuspendAction](#suspendaction) | false |

[Back to Custom Resources](#custom-resources)

#### TiFlashStatus



| Field | Description | Scheme | Required |
| ----- | ----------- | ------ | -------- |
| status |  | ComponentStatus | true |
| members |  | [][StoreMember](#storemember) | false |
| volume |  | *[VolumeStatus](#volumestatus) | false |
| updatedReplicas | UpdatedReplicas is the `UpdatedReplicas` of the TiFlash StatefulSet | int32 | true |
| instanceTypeScalePhase |  | InstanceTypeScalePhase | false |
| conditions |  | []metav1.Condition | false |

[Back to Custom Resources](#custom-resources)

#### TiKV



| Field | Description | Scheme | Required |
| ----- | ----------- | ------ | -------- |
| replicas |  | int | true |
| instanceType | InstanceType is specified the profile of every TiKV node, the InstanceType must be declared in the Provider spec | string | true |
| storageSize |  | resource.Quantity | false |
| storageClassName |  | string | false |
| useLocalStorage | UseLocalStorage specifies whether the local disk should be used for storage | *bool | false |
| suspendAction | SuspendAction defines the suspend actions for the component and overrides the value in `ClusterTopology` | *[SuspendAction](#suspendaction) | false |

[Back to Custom Resources](#custom-resources)

#### TiKVStatus



| Field | Description | Scheme | Required |
| ----- | ----------- | ------ | -------- |
| status |  | ComponentStatus | true |
| members |  | [][StoreMember](#storemember) | false |
| volume |  | *[VolumeStatus](#volumestatus) | false |
| updatedReplicas | UpdatedReplicas is the `UpdatedReplicas` of the TiKV StatefulSet | int32 | true |
| instanceTypeScalePhase |  | InstanceTypeScalePhase | false |
| conditions |  | []metav1.Condition | false |

[Back to Custom Resources](#custom-resources)

#### VolumeStatus

VolumeStatus is the actual status for a storage

| Field | Description | Scheme | Required |
| ----- | ----------- | ------ | -------- |
| boundCount | BoundCount is the count of bound volumes. | int | true |
| currentCount | CurrentCount is the count of volumes whose capacity is equal to `currentCapacity`. | int | true |
| modifiedCount | ModifiedCount is the count of modified volumes. | int | true |
| currentCapacity | CurrentCapacity is the current capacity of the volume. If any volume is resizing, it is the capacity before resizing. If all volumes are resized, it is the resized capacity and same as desired capacity. | resource.Quantity | true |
| modifiedCapacity | ModifiedCapacity is the modified capacity of the volume. | resource.Quantity | true |
| currentStorageClass | CurrentStorageClass is the current storage class of the volume. If any volume is modifiying, it is the storage class before modification. If all volumes are modified, it is the modified storage class and same as desired storage class. | string | true |
| modifiedStorageClass | ModifiedStorageClass is the modified storage calss of the volume. | string | true |
| resizedCount | (Deprecated) ResizedCount is the count of volumes whose capacity is equal to `resizedCapacity`. | int | false |
| resizedCapacity | (Deprecated) ResizedCapacity is the desired capacity of the volume. | resource.Quantity | false |

[Back to Custom Resources](#custom-resources)
