You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This project looks like a great fit for the project my team is working on, but there are some things we only know at the time the mutation is being applied, more specifically the pod's name and namespace.
Now, I understand that there is a templating feature, but it doesn't seem to work for this:
It passes on a new pod object that only carries the original's Service Account and Annotations, but not the rest of the object (such as .ObjectMeta.Name and .ObjectMeta.Namespace.
Is there a particular reason not to pass the entire Pod that is already received on the admission review request?
It looks like the pod's .metadata may still not be fully available depending on the order webhooks are called, including the name and namespace.
I believe we can make the namespace available from the request's field. For our particular case we'll replace the pod's name with the Service Account's name, which is already accessible via templating, and all should be good once we can use the namespace as well.
To summarize the proposed fix:
get the namespace from the request, insert it into the pod
pass the pod as parameter to RenderTemplate, making all information contained therein available to the template (instead of generating a new pod with the annotations and Service Account only)
We're more than willing to contribute with this fix if you agree with it, let us know your thoughts :-)
Hey folks, thanks for the work!
This project looks like a great fit for the project my team is working on, but there are some things we only know at the time the mutation is being applied, more specifically the pod's name and namespace.
Now, I understand that there is a templating feature, but it doesn't seem to work for this:
Looking around the code it seems this is the culprit:
generic-sidecar-injector/pkg/injectionwebhook/webhook.go
Lines 125 to 132 in 3a3c5d3
It passes on a new pod object that only carries the original's Service Account and Annotations, but not the rest of the object (such as
.ObjectMeta.Name
and.ObjectMeta.Namespace
.Is there a particular reason not to pass the entire Pod that is already received on the admission review request?
The text was updated successfully, but these errors were encountered: