kubernetes-sigs / kubernetes-sigs/kustomize

Support generic resource references in name reference tracking

Open
#3,418 21 comments 0 reactions 1 assignee Claimed by @natasha41575 View on GitHub
area/api kind/feature lifecycle/frozen needs-triage
Dominant language
Go
Stars
12.2k
Forks
2.4k
Avg merge
2d 14h
Merged PRs (30d)
25

Description

**Is your feature request related to a problem? Please describe.**

We are working a lot with Google Config Connector and many of the CRDs include references to other resources. In some cases the type of the reference target is implied and in these cases Kustomize's [name reference transformer](https://github.com/kubernetes-sigs/kustomize/blob/master/examples/transformerconfigs/README.md#name-reference-transformer) can easily be configured to understand the reference and support prefixing/suffixing. However, for some cases a CR can reference an arbitrary resource by specifying `apiVersion`/`kind` in addition to the name, e.g. an [IAMPolicyMember](https://github.com/GoogleCloudPlatform/k8s-config-connector/blob/master/crds/iam_v1beta1_iampolicymember.yaml) which can reference any of ~100 different resource kinds, there seems to be no clean way of configuring name transformation. See below for an example:

```yaml
apiVersion: iam.cnrm.cloud.google.com/v1beta1
kind: IAMPolicyMember
metadata:
name: iampolicymember-sample-pubsubadmin
spec:
member: serviceAccount:iampolicymember-dep-pubsub@some-project.iam.gserviceaccount.com
role: roles/editor
resourceRef:
apiVersion: pubsub.cnrm.cloud.google.com/v1beta1
kind: PubSubTopic
name: iampolicymember-dep-pubsubadmin
```

**Describe the solution you'd like**

It would be great if `nameReference` supported picking up the target `kind`/`apiVersion`/`group`/`version` via the field specs instead.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.