Skip to content

Commit cba0302

Browse files
committed
Add upstream namespace name as a label to downstream namespaces when reconciled.
1 parent 930812e commit cba0302

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

internal/downstreamclient/mappednamespace.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ func (c *mappedNamespaceResourceStrategy) ObjectMetaFromUpstreamObject(ctx conte
5454
return metav1.ObjectMeta{
5555
Name: obj.GetName(),
5656
Namespace: downstreamNamespaceName,
57+
Labels: map[string]string{
58+
UpstreamOwnerNamespaceLabel: obj.GetNamespace(),
59+
},
5760
}, nil
5861
}
5962

@@ -96,6 +99,11 @@ func (c *mappedNamespaceResourceStrategy) ensureDownstreamNamespace(ctx context.
9699

97100
downstreamNamespace.Labels[UpstreamOwnerClusterNameLabel] = fmt.Sprintf("cluster-%s", strings.ReplaceAll(c.upstreamClusterName, "/", "_"))
98101

102+
labels := obj.GetLabels()
103+
if v, ok := labels[UpstreamOwnerNamespaceLabel]; ok {
104+
downstreamNamespace.Labels[UpstreamOwnerNamespaceLabel] = v
105+
}
106+
99107
return nil
100108
})
101109
if err != nil {

0 commit comments

Comments
 (0)