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

Merged
merged 2 commits into from
Dec 10, 2024

Conversation

IMMORTALxJO
Copy link
Contributor

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

@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 force-pushed the patch-1 branch 2 times, most recently from a36e3d2 to 7013978 Compare October 31, 2024 11:21
@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 IMMORTALxJO force-pushed the patch-1 branch 2 times, most recently from 5b165ea to 73ea1b8 Compare November 5, 2024 09:24
@IMMORTALxJO
Copy link
Contributor 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?

@IMMORTALxJO
Copy link
Contributor Author

@csuzhangxc sorry for the delay, added make generate results to the commit.

@csuzhangxc
Copy link
Member

@IMMORTALxJO can you fix the problem reported in CI? https://github.com/pingcap/tidb-operator/actions/runs/12186746269/job/34009983048?pr=5734

@ti-chi-bot ti-chi-bot bot added size/M and removed size/S labels Dec 6, 2024
@IMMORTALxJO
Copy link
Contributor Author

IMMORTALxJO commented Dec 6, 2024

@csuzhangxc thank you, fixed tests, please check

@codecov-commenter
Copy link

codecov-commenter commented Dec 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 63.09%. Comparing base (a16b2e8) to head (c4e9f61).
Report is 11 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5734      +/-   ##
==========================================
+ Coverage   57.19%   63.09%   +5.89%     
==========================================
  Files         259      263       +4     
  Lines       33233    45660   +12427     
==========================================
+ Hits        19008    28807    +9799     
- Misses      12291    14845    +2554     
- Partials     1934     2008      +74     
Flag Coverage Δ
e2e 45.64% <100.00%> (?)
unittest 56.96% <100.00%> (-0.23%) ⬇️

@csuzhangxc
Copy link
Member

/run-all-tests

@ti-chi-bot ti-chi-bot bot added the lgtm label Dec 10, 2024
Copy link
Contributor

ti-chi-bot bot commented Dec 10, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: csuzhangxc

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

The pull request process is described 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

Copy link
Contributor

ti-chi-bot bot commented Dec 10, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-12-10 03:56:45.596224052 +0000 UTC m=+324395.685026596: ☑️ agreed by csuzhangxc.

@ti-chi-bot ti-chi-bot bot added the approved label Dec 10, 2024
@csuzhangxc csuzhangxc merged commit f56e7d9 into pingcap:master Dec 10, 2024
11 of 13 checks passed
@csuzhangxc
Copy link
Member

/cherry-pick release-1.6

@ti-chi-bot
Copy link
Member

@csuzhangxc: new pull request created to branch release-1.6: #5969.

In response to this:

/cherry-pick release-1.6

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

csuzhangxc pushed a commit that referenced this pull request Dec 10, 2024
@IMMORTALxJO IMMORTALxJO deleted the patch-1 branch December 10, 2024 08:50
RidRisR pushed a commit to RidRisR/tidb-operator that referenced this pull request Jan 13, 2025
* change remoteTimeout type in pingcap.com_tidbmonitors.yaml

* fix remoteTimeout tests
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.

5 participants