-
Notifications
You must be signed in to change notification settings - Fork 4
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
refine names and errors #25
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -37,11 +37,11 @@ var ( | |||
_ AllDesiredMutationsGetter = &applyConfiguration{} | ||||
) | ||||
|
||||
func ValidateAllDesiredMutationsGetter(allDesiredMutationsGetter AllDesiredMutationsGetter, allAllowedOutputResources *libraryoutputresources.OutputResources) error { | ||||
func ValidateUnfilteredMutations(allDesiredMutationsGetter AllDesiredMutationsGetter, allAllowedOutputResources *libraryoutputresources.OutputResources) []error { | ||||
errs := []error{} | ||||
|
||||
if allDesiredMutationsGetter == nil { | ||||
return fmt.Errorf("applyConfiguration is required") | ||||
return []error{fmt.Errorf("applyConfiguration is required")} | ||||
} | ||||
|
||||
allMutationRequests := []manifestclient.SerializedRequestish{} | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that
|
||||
|
@@ -74,7 +74,30 @@ func ValidateAllDesiredMutationsGetter(allDesiredMutationsGetter AllDesiredMutat | |||
errs = append(errs, fmt.Errorf("%d output-resource were produced, but not present in the specified output: %v", len(unspecifiedOutputIdentifiers), strings.Join(unspecifiedOutputIdentifiers, ", "))) | ||||
} | ||||
|
||||
return errors.Join(errs...) | ||||
return errs | ||||
} | ||||
|
||||
func ValidateAllDesiredMutationsGetter(allDesiredMutationsGetter AllDesiredMutationsGetter, allAllowedOutputResources *libraryoutputresources.OutputResources) []error { | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The previous function ( Shouldn't this function instead check if mutations for the given cluster type are on the allowed list specifically for that cluster type? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok, nvm, pruning/filtering is done at multi-operator-manager/pkg/library/libraryapplyconfiguration/client_mutations.go Line 114 in 28a3855
|
||||
errs := []error{} | ||||
|
||||
if allDesiredMutationsGetter == nil { | ||||
return []error{fmt.Errorf("applyConfiguration is required")} | ||||
} | ||||
|
||||
allMutationRequests := []manifestclient.SerializedRequestish{} | ||||
for _, clusterType := range sets.List(AllClusterTypes) { | ||||
desiredMutationsGetter := allDesiredMutationsGetter.MutationsForClusterType(clusterType) | ||||
switch { | ||||
case desiredMutationsGetter == nil: | ||||
errs = append(errs, fmt.Errorf("mutations for %q are required even if empty", clusterType)) | ||||
case desiredMutationsGetter.GetClusterType() != clusterType: | ||||
errs = append(errs, fmt.Errorf("mutations for %q reported type=%q", clusterType, desiredMutationsGetter.GetClusterType())) | ||||
} | ||||
|
||||
allMutationRequests = append(allMutationRequests, desiredMutationsGetter.Requests().AllRequests()...) | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like we're just appending to this slice, but not using it for anything else. Can it be dropped? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This function duplicates logic from |
||||
} | ||||
|
||||
return errs | ||||
} | ||||
|
||||
func WriteApplyConfiguration(desiredApplyConfiguration AllDesiredMutationsGetter, outputDirectory string) error { | ||||
|
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.
nit: move closer to where it is used.