Skip to content

Commit ee31e90

Browse files
authored
Merge pull request #3746 from gman0/drm-fix-scope
Fix scope mappings in DynamicRESTMapper
2 parents 7788cc5 + 0b90fd2 commit ee31e90

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

pkg/reconciler/dynamicrestmapper/defaultrestmapper_mutable.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ package dynamicrestmapper
1919
import (
2020
"slices"
2121

22-
"k8s.io/apimachinery/pkg/api/meta"
2322
"k8s.io/apimachinery/pkg/runtime/schema"
2423
)
2524

@@ -42,7 +41,7 @@ func (m *DefaultRESTMapper) add(typeMeta typeMeta) {
4241
m.resourceToKind[plural] = kind
4342

4443
m.kindToPluralResource[kind] = plural
45-
m.kindToScope[kind] = meta.RESTScopeRoot
44+
m.kindToScope[kind] = typeMeta.Scope
4645

4746
foundDefaultVersion := false
4847
for i := range m.defaultGroupVersions {

pkg/reconciler/dynamicrestmapper/typemeta.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ type typeMeta struct {
3535

3636
func resourceScopeToRESTScope(scope apiextensionsv1.ResourceScope) meta.RESTScope {
3737
if scope == apiextensionsv1.ClusterScoped {
38-
return meta.RESTScopeNamespace
38+
return meta.RESTScopeRoot
3939
}
40-
return meta.RESTScopeRoot
40+
return meta.RESTScopeNamespace
4141
}
4242

4343
func newTypeMeta(group, version, kind, singular, plural string, scope meta.RESTScope) typeMeta {

0 commit comments

Comments
 (0)