operator-framework / kubectl-operator

Manage Kubernetes Operators from the command line
https://operatorframework.io/
Apache License 2.0
128 stars 37 forks source link

install: improve detection for desired install mode when creating operator group #54

Closed joelanford closed 2 years ago

joelanford commented 3 years ago

See https://github.com/operator-framework/kubectl-operator/issues/50#issuecomment-906016499

We basically need a set intersection of:

  • The install modes supported by operator (note we only know the supported install modes of the channel heads)
  • The install modes compatible with the namespaces from the --watch flag.
  • The install modes compatible with the namespaces watched by the existing OperatorGroup, if it exists.

After the result of that set intersection, we could use a precedence order of:

  1. AllNamespaces
  2. OwnNamespace
  3. SingleNamespace
  4. MultiNamespaces

Note that in reality, the only time we'll actually have more than one choice is if:

  • the operator supports at least AllNamespaces and OwnNamespace
  • the watch flag is unset
  • there is no existing operator group

In that case, we would choose AllNamespaces.

SingleNamespace is only an option when --watch is explicitly set to single namespace that is different than the install namespace or an existing OperatorGroup specifies a different namespace.

MultiNamespaces is only an option when --watch is explicitly set to multiple namespaces or an existing OperatorGroup specifies multiples namespaces.

Signed-off-by: Joe Lanford joe.lanford@gmail.com

openshift-ci[bot] commented 3 years ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: joelanford

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/operator-framework/kubectl-operator/blob/main/OWNERS)~~ [joelanford] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
perdasilva commented 2 years ago

/lgtm