weixin_39707851 2020-11-30 10:44 采纳率: 0%
浏览 0

Add schema for TiDB config

Signed-off-by: Aylei

1192

What problem does this PR solve?

Add schema for TiDB config.

What is changed and how does it work?

Consume OpenAPI Schema of TidbCluster:

  • For kube-apiserver 1.15+

    
      curl ${APISERVER_ENDPOINT}/openapi/v2
      
  • Earlier versions:


  import "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1"
  # call v1alpha1.GetOpenAPIDefinition
  

Basic OpenAPI schema validation:


> cat tidb-cluster.yaml
...
    config:
      host: "0.0.0.0"
      port: 9000

> kubectl apply  tidb-cluster.yaml
tidbcluster.pingcap.com/test configured

> cat tidb-cluster.yaml
...
    config:
      host: "0.0.0.0"
      port: "9000"

> kubectl apply -f tidb-cluster.yaml
The TidbCluster "test" is invalid ...... validation failure list:
spec.tidb.config.port in body must be of type integer: "string"

Check List

Tests

  • Unit test

    PTAL

ref:

  • https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/#publish-validation-schema-in-openapi-v2

该提问来源于开源项目:pingcap/tidb-operator

  • 写回答

6条回答 默认 最新

  • weixin_39707851 2020-11-30 10:44
    关注

    /run-e2e-test

    评论

报告相同问题?