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
93 stars 52 forks source link

SetNamespace does not change namespace within the podTemplate #704

Open liamfallon opened 3 months ago

liamfallon commented 3 months ago

Original issue URL: https://github.com/kptdev/kpt/issues/3605 Original issue user: https://github.com/henderiw Original issue created at: 2022-10-10T17:58:19Z Original issue last updated at: 2022-11-15T22:00:10Z Original issue body: ### Expected behavior

When I use setNamespace the expectation is that the namespace is changed in all the KRM resource in TypeMeta but also deep into some resource schema(s)

Actual behavior

For resource that use podTemplates the respective namespace in the podTemplate is not changed.

example:

spec: replicas: 1 selector: matchLabels: fn.kptgen.dev/controller: topology-controller fn.kptgen.dev/metrics: topology-controller strategy: {} template: metadata: name: topology-controller namespace: ndd-system

Information

image: gcr.io/kpt-fn/set-namespace:v0.4.1

Steps to reproduce the behavior

KptFile

apiVersion: kpt.dev/v1 kind: Kptfile metadata: name: topology-app annotations: config.kubernetes.io/local-config: "true" upstream: type: git git: repo: https://github.com/yndd/topology directory: /blueprint/topology/app ref: v0.0.23 updateStrategy: resource-merge upstreamLock: type: git git: repo: https://github.com/yndd/topology directory: /blueprint/topology/app ref: v0.0.23 commit: ccac4b8f2c2303ea66151a35b678ad087d4b097e info: description: topology app pipeline: mutators:

pkgContext.yaml

apiVersion: v1 kind: ConfigMap metadata: name: kptfile.kpt.dev annotations: config.kubernetes.io/local-config: "true" data: name: tenant1

perform setNamespace ơn a deployment with a podTemplateSpec like the one below

apiVersion: apps/v1 kind: Deployment metadata: # kpt-merge: ndd-system/topology-controller name: topology-controller namespace: ndd-system spec: replicas: 1 selector: matchLabels: fn.kptgen.dev/controller: topology-controller fn.kptgen.dev/metrics: topology-controller strategy: {} template: metadata: labels: fn.kptgen.dev/controller: topology-controller fn.kptgen.dev/metrics: topology-controller name: topology-controller namespace: ndd-system spec: containers:

Original issue comments: