emqx / emqx-operator

A Kubernetes Operator for EMQX
https://www.emqx.com
Apache License 2.0
203 stars 64 forks source link

EMQX operator is parsing config into garbage value #1009

Closed shailesh-bear closed 5 months ago

shailesh-bear commented 5 months ago

Describe the bug

To Reproduce

Set EMQX config as:

  config: |-
    mqtt {
      peer_cert_as_username = "cn"
      max_packet_size = 2MB
    }

The following Kubernetes config emqx-cluster-configs is created as:

mqtt:{peer_cert_as_username:cn, max_packet_size:2""MB} Note how the max packet size is rendered above as 2""MB

EMQX node logs:

ERROR: call_hocon_failed: -s emqx_conf_schema -c /opt/emqx/etc/emqx.conf multi_get node.data_dir node.name node.cookie node.db_backend cluster.proto_dist node.dist_net_ticktime
2024-01-29 18:34:46.628 HKT
[error]: {parse_error,#{file => "/opt/emqx/etc/emqx.conf",line => 1,reason => "syntax error before: \"\""}}
2024-01-29 18:34:46.628 HKT
{}
2024-01-29 18:34:48.614 HKT
ERROR: call_hocon_failed: -s emqx_conf_schema -c /opt/emqx/etc/emqx.conf multi_get node.data_dir node.name node.cookie node.db_backend cluster.proto_dist node.dist_net_ticktime
2024-01-29 18:34:59.992 HKT
[error]: {parse_error,#{file => "/opt/emqx/etc/emqx.conf",line => 1,reason => "syntax error before: \"\""}}
2024-01-29 18:34:59.992 HKT
{}

Expected behavior EMQX config should be correctly set and EMQX should run.

Anything else we need to know?: Cannot be reproduced with 2.2.3

Environment details::

Rory-Z commented 5 months ago

Hi @shailesh-bear I think max_packet_size = "2MB" will be work, like this:

apiVersion: apps.emqx.io/v2beta1
kind: EMQX
metadata:
  name: emqx
spec:
  image: emqx:5
  config:
    data: |-
      mqtt {
        peer_cert_as_username = "cn"
        max_packet_size = "2MB"
      }
shailesh-bear commented 5 months ago

@Rory-Z Yes that worked! Thanks