Skip to content

Properly passing annotation changes for Inject (#10231)#10257

Closed
scotran wants to merge 1 commit intolinkerd:mainfrom
scotran:main
Closed

Properly passing annotation changes for Inject (#10231)#10257
scotran wants to merge 1 commit intolinkerd:mainfrom
scotran:main

Conversation

@scotran
Copy link

@scotran scotran commented Feb 3, 2023

Namespaces and services passed to linkerd inject are annotated properly but print "skipped" to stderr.

This fix makes sure that changes to report when transforming input are appropriately applied to the resulting Go slice. Previously, changes were not being properly propogated to the reports slice: this change makes sure that changes to the Annotated field are properly made. Returning the slice inline makes it explicit that just one report is being returned in the slice and that the changes to report are being passed.

Fixes #10231

For example testing, run: kubectl get ns <namespace> -o yaml | linkerd inject -

Screen Shot 2023-02-02 at 5 42 43 PM

Signed-off-by: Scott Tran [email protected]

@scotran scotran requested a review from a team as a code owner February 3, 2023 00:02
Copy link
Member

@alpeb alpeb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch, thanks!

There are some units tests that are failing because they're still expecting the old "skipped" output. You can run them with go test ./.... Should be an easy fix.

Also, can you please take care of the DCO for the checks to pass?

Finally, it seems that the second returned value from the transform function is always either nil of a single-valued slice, so there might be some simplifications that can be done there. Not a blocker for this PR though, and if you're up to it, can be done as a follow-up PR 😉

@scotran
Copy link
Author

scotran commented Feb 15, 2023

Hey, sorry been a bit busy lately: I'll try to get those changes done this weekend :)

… print skipped to stderr.

This fix makes sure that changes to when transforming input are appropriately applied to the resulting Go slice. Previously, changes were not being properly propogated to the slice: this change makes sure that changes to the field are properly made. Returning the slice inline makes it explicit that just one is being returned in the slice and that the changes to are being passed. Unit test cases are also changed.

Fixes linkerd#10231

For example testing, run:

Signed-off-by: Scott Tran <[email protected]>
@scotran
Copy link
Author

scotran commented Feb 20, 2023

Pulled latest commits and changed the unit tests and added DCO: I believe all the associated tests should be changed now.

@alpeb
Copy link
Member

alpeb commented Feb 23, 2023

Thanks for the fixes @scotran 👍
Now that I see the report fixtures files there's a lot of duplication, like

statefulset "web" annotated
statefulset "web" injected

Maybe in generateReport() we should output that something got annotated only if r.Annotated && !r.Injectable()?
Chiming @kleimkuhler in since he had some opinions about this.

@alpeb alpeb requested a review from kleimkuhler February 23, 2023 14:42
@mateiidavid mateiidavid marked this pull request as draft March 16, 2023 16:29
@alpeb
Copy link
Member

alpeb commented Mar 30, 2023

Closing this one. Please reopen if you're still interested in picking this up again.

@alpeb alpeb closed this Mar 30, 2023
@scotran
Copy link
Author

scotran commented Apr 12, 2023

Are there any changes would you like to make in regards to this PR at this moment? since I saw @kleimkuhler never reviewed this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[cli] linkerd inject show "skipped" for a Namespace

2 participants