pingcap / tidb-operator

TiDB operator creates and manages TiDB clusters running in Kubernetes.
https://docs.pingcap.com/tidb-in-kubernetes/
Apache License 2.0
1.22k stars 489 forks source link

Support custom version strings on images with operator. #5213

Open anish-db opened 1 year ago

anish-db commented 1 year ago

Feature Request

Is your feature request related to a problem? Please describe: We adapt the official pingcap images thru our internal docker image pipeline to produce images with custom version tags that don't follow the tidb version string format of v6.5.3 etc. e.g. our version strings look like tidb_2023-06-27_00.43.39Z_master_123abcde_123456789

Operator makes various assumptions to gate functionality based on wether a component is new enough past some version or not. For this it tries to parse the .spec.version field from the tidb cluster definition and errors out in our case like:

E0729 00:22:23.727017       1 utils.go:464] Parse version tidb_2023-06-27_00.43.39Z_master_123abcde_123456789 failure, error: Invalid Semantic Version
W0729 00:22:23.927754       1 tidb_member_manager.go:1102] parse tidb verson 'tidb_2023-06-27_00.43.39Z_master_123abcde_123456789' failed, skip setting store labels for TiKV of TiDB cluster tidb/devdev. err: Invalid Semantic Version

This makes a lot of error logs & prevents us from using various functionality and potentially incorrect usage at various operator code paths: https://github.com/pingcap/tidb-operator/blob/34c19d4b977df6afe5f3a60db17905f71a2fc1cf/pkg/manager/member/tidb_member_manager.go#L1144 https://github.com/pingcap/tidb-operator/blob/34c19d4b977df6afe5f3a60db17905f71a2fc1cf/pkg/manager/member/utils.go#L463 https://github.com/pingcap/tidb-operator/blob/34c19d4b977df6afe5f3a60db17905f71a2fc1cf/pkg/manager/member/ticdc_scaler.go#L236

Describe the feature you'd like: We would like to be able to specify an override version string for informing operator what tidb versions we are using which is separate from the actual image tag used for container images.

Describe alternatives you've considered: N/A

Teachability, Documentation, Adoption, Migration Strategy: Explained above.

cc: @coderplay @gegao-db

csuzhangxc commented 1 year ago

adding a new field as the desired version to override the version string from the image tag should work. But in some cases, if we need to know the current version of a Pod or StatefulSet, then we may need to get this information from HTTP APIs or store this information in the annotation of Pod/Statefulset.

anish-db commented 1 year ago

Yes, I think using version over HTTP Api in some cases would be fine since they would still be accurate in our case.

adamf-db commented 1 year ago

+1 to this feature request.