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
improve gvk and resid strings for error messages #4344
Conversation
4cc45e3
to
6003e21
Compare
kyaml/resid/resid_test.go
Outdated
}, | ||
{ | ||
ResId{}, | ||
"~G_~V_~K|", | ||
"[noKind].[noVer].[noGrp]/", |
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.
Not new, but why doesn't this one use the name placeholder?
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.
The GvknString method has the following body:
// GvknString of ResId based on GVK and name
func (id ResId) GvknString() string {
return id.Gvk.String() + separator + id.Name
}
Which looks kind of odd to me to begin with and I'm unsure why it exists... but also I took a look and we aren't actually using this anywhere, and I'm not sure where we would use this if ever instead of ResId.String() so I'm inclined to just remove it entirely.
@@ -218,7 +218,7 @@ spec: | |||
t.Fatalf("No match should return an error") | |||
} | |||
if err.Error() != | |||
"resource with name service does not match a config with the following GVK [~G_~V_Deployment]" { | |||
"resource with name service does not match a config with the following GVK [Deployment.[noVer].[noGrp]]" { |
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.
Can we get rid of the surrounding brackets now that we're using them internally?
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.
The surrounding brackets are not something we've added, but get added because we are outputting a list of gvks:
kustomize/plugin/builtin/replicacounttransformer/ReplicaCountTransformer.go
Lines 61 to 62 in 3608f33
return fmt.Errorf("resource with name %s does not match a config with the following GVK %v", | |
p.Replica.Name, gvks) |
6003e21
to
6dfc238
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.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: KnVerey, natasha41575 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 |
Before:
Gvk.String(): "g_v_k"
ResId.String(): "g_v_k|ns|nm"
After:
Gvk.String(): "{group: g, version: v, kind: k}"
ResId.String(): "{group: g, version: v, kind: k, name: nm, namespace: ns}"
/cc @KnVerey