Skip to content

Commit 0f5a256

Browse files
committed
Use 'core' group to replicate core API objects
Resources from core API use empty group, but this breaks label selectors that end up being empty, and fail validation. This commit replaces empty group with 'core'. On-behalf-of: @SAP [email protected] Signed-off-by: Robert Vasek <[email protected]>
1 parent 68596e1 commit 0f5a256

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

pkg/reconciler/cache/cachedresources/cachedresources_reconcile.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,10 @@ func (c *Controller) deleteSelectedCacheResources(ctx context.Context, cluster l
140140
Version: cachedResource.Spec.Version,
141141
Resource: cachedResource.Spec.Resource,
142142
}
143+
if gvr.Group == "" {
144+
gvr.Group = "core"
145+
}
146+
143147
selector := labels.SelectorFromSet(labels.Set{
144148
replicationcontroller.LabelKeyObjectSchema: gvr.Version + "." + gvr.Resource + "." + gvr.Group,
145149
})
@@ -161,6 +165,9 @@ func (c *Controller) listSelectedCacheResources(ctx context.Context, cluster log
161165
Version: cachedResource.Spec.Version,
162166
Resource: cachedResource.Spec.Resource,
163167
}
168+
if gvr.Group == "" {
169+
gvr.Group = "core"
170+
}
164171

165172
selector := labels.SelectorFromSet(labels.Set{
166173
replicationcontroller.LabelKeyObjectSchema: gvr.Version + "." + gvr.Resource + "." + gvr.Group,

pkg/reconciler/cache/cachedresources/replication/replication_reconcile.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ func (c *Controller) reconcile(ctx context.Context, gvrKey string) error {
122122
},
123123
createObject: func(ctx context.Context, cluster logicalcluster.Name, obj *unstructured.Unstructured) (*cachev1alpha1.CachedObject, error) {
124124
gvr := obj.GroupVersionKind()
125+
if gvr.Group == "" {
126+
gvr.Group = "core"
127+
}
125128

126129
objBytes, err := json.Marshal(obj)
127130
if err != nil {
@@ -159,6 +162,9 @@ func (c *Controller) reconcile(ctx context.Context, gvrKey string) error {
159162
},
160163
updateObject: func(ctx context.Context, cluster logicalcluster.Name, obj *unstructured.Unstructured) (*cachev1alpha1.CachedObject, error) {
161164
gvr := obj.GroupVersionKind()
165+
if gvr.Group == "" {
166+
gvr.Group = "core"
167+
}
162168

163169
objBytes, err := json.Marshal(obj)
164170
if err != nil {

0 commit comments

Comments
 (0)