-
Notifications
You must be signed in to change notification settings - Fork 494
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
Draft: Add check for watch_namespace before mutating Pod #2666
Draft: Add check for watch_namespace before mutating Pod #2666
Conversation
btw I'm not an specialist in golang, so any suggestion/comments are super welcome ;-) |
@janario, thank you for raising this topic, but could you please open an issue with the manifest you used to deploy the operator? So, we could do a triage and then proceed with the PR review. |
Please check the failing CI jobs. |
Marking this as a draft, I plan to get back on this and a few other issues soon after some internal migration. |
255ea3d
to
440ca38
Compare
440ca38
to
87dba94
Compare
Added an e2e case, not perfect but it can exemplify better the issue we have. Scenario:
Case 1: Deploy in the Case 2: Deploy in the When I try to filter the mutators list it doesn't try to change it. Not sure if the best approach since it was already expected to be filtered out. Test log:
Operator error log:
Executed with:
|
Signed-off-by: Janario Oliveira <[email protected]>
Signed-off-by: Janario Oliveira <[email protected]>
Signed-off-by: Janario Oliveira <[email protected]>
e475580
to
8a1cca1
Compare
I got more on this. I've added some log lines to the other CRDs like OpenTelemetryCollector.
So I tried to understand how other operators do such filter. Turns out, the ones I've checked, they use the So when I try:
It gets as I was expecting for only namespaces with the label. I wasn't that familiar with the MutatingWebhookConfiguration and how to limit its webhook scope. At the helm chart I can achieve that, so I'm fine with it/ Do we need Shouldn't we point to customize and use the |
|
I got it. I just think they are two things that ideally should be configured together, but I see it is not strongly attached. So thinking about what drove me here, I'm thinking of improving this log line so whoever reads it has a better idea on how to limit the operator to specific namespaces. wdyt? I can add more details in the log line in another PR |
@janario that sounds good to me. |
@@ -24,6 +24,8 @@ import ( | |||
"strings" | |||
"time" | |||
|
|||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be merged with the group below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll work in another PR with log improvements since it is kind of expected behavior
Description:
We have a scenario where in some environment (e.g. dev) the same helm chart is deployed across many different personal namespaces. While we keep the exact same helm chart config all around we were using the
WATCH_NAMESPACES
env var to restrict the operator to only a few namespaces that were relevant.However, we noticed that the operator was still trying to get other namespaces and failing with them because it was not in the list of watched (cache key). This was leaving the pod with instrumentation that seemed incomplete.
Stack message:
In this PR we will start to check the watch_namespaces before trying to mutate the pods.
Link to tracking Issue(s):
Testing:
Documentation: