artemiscloud / activemq-artemis-operator

Apache License 2.0
64 stars 62 forks source link

Unable to create address/queue using ActiveMQArtemisAddress #126

Closed georgesberscheid closed 1 year ago

georgesberscheid commented 2 years ago

Describe the bug I got the operator running and a cluster of 3 brokers that look fine. I also enabled the console and can access it through an ingress. I'm now trying to deploy a queue using a ActiveMQArtemisAddress resource, but nothing appears in the broker logs and the queue doesn't show up in the console.

Bonus question: how do I join the Slack chatroom https://artemiscloudio.slack.com? Looks like I need an invitation ;-)

Here is the definition of the broker:

apiVersion: broker.amq.io/v2alpha5
kind: ActiveMQArtemis
metadata:
  name: artemis-dev
spec:
  acceptors:
    - name: default
      expose: true
      port: 61616
      anycastPrefix: jms.queue.
      multicastPrefix: jms.topic.
  deploymentPlan:
    size: 3
    clustered: true
    image: placeholder
    journalType: aio
    persistenceEnabled: true
    messageMigration: true
    resources:
      limits:
        memory: "512Mi"
      requests:
        memory: "256Mi"
  addressSettings:
    applyRule: merge_all
    addressSetting:
    - match: '#'
      autoCreateDeadLetterResources: false
      autoCreateAddresses: false
      autoCreateExpiryResources: false
      autoCreateQueues: false
      autoDeleteAddresses: false
      autoDeleteQueues: false
      deadLetterAddress: jms.queue.DLQ
      expiryAddress: jms.queue.ExpiryQueue
      maxDeliveryAttempts: 1500
      redeliveryDelay: 60000
      addressFullPolicy: PAGE
      messageCounterHistoryDayLimit: 10

To Reproduce Create testqueue.yaml:

apiVersion: broker.amq.io/v2alpha3
kind: ActiveMQArtemisAddress
metadata:
  name: testqueue
spec:
  addressName: testQueue
  queueName: testQueue
  routingType: anycast
  removeFromBrokerOnDelete: true

Deploy the file:

$ kubectl apply -f testqueue.yaml
activemqartemisaddress.broker.amq.io/testqueue created

Nothing happens. I also tried restarting the broker instances but that didn't help either.

The resource is properly created though:

$ kubectl describe ActiveMQArtemisAddress testqueue
Name:         testqueue
Namespace:    artemis-operator
Labels:       <none>
Annotations:  <none>
API Version:  broker.amq.io/v2alpha3
Kind:         ActiveMQArtemisAddress
Metadata:
  Creation Timestamp:  2022-01-13T08:24:55Z
  Generation:          1
  Resource Version:    442502760
  Self Link:           /apis/broker.amq.io/v2alpha3/namespaces/artemis-operator/activemqartemisaddresses/testqueue
  UID:                 31cc4855-9740-4143-9b51-e01669f07291
Spec:
  Address Name:                  testQueue
  Queue Name:                    testQueue
  Remove From Broker On Delete:  true
  Routing Type:                  anycast
Events:                          <none>

Looking at the logs from the operator, it seems that it tries to create something though:

2022-01-13T10:14:17.744Z        INFO    controller_v2alpha3activemqartemisaddress       Reconciling ActiveMQArtemisAddress                                                                                                                  {"Request.Namespace": "artemis-operator", "Request.Name": "testqueue"}
2022-01-13T10:14:17.744Z        INFO    controller_v2alpha3activemqartemisaddress       Created ss name builder for addr                                                                                                                    {"instance": {"kind":"ActiveMQArtemisAddress","apiVersion":"broker.amq.io/v2alpha3","metadata":{"name":"testqueue","namespace":"artemis-operator","selfLink":"/apis/broker.amq.io/v2alpha3/namespaces/artemis-operator/activemqartemisaddresses/testqueue","uid":"8b308897-a2a3-4cf5-b531-c70f8712d436","resourceVersion":"442554229","generation":1,"creationTimestamp":"2022-01-13T10:14:17Z","annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"broker.amq.io/v2alpha3\",\"kind\":\"ActiveMQArtemisAddress\",\"metadata\":{\"annotations\":{},\"name\":\"testqueue\",\"namespace\":\"artemis-operator\"},\"spec\":{\"addressName\":\"testQueue\",\"queueName\":\"testQueue\",\"removeFromBrokerOnDelete\":true,\"routingType\":\"anycast\"}}\n"}},"spec":{"addressName":"testQueue","queueName":"testQueue","routingType":"anycast","removeFromBrokerOnDelete":true},"status":{}}, "builders": null}
2022-01-13T10:14:17.744Z        INFO    controller_v2alpha3activemqartemisaddress       Creating ActiveMQArtemisAddress                                                                                                                     {"Request.Namespace": "artemis-operator", "Request.Name": "testqueue"}
2022-01-13T10:14:17.744Z        INFO    controller_v2alpha3activemqartemisaddress       Getting Pod Brokers     {"Request.Namespace": "artemis-operator", "Request.Name": "testqueue", "instance": {"AddressResource":{"kind":"ActiveMQArtemisAddress","apiVersion":"broker.amq.io/v2alpha3","metadata":{"name":"testqueue","namespace":"artemis-operator","selfLink":"/apis/broker.amq.io/v2alpha3/namespaces/artemis-operator/activemqartemisaddresses/testqueue","uid":"8b308897-a2a3-4cf5-b531-c70f8712d436","resourceVersion":"442554229","generation":1,"creationTimestamp":"2022-01-13T10:14:17Z","annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"broker.amq.io/v2alpha3\",\"kind\":\"ActiveMQArtemisAddress\",\"metadata\":{\"annotations\":{},\"name\":\"testqueue\",\"namespace\":\"artemis-operator\"},\"spec\":{\"addressName\":\"testQueue\",\"queueName\":\"testQueue\",\"removeFromBrokerOnDelete\":true,\"routingType\":\"anycast\"}}\n"}},"spec":{"addressName":"testQueue","queueName":"testQueue","routingType":"anycast","removeFromBrokerOnDelete":true},"status":{}},"SsTargetNameBuilders":null}}
2022-01-13T10:14:17.744Z        INFO    controller_v2alpha3activemqartemisaddress       target Cr names {"result": null}
2022-01-13T10:14:17.744Z        INFO    controller_v2alpha3activemqartemisaddress       got taget ssNames from broker controller                                                                                                            {"ssNames": [{"Namespace":"artemis-operator","Name":"artemis-dev-ss"}]}
2022-01-13T10:14:17.744Z        INFO    controller_v2alpha3activemqartemisaddress       Now retrieve ss {"order": 0, "ssName": "artemis-operator/artemis-dev-ss"}
2022-01-13T10:14:17.744Z        INFO    package statefulsets    Retrieving StatefulSet artemis-dev-ss   {"ActiveMQArtemis Name": "artemis-dev-ss"}
2022-01-13T10:14:17.744Z        INFO    controller_v2alpha3activemqartemisaddress       Statefulset: artemis-dev-ss found                                                                                                                   {"Request.Namespace": "artemis-operator", "Request.Name": "testqueue"}
2022-01-13T10:14:17.744Z        INFO    controller_v2alpha3activemqartemisaddress       finding pods in ss      {"replicas": 3}
2022-01-13T10:14:17.744Z        INFO    controller_v2alpha3activemqartemisaddress       Trying finding pod artemis-dev-ss-0
2022-01-13T10:14:17.744Z        INFO    controller_v2alpha3activemqartemisaddress       Pod found       {"Request.Namespace": "artemis-operator", "Request.Name": "testqueue", "Namespace": "artemis-operator", "Name": "testqueue"}
2022-01-13T10:14:17.744Z        INFO    package k8s_actions     Retrieving *v1.Secret   {"ActiveMQArtemis Name": "testqueue-jolokia-secret"}
2022-01-13T10:14:17.744Z        INFO    package k8s_actions     *v1.Secret IsNotFound   {"ActiveMQArtemis Name": "testqueue-jolokia-secret", "Namespace": "artemis-operator", "Name": "testqueue-jolokia-secret"}
2022-01-13T10:14:17.744Z        INFO    package secrets No secret found {"name": "testqueue-jolokia-secret"}
2022-01-13T10:14:17.744Z        INFO    package k8s_actions     Retrieving *v1.Secret   {"ActiveMQArtemis Name": "artemis-dev-credentials-secret"}
2022-01-13T10:14:17.744Z        INFO    package k8s_actions     Retrieving *v1.Secret   {"ActiveMQArtemis Name": "artemis-dev-credentials-secret"}
2022-01-13T10:14:17.744Z        INFO    controller_v2alpha3activemqartemisaddress       New Jolokia with        {"Request.Namespace": "artemis-operator", "Request.Name": "testqueue", "User: ": "EnreeH47", "Protocol: ": "http"}
2022-01-13T10:14:17.744Z        INFO    controller_v2alpha3activemqartemisaddress       Trying finding pod artemis-dev-ss-1
2022-01-13T10:14:17.744Z        INFO    controller_v2alpha3activemqartemisaddress       Pod found       {"Request.Namespace": "artemis-operator", "Request.Name": "testqueue", "Namespace": "artemis-operator", "Name": "testqueue"}
2022-01-13T10:14:17.744Z        INFO    package k8s_actions     Retrieving *v1.Secret   {"ActiveMQArtemis Name": "testqueue-jolokia-secret"}
2022-01-13T10:14:17.744Z        INFO    package k8s_actions     *v1.Secret IsNotFound   {"ActiveMQArtemis Name": "testqueue-jolokia-secret", "Namespace": "artemis-operator", "Name": "testqueue-jolokia-secret"}
2022-01-13T10:14:17.744Z        INFO    package secrets No secret found {"name": "testqueue-jolokia-secret"}
2022-01-13T10:14:17.744Z        INFO    package k8s_actions     Retrieving *v1.Secret   {"ActiveMQArtemis Name": "artemis-dev-credentials-secret"}
2022-01-13T10:14:17.744Z        INFO    package k8s_actions     Retrieving *v1.Secret   {"ActiveMQArtemis Name": "artemis-dev-credentials-secret"}
2022-01-13T10:14:17.744Z        INFO    controller_v2alpha3activemqartemisaddress       New Jolokia with        {"Request.Namespace": "artemis-operator", "Request.Name": "testqueue", "User: ": "EnreeH47", "Protocol: ": "http"}
2022-01-13T10:14:17.744Z        INFO    controller_v2alpha3activemqartemisaddress       Trying finding pod artemis-dev-ss-2
2022-01-13T10:14:17.744Z        INFO    controller_v2alpha3activemqartemisaddress       Pod found       {"Request.Namespace": "artemis-operator", "Request.Name": "testqueue", "Namespace": "artemis-operator", "Name": "testqueue"}
2022-01-13T10:14:17.744Z        INFO    package k8s_actions     Retrieving *v1.Secret   {"ActiveMQArtemis Name": "testqueue-jolokia-secret"}
2022-01-13T10:14:17.744Z        INFO    package k8s_actions     *v1.Secret IsNotFound   {"ActiveMQArtemis Name": "testqueue-jolokia-secret", "Namespace": "artemis-operator", "Name": "testqueue-jolokia-secret"}
2022-01-13T10:14:17.744Z        INFO    package secrets No secret found {"name": "testqueue-jolokia-secret"}
2022-01-13T10:14:17.744Z        INFO    package k8s_actions     Retrieving *v1.Secret   {"ActiveMQArtemis Name": "artemis-dev-credentials-secret"}
2022-01-13T10:14:17.744Z        INFO    package k8s_actions     Retrieving *v1.Secret   {"ActiveMQArtemis Name": "artemis-dev-credentials-secret"}
2022-01-13T10:14:17.744Z        INFO    controller_v2alpha3activemqartemisaddress       New Jolokia with        {"Request.Namespace": "artemis-operator", "Request.Name": "testqueue", "User: ": "EnreeH47", "Protocol: ": "http"}
2022-01-13T10:14:17.744Z        INFO    controller_v2alpha3activemqartemisaddress       Finally we gathered some mgmt arry                                                                                                                  {"size": 3}
2022-01-13T10:14:17.744Z        INFO    controller_v2alpha3activemqartemisaddress       Queue name is not empty so create queue                                                                                                             {"name": "testQueue"}
2022-01-13T10:14:17.761Z        INFO    controller_v2alpha3activemqartemisaddress       Created ActiveMQArtemisAddress for testQueue
2022-01-13T10:14:17.761Z        INFO    controller_v2alpha3activemqartemisaddress       Queue name is not empty so create queue                                                                                                             {"name": "testQueue"}
2022-01-13T10:14:17.776Z        INFO    controller_v2alpha3activemqartemisaddress       Created ActiveMQArtemisAddress for testQueue
2022-01-13T10:14:17.776Z        INFO    controller_v2alpha3activemqartemisaddress       Queue name is not empty so create queue                                                                                                             {"name": "testQueue"}
2022-01-13T10:14:17.821Z        INFO    controller_v2alpha3activemqartemisaddress       Created ActiveMQArtemisAddress for testQueue
2022-01-13T10:14:17.821Z        DEBUG   kubebuilder.controller  Successfully Reconciled {"controller": "v2alpha3activemqartemisaddress-controller", "request": "artemis-operator/testqueue"}

Platform (please complete the following information):

Expected behavior The address & queue are created and visible in the console and can be used by the application.

Actual behavior Nothing happens. The address and queue are not created and cannot be used by an application.

Addtional context I have a JBoss EAP instance pointed to the Artemis instance which throws the following exception:

2022-01-13T09:30:13.115+01:00   ERROR   AMQ154003: Unable to reconnect org.apache.activemq.artemis.ra.inflow.ActiveMQActivationSpec(ra=org.wildfly.extension.messaging.activemq.ActiveMQResourceAdapter@81404b83 destination=java:global/remoteContext/testQueue destinationType=javax.jms.Queue ack=Auto-acknowledge durable=false clientID=null user=null maxSession=15) : ActiveMQNonExistentQueueException[errorType=QUEUE_DOES_NOT_EXIST message=AMQ229017: Queue testQueue does not exist]
        at org.apache.activemq.artemis@2.9.0.redhat-00019//org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:464)
        at org.apache.activemq.artemis@2.9.0.redhat-00019//org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:358)
        at org.apache.activemq.artemis@2.9.0.redhat-00019//org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQSessionContext.createConsumer(ActiveMQSessionContext.java:394)
        at org.apache.activemq.artemis@2.9.0.redhat-00019//org.apache.activemq.artemis.core.client.impl.ClientSessionImpl.internalCreateConsumer(ClientSessionImpl.java:1963)
        at org.apache.activemq.artemis@2.9.0.redhat-00019//org.apache.activemq.artemis.core.client.impl.ClientSessionImpl.createConsumer(ClientSessionImpl.java:859)
        at org.apache.activemq.artemis@2.9.0.redhat-00019//org.apache.activemq.artemis.core.client.impl.ClientSessionImpl.createConsumer(ClientSessionImpl.java:839)
        at org.apache.activemq.artemis@2.9.0.redhat-00019//org.apache.activemq.artemis.core.client.impl.ClientSessionImpl.createConsumer(ClientSessionImpl.java:782)
        at org.apache.activemq.artemis.ra@2.9.0.redhat-00019//org.apache.activemq.artemis.ra.inflow.ActiveMQMessageHandler.setup(ActiveMQMessageHandler.java:175)
        at org.apache.activemq.artemis.ra@2.9.0.redhat-00019//org.apache.activemq.artemis.ra.inflow.ActiveMQActivation.setup(ActiveMQActivation.java:318)
        at org.apache.activemq.artemis.ra@2.9.0.redhat-00019//org.apache.activemq.artemis.ra.inflow.ActiveMQActivation.reconnect(ActiveMQActivation.java:726)
        at org.apache.activemq.artemis.ra@2.9.0.redhat-00019//org.apache.activemq.artemis.ra.inflow.ActiveMQActivation$ReconnectWork.run(ActiveMQActivation.java:794)
        at org.wildfly.extension.messaging-activemq//org.wildfly.extension.messaging.activemq.ActiveMQResourceAdapter$WorkWrapper.run(ActiveMQResourceAdapter.java:171)
        at org.jboss.ironjacamar.impl@1.4.33.Final-redhat-00001//org.jboss.jca.core.workmanager.WorkWrapper.runWork(WorkWrapper.java:445)
        at org.jboss.as.connector@7.3.8.GA-redhat-00001//org.jboss.as.connector.services.workmanager.WildflyWorkWrapper.runWork(WildflyWorkWrapper.java:69)
        at org.jboss.ironjacamar.impl@1.4.33.Final-redhat-00001//org.jboss.jca.core.workmanager.WorkWrapper.run(WorkWrapper.java:223)
        at org.jboss.threads@2.3.3.Final-redhat-00001//org.jboss.threads.SimpleDirectExecutor.execute(SimpleDirectExecutor.java:29)
        at org.jboss.threads@2.3.3.Final-redhat-00001//org.jboss.threads.QueueExecutor.runTask(QueueExecutor.java:789)
        at org.jboss.threads@2.3.3.Final-redhat-00001//org.jboss.threads.QueueExecutor.access$100(QueueExecutor.java:44)
        at org.jboss.threads@2.3.3.Final-redhat-00001//org.jboss.threads.QueueExecutor$Worker.run(QueueExecutor.java:809)
        at java.base/java.lang.Thread.run(Unknown Source)
        at org.jboss.threads@2.3.3.Final-redhat-00001//org.jboss.threads.JBossThread.run(JBossThread.java:485)
georgesberscheid commented 2 years ago

Update: it works if I set autoCreateAddresses and autoCreateQueues to true in the broker configuration. According to the documentation this is used to automatically create addresses and queues when a client connects, which is what I wanted to prevent from happening. I only want addresses and queues that have explicitly been defined using ActiveMQArtemisAddress.

brusdev commented 1 year ago

Are you able to reproduce this issue using the latest version of the operator?

brusdev commented 1 year ago

This issue has been closed because it has not been updated in the last 6 months. Feel free to reopen it if it is still valid.