cloudfoundry-incubator / eirinix

Extensions Library for Cloud Foundry Eirini
Apache License 2.0
2 stars 5 forks source link

Allow matching any namespace #45

Closed jimmykarily closed 4 years ago

jimmykarily commented 4 years ago

The problem

eirinix is assuming the created webhook will always monitor only one namespace even when no matching labels are defined: https://github.com/cloudfoundry-incubator/eirinix/blob/master/webhook.go#L111

Currently eirini (core) will deploy applications on a default namespace unless a namespace is defined in the request to the opi. In the latter case (when a namespace is specified in the request), Eirini will deploy the application there. That means Eirini can deploy apps in multiple namespaces. Any webhook mutating eirini app pods should be able to monitor any namespace for eirini apps.

Suggested change

If no matching label is defined, eirinix should create a webhook that listens on any namespace. It should still be possible to filter on labels on the pods (in order to filter out and pods that are not eirini apps).

If a namespace label is defined, the webhook should only listen for pods on the matching namespaces.