Skip to content

Commit 11ca6b1

Browse files
committed
fix: Use correct format for API resource
The GroupVersionResource requires the resource to be both lowercase and plural. Signed-off-by: Scott Fleener <[email protected]>
1 parent 1d643ee commit 11ca6b1

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

controller/k8s/api_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ func newMockAPI(useInformer bool, res resources) (
5959

6060
if useInformer {
6161
api.Sync(nil)
62+
metadataAPI.Sync(nil)
6263
}
63-
metadataAPI.Sync(nil)
6464

6565
return api, metadataAPI, k8sResults, nil
6666
}
@@ -1205,7 +1205,7 @@ metadata:
12051205
name: invalid-rs-parent-dcfq4
12061206
namespace: default
12071207
ownerReferences:
1208-
- apiVersion: v1
1208+
- apiVersion: apps/v1
12091209
kind: ReplicaSet
12101210
name: invalid-rs-parent-2abdffa`,
12111211
},

controller/k8s/metadata_api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ func (api *MetadataAPI) GetRootOwnerKindAndName(ctx context.Context, tm *metav1.
313313

314314
resource := schema.FromAPIVersionAndKind(parentRef.APIVersion, parentRef.Kind).
315315
GroupVersion().
316-
WithResource(parentRef.Kind)
316+
WithResource(strings.ToLower(parentRef.Kind) + "s")
317317
parent, err := api.client.Resource(resource).
318318
Namespace(om.Namespace).
319319
Get(ctx, parentRef.Name, metav1.GetOptions{})

0 commit comments

Comments
 (0)