tidb-operator
tidb-operator copied to clipboard
operator tries to shrink volume after storage size update if value is in Mi
Bug Report
What version of Kubernetes are you using? Client Version: v1.28.1 Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3 Server Version: v1.27.6
What version of TiDB Operator are you using? TiDB Operator Version: version.Info{GitVersion:"v1.5.3", GitCommit:"2c9e4dad0abaa4400afdef9ceff3084e71510ecb", GitTreeState:"clean", BuildDate:"2024-04-18T03:46:15Z", GoVersion:"go1.21.6", Compiler:"gc", Platform:"linux/amd64"}
What storage classes exist in the Kubernetes cluster and what are used for PD/TiKV pods? cephfs.csi.ceph.com
What's the status of the TiDB cluster pods? Running
What did you do? I tried to update storage size in TidbCluster for PD and TiKV to 1740Mi and 15675Mi. The operator updated the volumes correctly but then in operator logs, I get these errors:
1 phase.go:74] volume rvgnrvpp/tikv-pnhrmptw-tikv-0 modification is not allowed: can't shrunk size from 16Gi to 15675Mi
1 phase.go:74] volume rvgnrvpp/pd-pnhrmptw-pd-0 modification is not allowed: can't shrunk size from 2Gi to 1740Mi
I set the disk size in Mi but after the volumes are updated, the operator seems to round up and use Gi and then complain about not being able to shrink the disk size from Gi value to Mi value that I've set.
What did you expect to see? I expected the operator NOT to try to shrink volumes after it updated the volumes.
What did you see instead? I saw the operator incorrectly assuming the storage size is 16Gi instead of 15675Mi and try to shrink the volumes.