-
Notifications
You must be signed in to change notification settings - Fork 178
Open
Description
Consider the following code:
tanka.k8s.patchKubernetesObjects(
data,
{
metadata+: {
annotations+: {
'route.openshift.io/termination': 'edge',
},
},
},
kind='Ingress'
)
This is supposed to traverse data, find all objects of kind Ingress and patch them. However, currently patchKubernetesObjects also triggers on references, e.g. such as used by the patch-operator:
{
apiVersion: 'redhatcop.redhat.io/v1alpha1',
kind: 'Patch',
metadata: {
name: 'setup-cluster-ingress',
namespace: 'openshift-config',
},
spec: {
patches: {
'setup-cluster-ingress': {
targetObjectRef: {
apiVersion: 'config.openshift.io/v1',
kind: 'Ingress',
name: 'cluster',
},
patchTemplate: "",
patchType: 'application/merge-patch+json',
sourceObjectRefs: [],
},
},
},
}
The targetObjectRef requires both apiVersion and kind to properly resolve the target object, but these two fields also trigger patchKubernetesObjects detection.
I'm not quite sure how to resolve this properly, since the recursive step is required. Maybe detecting a apiVersion and kind and not recursing into that object could work, but I'm not sure if that's correct or expected behavior.
Metadata
Metadata
Assignees
Labels
No labels