kedacore / keda-olm-operator

Operator for deploying KEDA Controller on OperatorHub.io/OLM
Apache License 2.0
31 stars 23 forks source link

Use installed namespace if WATCH_NAMESPACE not set #204

Closed joelsmith closed 1 year ago

joelsmith commented 1 year ago

In #192 there was an attempt to change the CSV to change the installMode from OwnNamepsace to AllNamespaces, but that change was lost during the next bundle re-generation. This PR re-makes that change in both the config and the bundle, but allows the operator to be installed in either mode. This provides flexibility allowing the operator to be installed into existing namespaces, potentially with other operators present, where the OperatorGroup is already present and annotated to require one or the other.

With the installMode AllNamespaces, WATCH_NAMESPACE may not be set especially in cases where the operator is installed to an existing namespace with an existing operatorgroup. This change allows the KEDA OLM operator to work whether it is run with a WATCH_NAMESPACE env var or not.

Checklist

joelsmith commented 1 year ago

On hold pending discussion

Edit: discussed with my team and we're thinking that it would be nice to support both install modes even though the mode won't affect the operator's behavior. The advantage of supporting both is flexibility in being able to be installed in a namespace already configured for AllNamespaces. For example, on OpenShift, we recommend installing in the openshift-keda namespace, but on some OpenShift versions like Red Hat OpenShift on AWS (ROSA), the cluster admin isn't allowed to create that namespace, but could install to the openshift-operators namespace, except for the fact that it requires the AllNamespaces install mode. So that's why this PR exists -- to make it work in both scenarios.