Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Annotation to choose which rabbitmq-operator manages instance #699

Open
james-callahan opened this issue May 21, 2021 · 11 comments
Open

Annotation to choose which rabbitmq-operator manages instance #699

james-callahan opened this issue May 21, 2021 · 11 comments
Labels
design-doc-needed Design doc required before implementation never-stale Issue or PR marked to never go stale

Comments

@james-callahan
Copy link

Is your feature request related to a problem? Please describe.
To be able to run more than one instance of the rabbitmq operator in a cluster, we'd like a way to specify which rabbitmq-operator should act on a given Cluster manifest

Describe the solution you'd like
Add an environment variable to the operator, e.g. OPERATOR_NAME which is checked against a RabbitmqCluster annotation such as rabbitmq.com/cluster-operator/name.

Additional context
The proposed solution is similar to how you can have multiple ingresses in a given cluster selected by kubernetes.io/ingress.class

@ChunyiLyu
Copy link
Contributor

ChunyiLyu commented May 21, 2021

@james-callahan Thanks for using cluster operator 😸

This is an interesting idea and can certainly be done with the operator. I would like to understand what specific use case it could enable for you. With the example of multiple ingress controllers, they are functionally different and I can see why it's necessary for certain environments. For cluster operators, later versions only add features and never remove any feature support. Could you explain more your needs for such this feature request?

On the other hand, if you wish to have multiple operators in your k8s clusters each managing a set of rabbits, you can do that today with namespacing the cluster operator by setting the environment variable OPERATOR_SCOPE_NAMESPACE on the operator deployment. For like:

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: rabbitmq-cluster-operator
  namespace: rabbitmq-system
spec:
  template:
...
    spec:
      containers:
      - command:
        - /manager
        env:
        - name: OPERATOR_SCOPE_NAMESPACE
           value: <a-specific-namespace-for-this-operator>
        image: rabbitmqoperator/cluster-operator:1.7.0
        name: operator
...

This will make the operator only watch for rabbit clusters in one namespace and you could have multiple operators deployed in different namespaces. They will only manage rabbit clusters created in namespace <a-specific-namespace-for-this-operator>.

@github-actions
Copy link

This issue has been marked as stale due to 60 days of inactivity. Stale issues will be closed after a further 30 days of inactivity; please remove the stale label in order to prevent this occurring.

@github-actions github-actions bot added the stale Issue or PR with long period of inactivity label Jul 21, 2021
@james-callahan
Copy link
Author

For cluster operators, later versions only add features and never remove any feature support. Could you explain more your needs for such this feature request?

e.g. testing a new version of the operator without shutting down the old operator.

@Zerpet Zerpet removed the stale Issue or PR with long period of inactivity label Aug 16, 2021
@ChunyiLyu
Copy link
Contributor

@james-callahan I see. With your use case I think setting the environment variable OPERATOR_SCOPE_NAMESPACE should work for you. Could you give it a go and let us know? Meanwhile, I will add documentation about this feature in rabbitmq.com.

@james-callahan
Copy link
Author

@james-callahan I see. With your use case I think setting the environment variable OPERATOR_SCOPE_NAMESPACE should work for you. Could you give it a go and let us know? Meanwhile, I will add documentation about this feature in rabbitmq.com.

That's not sufficient: e.g.

  • the (old) operator is running in cluster-wide mode
  • the (new) operator runs with OPERATOR_SCOPE_NAMESPACE
    ==> both operators would be fighting over the resources in OPERATOR_SCOPE_NAMESPACE.

What's needed is a way to opt specific rabbitmq instances into an operator (via some field or an annotation)

@mkuratczyk mkuratczyk added design-doc-needed Design doc required before implementation never-stale Issue or PR marked to never go stale labels Oct 1, 2021
@durairajasivam
Copy link

@james-callahan, I see. With your use case, I think setting the environment variable OPERATOR_SCOPE_NAMESPACE should work for you. Could you give it a go and let us know? Meanwhile, I will add documentation about this feature in rabbitmq.com.

Hi @ChunyiLyu Do you have the documentation for this?

I have tried OPERATOR_SCOPE_NAMESPACE, but it still conflicts with another operator running in a different namespace. I have even tried to apply the namespace for each service, role binding, role, deployment, etc., in operator, but it seems it does not help.

Appreciate your guidance on this, thanks

@tormig-softronic

This comment was marked as off-topic.

@Zerpet

This comment was marked as off-topic.

@dgshue
Copy link

dgshue commented Sep 26, 2023

I'm attempting to do the same thing here - multiple clusters in different namespaces (dev, val, prd). I'm struggling to understand what the deployments should look like for each namespace and like wise for the operator itself, any hints would be greatly appreciated

@durairajasivam
Copy link

durairajasivam commented Sep 26, 2023

I'm attempting to do the same thing here - multiple clusters in different namespaces (dev, val, prd). I'm struggling to understand what the deployments should look like for each namespace and like wise for the operator itself, any hints would be greatly appreciated

Hi dgshue,

  1. Create the CRD and the associated Operator.
  2. The Operator will run in the rabbitmq-system namespace. By default, it will oversee all your RabbitMQ clusters across different namespaces.
  3. Once the rabbitmq-cluster-operator is operational, you can initiate your RabbitMQ cluster. To do this, apply the deployment using the RabbitmqCluster kind for each respective namespace.

I hope this helpsl.

@dgshue
Copy link

dgshue commented Sep 26, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design-doc-needed Design doc required before implementation never-stale Issue or PR marked to never go stale
Projects
None yet
Development

No branches or pull requests

7 participants