nephio-project / nephio

Nephio is a Kubernetes-based automation platform for deploying and managing highly distributed, interconnected workloads such as 5G Network Functions, and the underlying infrastructure on which those workloads depend.
Apache License 2.0
104 stars 53 forks source link

Add selector functionality to set-namespace #633

Open liamfallon opened 5 months ago

liamfallon commented 5 months ago

Original issue URL: https://github.com/kptdev/kpt/issues/3617 Original issue user: https://github.com/wmuizelaar Original issue created at: 2022-10-13T14:40:33Z Original issue last updated at: 2023-04-16T00:40:28Z Original issue body: ### Describe your problem

We want to run set-namespace against KCC based resources. If we for example provide this input yaml:

apiVersion: iam.cnrm.cloud.google.com/v1beta1
kind: IAMPolicyMember
metadata:
  name: example
  namespace: example-namespace
spec:
  resourceRef:
    apiVersion: iam.cnrm.cloud.google.com/v1beta1
    kind: IAMServiceAccount
    name: example
    namespace: example-namespace
  role: roles/iam.workloadIdentityUser
  member: serviceAccount:example-project.svc.id.goog[example-namespace/example]

And let set-namespace run on this, only the first metadata.namespace field is replaced with the desired value. It would be nice if we could provide some configuration to also update the namespace in the spec.resourceRef.namespace field. Now we have to do it with apply-replacements, and target it that way, but it would be more convenient if set-namespace will all fix this in 1 go.

Original issue comments: Comment user: https://github.com/johnbelamaric Comment created at: 2023-04-16T00:40:17Z Comment last updated at: 2023-04-16T00:40:17Z Comment body: An additionalNamespaceFields seems like it would be easy to add, analogous to additionalImageFields in https://catalog.kpt.dev/set-image/v0.1/

liamfallon commented 3 months ago

I think this is an enhancement on the kpt set-namespace function and not on Porch.