redhat-cop / podpreset-webhook

Implementation of Kubernetes PodPreset as an Admission Webhook.
Apache License 2.0
63 stars 30 forks source link

A bug when 2+ Podpreset are trying to apply presets, only the last one will be applied #1

Open mahmoudcb opened 4 years ago

mahmoudcb commented 4 years ago

I have 2 PodPresets that should be applied to the Pod. Here are the logs

{"level":"info","ts":1591409049.4927325,"logger":"podpreset_webhook_handler","msg":"PodPreset matches pod labels","PodPreset":"chartboost-config-repo","Pod":""}
{"level":"info","ts":1591409049.4928012,"logger":"podpreset_webhook_handler","msg":"PodPreset matches pod labels","PodPreset":"datadog-agent-host","Pod":""}
{"level":"info","ts":1591409049.4928439,"logger":"podpreset_webhook_handler","msg":"applied podpresets","Names":"datadog-agent-host,datadog-agent-host","Pod Name":"test-deployment-7f7f79757f-"}

It's clear from the logs that it is somehow trying to apply datadog-agent-host 2 times.

I'm suspecting mutatePodsFn and filterPodPresets functions aren't returning the correct lists.

danopia commented 4 years ago

Hmm, this looks like a duplicate of #2 which was supposedly addressed by #3. Do you still see the issue?

riccardo-salamanna commented 3 years ago

Hi - i am using the latest tag on an EKS cluster but it seems that the labels matching is being completely ingnored, any pod is matching the last podpreset. I also see that the changes in the PR you mention https://github.com/redhat-cop/podpreset-webhook/pull/3 doesn't seem to be present in master... thanks for your support

tjabodog commented 2 years ago

@danopia The #3 patch did fix this issue. However this fix have then been lost/reverted in one of the later commits.

danopia commented 2 years ago

Yes, I agree, the fix I referenced was reverted by this huge PR: https://github.com/redhat-cop/podpreset-webhook/pull/11

I've never actually used this project so I'll be unsubscribing from this thread. Apologies

konman1989 commented 2 years ago

@sabre1041 @mathianasj any plans to fix this?