Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NameReference Transformer doesn't work with annotations. #4682

Closed
rishabh625 opened this issue Jun 20, 2022 · 3 comments · Fixed by #4703
Closed

NameReference Transformer doesn't work with annotations. #4682

rishabh625 opened this issue Jun 20, 2022 · 3 comments · Fixed by #4703
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@rishabh625
Copy link

rishabh625 commented Jun 20, 2022

The NameReference Transformer used on annotations doesn't work, Bcoz of the refBy field being added in annotations by this PR

some how when it moves up kustomization stack and when refBy field needs to be deleted from Resource Node it also removes referred annotations and thus transform doesn't apply on annotations.

Files that can reproduce the issue

For below files

kustomization.yaml

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: test
resources:
  - namespace.yaml
configurations:
  - kustomize-namespace.yaml 

nameReference:
  - kind: Namespace
    fieldSpecs:
      - path: metadata/annotations/foo
        kind: Namespace
        version: v1

resources.yaml

apiVersion: v1
kind: Namespace
metadata:
  name: namespace
  annotations:
    foo: namespace

kustomize build folder_name

doesn't produce expected output, the expected output used to come for version 4.2.0 , so its a bug which should have been caught in regression.

Expected output

apiVersion: v1
kind: Namespace
metadata:
  annotations:
    foo: test
  name: test

Actual output

apiVersion: v1
kind: Namespace
metadata:
  annotations:
    foo: namespace
  name: test

Kustomize version

kustomize/v4.5.2

Platform

Linux/macOS

Additional context
I am not sure on how to fix this

but if i add below code in kustomize/api/resource/resource.go on line no 371 and create the kustomize binary i get the expected output.

func (r *Resource) AppendRefBy(id fmt.Stringer) {
	//r.appendCsvAnnotation(utils.BuildAnnotationsRefBy, id.String())
}

I am unsure on how to solve it , i don't see the new annotation refBy being used somewhere else, so can we just revert this PR or what?

@rishabh625 rishabh625 added the kind/bug Categorizes issue or PR as related to a bug. label Jun 20, 2022
@k8s-ci-robot
Copy link
Contributor

@rishabh625: This issue is currently awaiting triage.

SIG CLI takes a lead on issue triage for this repo, but any Kubernetes member can accept issues by applying the triage/accepted label.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Jun 20, 2022
@rishabh625
Copy link
Author

rishabh625 commented Jun 20, 2022

@natasha41575 @KnVerey requires your attention

@KnVerey
Copy link
Contributor

KnVerey commented Jul 9, 2022

/assign

@KnVerey KnVerey added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Jul 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
3 participants