Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: type mismatch in TidbMonitor remoteTimeout #5734

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

IMMORTALxJO
Copy link

@IMMORTALxJO IMMORTALxJO commented Sep 5, 2024

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
  • 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`

Copy link
Contributor

ti-chi-bot bot commented Sep 5, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign tennix for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot requested a review from shonge September 5, 2024 20:07
@sre-bot
Copy link
Contributor

sre-bot commented Sep 5, 2024

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

ti-chi-bot bot commented Sep 5, 2024

Welcome @IMMORTALxJO! It looks like this is your first PR to pingcap/tidb-operator 🎉

@ti-chi-bot ti-chi-bot bot added the size/XS label Sep 5, 2024
@IMMORTALxJO IMMORTALxJO changed the title fix: type mismatch in TidbMonitor remoteTimeout [WIP] fix: type mismatch in TidbMonitor remoteTimeout Sep 5, 2024
@ti-chi-bot ti-chi-bot bot added size/XXL and removed size/XS labels Oct 31, 2024
@IMMORTALxJO IMMORTALxJO changed the title [WIP] fix: type mismatch in TidbMonitor remoteTimeout fix: type mismatch in TidbMonitor remoteTimeout Oct 31, 2024
@ti-chi-bot ti-chi-bot bot added size/S and removed size/XXL labels Oct 31, 2024
@csuzhangxc
Copy link
Member

@IMMORTALxJO If we want to modify the CRD, we need to modify the Go struct in types.go and then re-generate the CRD (make generate)

@IMMORTALxJO
Copy link
Author

@csuzhangxc thank you, I've added the missing file with Go struct.

@csuzhangxc
Copy link
Member

@csuzhangxc thank you, I've added the missing file with Go struct.

It seems still need to re-generate other files, can you run make generate?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants