Search code examples
amqpeclipse-honoeclipse-iot

Integrating Hono and Enmasse


I am trying to deploy hono with enmasse. For this, I already installed enmasse and created address spaces and addresses following this repository.

As described in hono-doc on artifacthub. First I created a secret.

my_secret.yaml

apiVersion: v1
kind: Secret
metadata:
  name: mysecret
stringData:
  amqp-credentials.properties: |
    username: hono
    password: HONO

and applied it into the hono-namespace:

kubectl apply -f ./hono/my_secret.yaml -n hono

After that, I created my own values.yaml file to overwrite the hono default values, as described in "Integrating with an existing AMQP Messaging Network".

my_values.yaml

amqpMessagingNetworkExample:
  enabled: false

adapters:
  extraSecretMounts:
  - amqpNetwork:
      secretName: "mysecret"
      mountPath: "/etc/custom"

  amqpMessagingNetworkSpec:
    host: messaging-5355a0a.enmasse-infra
    port: 5672
    credentialsPath: /etc/custom/amqp-credentials.properties

  commandAndControlSpec:
    host: messaging-5355a0a.enmasse-infra
    port: 5672
    credentialsPath: /etc/custom/amqp-credentials.properties

  amqp:
    enabled: false

deviceRegistryExample:
  enabled: true
  type: mongodb
  addExampleData: false

mongodb:
  createInstance: true

grafana:
  enabled: false

prometheus:
  createInstance: false

At least I installed hono with:

helm install -n hono -f ./hono/my_values.yaml c2e eclipse-iot/hono

But unfortunately, I get errors and pods do not run well, In particular I get these errors from all pods, that try to connect to the enmasse-Amqp network:

  1. Mount-Error: Secret file "amqp-credentials.properties" is not getting mounted: The pod's logfiles says "No such a file or directory":

10:47:45.645 [vert.x-eventloop-thread-0] WARN o.e.h.config.ClientConfigProperties - could not load client credentials for [messaging-5355a0a.enmasse-infra:5672, role: Command & Control] from file [/etc/custom/amqp-credentials.properties] java.io.FileNotFoundException: /etc/custom/amqp-credentials.properties (No such file or directory)

  1. Wrong AMQP connection: For some reason, all pods try to connect to enmasse through "amqps" even though I am explicitly saying they should use "amqp" through port number and not providing crt-keys! Am I wrong?

What am I doing wrong here?

Also, that would be great if someone could provide an exemplary "Hono+Enmasse" integration repository.

Thanks


Solution

  • You cannot specify extra secret mounts at the adapters level. You need to specify the extraSecretMounts property for each adapter individually, e.g. for the HTTP and MQTT adapter:

    adapters:
      http:
        extraSecretMounts:
          amqpNetwork:
            secretName: "mysecret"
            mountPath: "/etc/custom"
      mqtt:
        extraSecretMounts:
          amqpNetwork:
            secretName: "mysecret"
            mountPath: "/etc/custom"
    

    Also note that extraSecretMounts value is not an array but an object, i.e. there must not be a - character before the amqpNetwork property.