整合 Hono 和 Enmasse

问题描述

我正在尝试使用 enmasse 部署 hono。为此,我已经安装了 enmasse 并在此 repository 之后创建了地址空间和地址。

如 artifacthub 上的 hono-doc 所述。首先我创建了一个秘密。

my_secret.yaml

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

并将其应用到 hono-namespace 中:

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

之后,我创建了自己的 values.yaml 文件来覆盖 hono 认值, 如"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

至少我安装了 hono:

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

但不幸的是,我收到错误并且 pod 运行不佳,特别是我从所有尝试连接到 enmasse-Amqp 网络的 pod 中得到这些错误

  1. 挂载错误:未挂载机密文件“amqp-credentials.properties”: pod 的日志文件显示“没有这样的文件或目录”:

10:47:45.645 [vert.x-eventloop-thread-0] 警告 o.e.h.config.ClientConfigProperties - 无法加载客户端 [messaging-5355a0a.enmasse-infra:5672 的凭据,角色:Command & 控制] 来自文件 [/etc/custom/amqp-credentials.properties] java.io.FileNotFoundException: /etc/custom/amqp-credentials.properties (没有那个文件或目录)

  1. 错误的 AMQP 连接:出于某种原因,即使我明确说它们应该通过端口号使用“amqp”而不提供 crt-keys,所有 pod 都尝试通过“amqps”连接到 enmasse !我错了吗?

在这里做错了什么?

此外,如果有人可以提供一个示例性的“Hono+Enmasse”集成存储库,那就太好了。

谢谢

解决方法

您不能在 adapters 级别指定额外的秘密装载。您需要为 每个 适配器单独指定 extraSecretMounts 属性,例如对于 HTTP 和 MQTT 适配器:

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

另请注意,extraSecretMounts 值不是数组而是对象,即 - 属性前不能有 amqpNetwork 字符。