admission-control icon indicating copy to clipboard operation
admission-control copied to clipboard

[feature] InjectPodAnnotations

Open elithrar opened this issue 4 years ago • 2 comments

Provide a way to inject annotations into a Pod on admission:

  • [ ] Accept a map[string]func(*corev1.Pod) string argument so that the user can build names based on the Pod attributes (ObjectMeta, PodSpec, etc)
  • [ ] Use https://github.com/evanphx/json-patch for testing: take a Pod, serialize, apply the patch, and deserialize again to verify the injected annotations were applied.
  • [ ] Add a sample MutatingWebhookConfiguration to demonstrate usage.

Alternatively we could just provide a metav1.ObjectMeta to the user/caller, which might be sufficient for any dynamic annotation generation & more stable (w.r.t. API changes).

elithrar avatar Aug 01 '19 23:08 elithrar

Hello there! I looked at your repository and it's really well managed ! I am looking for a way to make a MutatingWebhook but I cannot manage to make it work. Will you add an example in a near future ? Thanks for advance

thibaultserti avatar Jun 28 '21 06:06 thibaultserti

In fact I managed to make something convenient. I'll try to post an example in the following days.

thibaultserti avatar Jul 01 '21 19:07 thibaultserti