From 1eb8d3ce5719713cfaeb968bad93a927cad3caaa Mon Sep 17 00:00:00 2001 From: Peter Rifel Date: Thu, 3 Oct 2024 20:51:17 -0500 Subject: [PATCH] Prefix resource dump filenames with group Certain api services have conflicting Resource types, causing resource dumps to overwrite eachother. This ensures filenames remain unique by prefixing them with the api group --- pkg/dump/resourcedumper.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/dump/resourcedumper.go b/pkg/dump/resourcedumper.go index 44a496c76ff69..21076a95db8d0 100644 --- a/pkg/dump/resourcedumper.go +++ b/pkg/dump/resourcedumper.go @@ -58,7 +58,13 @@ type gvrNamespace struct { } func (d *gvrNamespace) String() string { - return path.Join(d.namespace, d.gvr.Resource) + var gr string + if d.gvr.Group == "" { + gr = d.gvr.Resource + } else { + gr = fmt.Sprintf("%v.%v", d.gvr.Group, d.gvr.Resource) + } + return path.Join(d.namespace, gr) } type resourceDumper struct {