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

Add handling of updates to required fields to the CRD Upgrade Safety preflight check #933

Conversation

rashmigottipati
Copy link
Contributor

What this PR does / why we need it:

This PR adds a validation check to ensure that existing required fields can be marked as optional in a CRD schema:

  • Ensures that no new values are added as required that did not previously have any required fields present
  • Approves when existing values are removed from the required field
  • Adds unit and e2e tests

Which issue(s) this PR fixes:

Fixes #915

Does this PR introduce a user-facing change?

Add logic to the CRD Upgrade Safety pre-flight check to ensure that removals to the required field values of a CRD schema are allowed and that no new required fields can be added

Additional Notes for your reviewer:

Review Checklist:
  • Follows the developer guidelines
  • Relevant tests are added or updated
  • Relevant docs in this repo added or updated
  • Relevant carvel.dev docs added or updated in a separate PR and there's
    a link to that PR
  • Code is at least as readable and maintainable as it was before this
    change

Additional documentation e.g., Proposal, usage docs, etc.:


Copy link
Contributor

@everettraven everettraven left a comment

Choose a reason for hiding this comment

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

Besides a minor nit on the error message for adding required fields when there were previously none this looks great to me! Great work @rashmigottipati !

Copy link
Member

@praveenrewar praveenrewar left a comment

Choose a reason for hiding this comment

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

Just some minor changes. Looks good otherwise.

@rashmigottipati
Copy link
Contributor Author

@praveenrewar Thanks for reviewing the PR. Addressed the review feedback.

Will squash commits after approval/lgtm.

…preflight check

Signed-off-by: Rashmi Gottipati <chowdary.grashmi@gmail.com>
@rashmigottipati
Copy link
Contributor Author

Rebased and squashed the commits.

Copy link
Member

@praveenrewar praveenrewar left a comment

Choose a reason for hiding this comment

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

LGTM!

@praveenrewar praveenrewar merged commit 0e94ff1 into carvel-dev:develop Apr 26, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Add validation to CRDUpgradeSafety preflight check to allow changing an existing required field to be optional
3 participants