Skip to content

Promote the shared injection check to the CLI and webhook#2555

Merged
ihcsim merged 9 commits intomasterfrom
isim/proxy-injection-check
Mar 27, 2019
Merged

Promote the shared injection check to the CLI and webhook#2555
ihcsim merged 9 commits intomasterfrom
isim/proxy-injection-check

Conversation

@ihcsim
Copy link
Contributor

@ihcsim ihcsim commented Mar 25, 2019

This PR refactors the shouldInject logic by promoting it from the shared pkg/inject library to the CLI and webhook.

Performing this check earlier helps to separate the specialized logic to the CLI and webhook. Subsequent modification to this check to support configs override of existing meshed workloads will be confined to the relevant component.

This PR addresses point 1 to 3 of our previous discussion on configs override in 2500.

Signed-off-by: Ivan Sim [email protected]

@ihcsim ihcsim requested review from alpeb and klingerf March 25, 2019 04:22
@ihcsim ihcsim self-assigned this Mar 25, 2019
@ihcsim ihcsim added area/inject priority/P0 Release Blocker labels Mar 25, 2019
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.

All these refactorings certainly improve the quality of the code, thanks for taking care of this!
I added some comments below from a first review pass.

if !nonEmpty {
r := inject.Report{UnsupportedResource: true}
return bytes, []inject.Report{r}, nil
reports := []inject.Report{*report}
Copy link
Member

Choose a reason for hiding this comment

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

It appears we can deal with a single report (instead of having to always wrap in an single-item array) everywhere except in the inject_utils.go functions. That got evident in on of my branches, so I decided to tackle that later in a separate PR, but you can do that here as well if you find it's a natural change 😉

ns: nsDisabled,
conf: confNsDisabled(),
expected: false,
},
Copy link
Member

Choose a reason for hiding this comment

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

Is it enough to add the additional Injectable() test below to be able to re-enable these tests, or is it more complicated than that? If so we could track that as a separate item for the 2.3 test sprint to expedite this PR ⚡

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These two test cases are no longer useful, as the results will always be true because GetPatch() no longer checks if injection should happen. Some of these tests need to be revisited, as they aren't testing anything webhook related, but not in this PR.

@ihcsim ihcsim force-pushed the isim/proxy-injection-check branch 2 times, most recently from d2d43ae to 0b11a25 Compare March 26, 2019 17:55
@l5d-bot
Copy link
Collaborator

l5d-bot commented Mar 26, 2019

@l5d-bot
Copy link
Collaborator

l5d-bot commented Mar 26, 2019

Ivan Sim added 4 commits March 26, 2019 14:27
…webhook

Performing this check earlier helps to separate the specialized logic to the CLI
and webhook.
Any subsequent modification of this check logic to support config override of
existing meshed workload will be confined to the relevant component.
The shared lib can then focus only on config overrides.

Signed-off-by: Ivan Sim <[email protected]>
Signed-off-by: Ivan Sim <[email protected]>
Signed-off-by: Ivan Sim <[email protected]>
@ihcsim ihcsim force-pushed the isim/proxy-injection-check branch from 0b11a25 to 31c413c Compare March 26, 2019 21:32
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.

This looks and tests well for me :shipit:

@l5d-bot
Copy link
Collaborator

l5d-bot commented Mar 26, 2019

@l5d-bot
Copy link
Collaborator

l5d-bot commented Mar 26, 2019

Copy link
Contributor

@klingerf klingerf left a comment

Choose a reason for hiding this comment

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

Nice, the approach seems a lot cleaner overall. But I think we've regressed on the logic that determines whether or not the webhook should inject a pod -- see my comment below.

Copy link
Member

@siggy siggy left a comment

Choose a reason for hiding this comment

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

looks good! left a couple related comments...

@ihcsim ihcsim force-pushed the isim/proxy-injection-check branch from 774c8b7 to b312215 Compare March 27, 2019 06:00
@l5d-bot
Copy link
Collaborator

l5d-bot commented Mar 27, 2019

@ihcsim ihcsim force-pushed the isim/proxy-injection-check branch from b312215 to 3b45283 Compare March 27, 2019 13:46
@l5d-bot
Copy link
Collaborator

l5d-bot commented Mar 27, 2019

@ihcsim ihcsim force-pushed the isim/proxy-injection-check branch from 10f0545 to 3fa3972 Compare March 27, 2019 16:05
@l5d-bot
Copy link
Collaborator

l5d-bot commented Mar 27, 2019

@ihcsim ihcsim force-pushed the isim/proxy-injection-check branch from 3fa3972 to 3095a77 Compare March 27, 2019 16:32
@l5d-bot
Copy link
Collaborator

l5d-bot commented Mar 27, 2019

Ivan Sim added 2 commits March 27, 2019 11:01
@ihcsim ihcsim force-pushed the isim/proxy-injection-check branch from feede5c to b340ec7 Compare March 27, 2019 18:51
@l5d-bot
Copy link
Collaborator

l5d-bot commented Mar 27, 2019

Signed-off-by: Ivan Sim <[email protected]>
@l5d-bot
Copy link
Collaborator

l5d-bot commented Mar 27, 2019

Copy link
Member

@siggy siggy left a comment

Choose a reason for hiding this comment

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

This change LGTM. I tested most of the permutations laid out in #2569. One thing to confirm: config.linkerd.io annotations are not honored at the namespace-level, correct?

👍 🚢

@ihcsim
Copy link
Contributor Author

ihcsim commented Mar 27, 2019

This change LGTM. I tested most of the permutations laid out in #2569. One thing to confirm: config.linkerd.io annotations are not honored at the namespace-level, correct?

Correct. We moved it out of 2.3 into #2499.

@ihcsim ihcsim merged commit ea07dd3 into master Mar 27, 2019
@ihcsim ihcsim deleted the isim/proxy-injection-check branch March 27, 2019 21:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants