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

Validate resources.request.storage for each item in spec.tiflash.storageClaims #4635

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

Conversation

hoyhbx
Copy link
Contributor

@hoyhbx hoyhbx commented Jul 18, 2022

What problem does this PR solve?

This PR solves the problem that assigning empty objects under storageClaims of tiflash can bypass the validation of the operator.

We found that when we specified tiflash spec with some empty objects under storageClaims, we got rejection from the events saying that storage is a required field. However, we did not get error messages or alerts from the operator indicating that storage is required.

Additionally, from the source code of TiDB operator, we discovered that assigning empty objects under storageClaims can bypass the operator's validation code. For details, please refer to the issue we submitted: #4613

What is changed and how does it work?

We believed it is necessary to check whether storage is set when specifying storageClaims for tiflash. We added a sanity check in the function validateTiFlashSpec to see whether storage exists in the resource requests.

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.

Validate `resources.request.storage` for each item in `spec.tiflash.storageClaims`

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Jul 18, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • DanielZhangQD
  • KanShiori

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

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

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

Copy link
Contributor

@DanielZhangQD DanielZhangQD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@DanielZhangQD
Copy link
Contributor

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 6fc2786

@codecov-commenter
Copy link

codecov-commenter commented Jul 22, 2022

Codecov Report

Merging #4635 (b351275) into master (b004b9a) will decrease coverage by 0.01%.
The diff coverage is n/a.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4635      +/-   ##
==========================================
- Coverage   59.01%   59.01%   -0.01%     
==========================================
  Files         227      227              
  Lines       26357    26357              
==========================================
- Hits        15555    15554       -1     
- Misses       9298     9299       +1     
  Partials     1504     1504              
Flag Coverage Δ
unittest 59.01% <ø> (-0.01%) ⬇️

@DanielZhangQD
Copy link
Contributor

/run-all-tests

@DanielZhangQD
Copy link
Contributor

/test pull-e2e-kind-across-kubernetes

@DanielZhangQD
Copy link
Contributor

/run-all-tests

1 similar comment
@DanielZhangQD
Copy link
Contributor

/run-all-tests

@DanielZhangQD
Copy link
Contributor

/test pull-e2e-kind pull-e2e-kind-serial

@ti-chi-bot
Copy link
Member

Merge canceled because a new commit is pushed.

@hoyhbx hoyhbx requested a review from KanShiori April 2, 2023 02:46
@hoyhbx
Copy link
Contributor Author

hoyhbx commented Apr 2, 2023

Hi @KanShiori I just rebased it, is it possible for you to take a look and merge this fix?

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