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

✨ Handle variable definition conflicts for external variables #8107

Conversation

killianmuldoon
Copy link
Contributor

Add handling for conflicting definitions in variables defined in the ClusterClass and external patches. This change includes:

  • Comparing variables and signalling which variables conflict in the ClusterClass status
  • Validation and Defaulting of variables based on the appropriate definiton where conflicts exist
  • Validating that Cluster's define a DefinitionFrom field when there are conflicting variables

Part of #7985

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Feb 14, 2023
@k8s-ci-robot k8s-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Feb 14, 2023
Copy link
Contributor Author

@killianmuldoon killianmuldoon left a comment

Choose a reason for hiding this comment

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

/hold

This PR contains a commit from #8076 which should be reviewed and merged first.

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 14, 2023
@killianmuldoon killianmuldoon mentioned this pull request Feb 14, 2023
34 tasks
@killianmuldoon killianmuldoon force-pushed the pr-exvars-handle-definition-conflict branch 2 times, most recently from f5673c1 to 8a5d8b6 Compare February 14, 2023 19:22
@killianmuldoon killianmuldoon force-pushed the pr-exvars-handle-definition-conflict branch 4 times, most recently from f07cbe2 to 042a2a6 Compare February 16, 2023 15:35
@killianmuldoon killianmuldoon changed the title [WIP] ✨ Handle variable definition conflicts for external variables ✨ Handle variable definition conflicts for external variables Feb 16, 2023
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 16, 2023
@killianmuldoon
Copy link
Contributor Author

killianmuldoon commented Feb 16, 2023

This is ready for a round of review @sbueringer

Copy link
Member

@sbueringer sbueringer left a comment

Choose a reason for hiding this comment

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

Next iteration. And now reviewing internal/topology/variables

internal/webhooks/cluster_test.go Outdated Show resolved Hide resolved
internal/webhooks/cluster_test.go Outdated Show resolved Hide resolved
@killianmuldoon killianmuldoon force-pushed the pr-exvars-handle-definition-conflict branch from 042a2a6 to d12193b Compare February 17, 2023 11:39
@killianmuldoon killianmuldoon changed the title ✨ Handle variable definition conflicts for external variables ✨ [WIP] Handle variable definition conflicts for external variables Feb 17, 2023
@killianmuldoon killianmuldoon force-pushed the pr-exvars-handle-definition-conflict branch 4 times, most recently from 2f79163 to 90f9126 Compare February 22, 2023 19:06
@killianmuldoon killianmuldoon changed the title ✨ [WIP] Handle variable definition conflicts for external variables ✨ Handle variable definition conflicts for external variables Feb 22, 2023
@killianmuldoon
Copy link
Contributor Author

Should be ready for another round @sbueringer

@sbueringer
Copy link
Member

/retest

Some new flakes but independent of this PR (I'll probably take a look later)

@killianmuldoon killianmuldoon force-pushed the pr-exvars-handle-definition-conflict branch 3 times, most recently from bdcc0e1 to 97b8caf Compare February 24, 2023 15:08
@k8s-ci-robot

This comment was marked as off-topic.

@sbueringer
Copy link
Member

Sorry my bad. Have to fix the job config..

@killianmuldoon killianmuldoon force-pushed the pr-exvars-handle-definition-conflict branch 2 times, most recently from ea0f959 to a9c7a35 Compare February 27, 2023 13:39
@killianmuldoon killianmuldoon force-pushed the pr-exvars-handle-definition-conflict branch from a9c7a35 to 9ab052c Compare February 27, 2023 15:56
Copy link
Member

@fabriziopandini fabriziopandini left a comment

Choose a reason for hiding this comment

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

This is outstanding work!
Just few comments from my side

func defaultClusterVariable(clusterVariable *clusterv1.ClusterVariable, clusterClassVariable *clusterv1.ClusterClassVariable, fldPath *field.Path, createVariable bool) (*clusterv1.ClusterVariable, field.ErrorList) {
if clusterVariable == nil {
// defaultValue defaults a clusterVariable based on the default value in the clusterClassVariable.
func defaultValue(currentValue *clusterv1.ClusterVariable, definition *statusVariableDefinition, fldPath *field.Path, createVariable bool) (*clusterv1.ClusterVariable, field.ErrorList) {
Copy link
Member

Choose a reason for hiding this comment

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

kudos for cleaning up the wording (the distinction between value/definition make code more readable)

Copy link
Member

Choose a reason for hiding this comment

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

Absolutely agree. clusterVariable vs clusterClassVariable was driving me slightly crazy :)
(disclaimer I wrote this code initially)

@killianmuldoon killianmuldoon force-pushed the pr-exvars-handle-definition-conflict branch 2 times, most recently from f1d4b91 to 30315cc Compare February 28, 2023 11:09
@killianmuldoon
Copy link
Contributor Author

/hold remove

Underlying PRs all merged

@killianmuldoon
Copy link
Contributor Author

/remove-hold

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 28, 2023
Copy link
Member

@sbueringer sbueringer left a comment

Choose a reason for hiding this comment

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

Last nits from my side

@killianmuldoon killianmuldoon force-pushed the pr-exvars-handle-definition-conflict branch from 30315cc to 56f9a52 Compare February 28, 2023 12:28
@sbueringer
Copy link
Member

Thank you very much!!

Really great work, thank you especially for the extensive test coverage!!!

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 28, 2023
@sbueringer
Copy link
Member

/assign @fabriziopandini

@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 0265b8c4b59c34b7820460c203e763f106fba2f9

@fabriziopandini
Copy link
Member

yay!
/lgtm
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fabriziopandini

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 28, 2023
@k8s-ci-robot k8s-ci-robot merged commit 83e7476 into kubernetes-sigs:main Feb 28, 2023
@k8s-ci-robot k8s-ci-robot added this to the v1.4 milestone Feb 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants