-
Notifications
You must be signed in to change notification settings - Fork 2
Update /v1/clusters
to accept a list of workloads
#1104
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
Conversation
err = multierror.Append(err, invalidNamespaceErr) | ||
} | ||
} | ||
} |
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.
Maybe add another test for this fn a couple of invalid messages?
@@ -609,6 +609,28 @@ func validateCreateClusterPR(msg *capiv1_proto.CreatePullRequestRequest) error { | |||
} | |||
} | |||
|
|||
for _, k := range msg.Kustomizations { | |||
if k.Name == "" { | |||
err = multierror.Append(err, fmt.Errorf("kustomization name must be specified")) |
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.
This could be just errors.New("kustomization name must be specified")
as you're not formatting anything.
|
||
if k.SourceRef != nil { | ||
if k.SourceRef.Name == "" { | ||
err = multierror.Append(err, fmt.Errorf("sourceRef name must be specified")) |
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.
Same issue with Errorf
here, but perhaps we could include the name of the kustomization (k.Name
) in the error message to help with diagnosing?
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.
I agree 👌
return files, nil | ||
} | ||
|
||
func getClusterKustomizationsPath(cluster types.NamespacedName, ns, name string) string { |
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.
This looks like it should be two types.NamespacedName
values?
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.
Yesss, thank you 🙂
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.
LGTM!
@@ -609,6 +614,28 @@ func validateCreateClusterPR(msg *capiv1_proto.CreatePullRequestRequest) error { | |||
} | |||
} | |||
|
|||
for _, k := range msg.Kustomizations { | |||
if k.Metadata.Name == "" { |
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.
This might panic if k.Metadata is nil? Could we add one more test where we omit Metadata
in the request?
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.
Sure 🙂
closes: #1079
PR to update
/v1/clusters
endpoint to: