{
  "properties": {
    "apiVersion": {
      "type": "string"
    },
    "kind": {
      "type": "string"
    },
    "metadata": {
      "type": "object"
    },
    "spec": {
      "properties": {
        "cluster": {
          "properties": {
            "clusterDomain": {
              "type": "string"
            },
            "name": {
              "type": "string"
            },
            "namespace": {
              "type": "string"
            }
          },
          "required": [
            "name"
          ],
          "type": "object"
        },
        "tidb": {
          "properties": {
            "external": {
              "properties": {
                "endpoint": {
                  "properties": {
                    "host": {
                      "type": "string"
                    },
                    "path": {
                      "type": "string"
                    },
                    "port": {
                      "format": "int32",
                      "type": "integer"
                    },
                    "tlsSecret": {
                      "properties": {
                        "name": {
                          "type": "string"
                        },
                        "namespace": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "name",
                        "namespace"
                      ],
                      "type": "object"
                    }
                  },
                  "required": [
                    "host",
                    "path",
                    "port"
                  ],
                  "type": "object"
                },
                "maxReplicas": {
                  "format": "int32",
                  "type": "integer"
                }
              },
              "required": [
                "maxReplicas"
              ],
              "type": "object"
            },
            "resources": {
              "additionalProperties": {
                "properties": {
                  "count": {
                    "format": "int32",
                    "type": "integer"
                  },
                  "cpu": {
                    "anyOf": [
                      {
                        "type": "integer"
                      },
                      {
                        "type": "string"
                      }
                    ],
                    "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$",
                    "x-kubernetes-int-or-string": true
                  },
                  "memory": {
                    "anyOf": [
                      {
                        "type": "integer"
                      },
                      {
                        "type": "string"
                      }
                    ],
                    "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$",
                    "x-kubernetes-int-or-string": true
                  },
                  "storage": {
                    "anyOf": [
                      {
                        "type": "integer"
                      },
                      {
                        "type": "string"
                      }
                    ],
                    "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$",
                    "x-kubernetes-int-or-string": true
                  }
                },
                "required": [
                  "cpu",
                  "memory"
                ],
                "type": "object"
              },
              "type": "object"
            },
            "rules": {
              "additionalProperties": {
                "properties": {
                  "max_threshold": {
                    "type": "number"
                  },
                  "min_threshold": {
                    "type": "number"
                  },
                  "resource_types": {
                    "items": {
                      "type": "string"
                    },
                    "type": "array"
                  }
                },
                "required": [
                  "max_threshold"
                ],
                "type": "object"
              },
              "type": "object"
            },
            "scaleInIntervalSeconds": {
              "format": "int32",
              "type": "integer"
            },
            "scaleOutIntervalSeconds": {
              "format": "int32",
              "type": "integer"
            }
          },
          "type": "object"
        },
        "tikv": {
          "properties": {
            "external": {
              "properties": {
                "endpoint": {
                  "properties": {
                    "host": {
                      "type": "string"
                    },
                    "path": {
                      "type": "string"
                    },
                    "port": {
                      "format": "int32",
                      "type": "integer"
                    },
                    "tlsSecret": {
                      "properties": {
                        "name": {
                          "type": "string"
                        },
                        "namespace": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "name",
                        "namespace"
                      ],
                      "type": "object"
                    }
                  },
                  "required": [
                    "host",
                    "path",
                    "port"
                  ],
                  "type": "object"
                },
                "maxReplicas": {
                  "format": "int32",
                  "type": "integer"
                }
              },
              "required": [
                "maxReplicas"
              ],
              "type": "object"
            },
            "resources": {
              "additionalProperties": {
                "properties": {
                  "count": {
                    "format": "int32",
                    "type": "integer"
                  },
                  "cpu": {
                    "anyOf": [
                      {
                        "type": "integer"
                      },
                      {
                        "type": "string"
                      }
                    ],
                    "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$",
                    "x-kubernetes-int-or-string": true
                  },
                  "memory": {
                    "anyOf": [
                      {
                        "type": "integer"
                      },
                      {
                        "type": "string"
                      }
                    ],
                    "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$",
                    "x-kubernetes-int-or-string": true
                  },
                  "storage": {
                    "anyOf": [
                      {
                        "type": "integer"
                      },
                      {
                        "type": "string"
                      }
                    ],
                    "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$",
                    "x-kubernetes-int-or-string": true
                  }
                },
                "required": [
                  "cpu",
                  "memory"
                ],
                "type": "object"
              },
              "type": "object"
            },
            "rules": {
              "additionalProperties": {
                "properties": {
                  "max_threshold": {
                    "type": "number"
                  },
                  "min_threshold": {
                    "type": "number"
                  },
                  "resource_types": {
                    "items": {
                      "type": "string"
                    },
                    "type": "array"
                  }
                },
                "required": [
                  "max_threshold"
                ],
                "type": "object"
              },
              "type": "object"
            },
            "scaleInIntervalSeconds": {
              "format": "int32",
              "type": "integer"
            },
            "scaleOutIntervalSeconds": {
              "format": "int32",
              "type": "integer"
            }
          },
          "type": "object"
        }
      },
      "required": [
        "cluster"
      ],
      "type": "object"
    },
    "status": {
      "properties": {
        "tidb": {
          "additionalProperties": {
            "properties": {
              "lastAutoScalingTimestamp": {
                "format": "date-time",
                "type": "string"
              }
            },
            "type": "object"
          },
          "type": "object"
        },
        "tikv": {
          "additionalProperties": {
            "properties": {
              "lastAutoScalingTimestamp": {
                "format": "date-time",
                "type": "string"
              }
            },
            "type": "object"
          },
          "type": "object"
        }
      },
      "type": "object"
    }
  },
  "required": [
    "metadata",
    "spec"
  ],
  "type": "object"
}