-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
馃尡 Add Cluster and ClusterClass variable defaulting and validation #5615
馃尡 Add Cluster and ClusterClass variable defaulting and validation #5615
Conversation
d279ff8
to
c7e1785
Compare
docs/proposals/202105256-cluster-class-and-managed-topologies.md
Outdated
Show resolved
Hide resolved
|
||
// DefaultClusterVariables defaults variables which do not exist in clusterVariable, if they | ||
// have a default value in the corresponding schema in clusterClassVariable. | ||
func DefaultClusterVariables(clusterVariables []clusterv1.ClusterVariable, clusterClassVariables []clusterv1.ClusterClassVariable, fldPath *field.Path) ([]clusterv1.ClusterVariable, field.ErrorList) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func DefaultClusterVariables(clusterVariables []clusterv1.ClusterVariable, clusterClassVariables []clusterv1.ClusterClassVariable, fldPath *field.Path) ([]clusterv1.ClusterVariable, field.ErrorList) { | |
func DefaultClusterVariables(clusterVariables []clusterv1.ClusterVariable, clusterClassVariables []clusterv1.ClusterClassVariable) ([]clusterv1.ClusterVariable, field.ErrorList) { |
all the checks in this func are referring to to spec.topology.variables.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just felt like a best practice to pass in the relative field path which fits the struct we pass in which is then further amended. It makes it a lot easier to track per function if the path is constructed correctly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
internal/topology/variables/clusterclass_variable_validation.go
Outdated
Show resolved
Hide resolved
c7e1785
to
2ebd776
Compare
ee697dd
to
d8dc4e3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great so far. A few nits.
Disclaimer: only reviewed "prod" (non-test) code
internal/topology/variables/clusterclass_variable_validation.go
Outdated
Show resolved
Hide resolved
internal/topology/variables/clusterclass_variable_validation.go
Outdated
Show resolved
Hide resolved
d8dc4e3
to
cd38690
Compare
bca111b
to
67076b5
Compare
067f668
to
7ccd337
Compare
docs/proposals/202105256-cluster-class-and-managed-topologies.md
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks great!
0211793
to
14ab981
Compare
internal/topology/variables/cluster_variable_defaulting_test.go
Outdated
Show resolved
Hide resolved
141f967
to
fbc1117
Compare
Signed-off-by: Stefan B眉ringer buringerst@vmware.com Signed-off-by: killianmuldoon <kmuldoon@vmware.com> Co-authored-by: killianmuldoon kmuldoon@vmware.com
fbc1117
to
9099eb5
Compare
/lgtm |
[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 |
Signed-off-by: Stefan B眉ringer buringerst@vmware.com
Introduce webhook functions to validate the variables contained in a Cluster against their definitions in a ClusterClass, validate that the definitions of variables in a clusterClass are valid, and default the variables in a Cluster based on the defaulting defined in their schemas.
Fixes #5612