tidb-operator icon indicating copy to clipboard operation
tidb-operator copied to clipboard

[WIP] fix: type mismatch in TidbMonitor remoteTimeout

Open IMMORTALxJO opened this issue 1 year ago • 3 comments

What problem does this PR solve?

Fix the bug where tidbmonitor.spec.prometheus.remoteWrite.remoteTimeout CRD only accepts integers:

Invalid value: "string": spec.prometheus.remoteWrite[0].remoteTimeout in body must be of type integer: "string"

However, if we pass an integer and check the operator logs, we will see that the operator fails to unmarshal the TiDBMonitor resource because it expected a string instead:

json: cannot unmarshal number into Go struct field RemoteWriteSpec.items.spec.prometheus.remoteWrite.remoteTimeout of type string

the definition of the struct field in code - here

What is changed and how does it work?

Changed field type in tidbmonitors CRD, from integer to string.

Code changes

  • [ ] Has Go code change
  • [ ] Has CI related scripts change

Tests

  • [ ] Unit test
  • [ ] E2E test
  • [ ] Manual test
  • [x] No code

Side effects

  • [ ] Breaking backward compatibility
  • [ ] Other side effects:

Related changes

  • [ ] Need to cherry-pick to the release branch
  • [ ] Need to update the documentation

Release Notes

Please refer to Release Notes Language Style Guide before writing the release note.

Fix type mismatch of `TidbMonitor` field `.spec.prometheus.remoteWrite.remoteTimeout`

IMMORTALxJO avatar Sep 05 '24 20:09 IMMORTALxJO