phenixblue / imageswap-webhook

Image Swap Mutating Admission Webhook for Kubernetes
Apache License 2.0
154 stars 53 forks source link

Record original image in annotation #45

Open phenixblue opened 3 years ago

phenixblue commented 3 years ago

What would you like to be added:

The ImageSwap webhook should record the original image reference within an annotation if a swap occurs.

Why is this needed:

This will give a historic record of image swaps per resource for troubleshooting purposes.

This will need to account for multiple containers/init-containers within a pod

Maybe a json based list within an annotation value.

Example:

annotations:
  imageswap-webhook-swaps: ["image1", "image2", "image3"]
ilrudie commented 3 years ago

Would it make sense to record the full detail of the swap?

annotations:
  imageswap-webhook-swaps: [{"original": "image1", "swap": "my.example.com/mirror-docker.io/image1"}, {"original": "quay.io/image2", "swap": "my.example.com/mirror-quay.io/image2"}]
phenixblue commented 3 years ago

I was originally thinking of just recording the original image since the current resource should show what the image was swapped to, but it's simple enough, we should be able to do both.