Procházet zdrojové kódy

Merge remote-tracking branch 'origin/release-50' into 0202-merge-release-50-back-to-master

Zaiming (Stone) Shi před 3 roky
rodič
revize
ccb0c7ebaa

+ 7 - 7
.github/workflows/run_relup_tests.yaml

@@ -4,13 +4,13 @@ concurrency:
   group: relup-${{ github.event_name }}-${{ github.ref }}
   cancel-in-progress: true
 
-on:
-  push:
-    branches:
-      - '**'
-    tags:
-      - e*
-  pull_request:
+# on:
+#   push:
+#     branches:
+#       - '**'
+#     tags:
+#       - e*
+#   pull_request:
 
 jobs:
   relup_test_plan:

+ 1 - 1
apps/emqx_dashboard/src/emqx_dashboard_api.erl

@@ -325,7 +325,7 @@ is_self_auth_token(Username, Token) ->
     end.
 
 change_pwd(post, #{bindings := #{username := Username}, body := Params}) ->
-    LogMeta = #{msg => "Dashboard change password", username => Username},
+    LogMeta = #{msg => "Dashboard change password", username => binary_to_list(Username)},
     OldPwd = maps:get(<<"old_pwd">>, Params),
     NewPwd = maps:get(<<"new_pwd">>, Params),
     case ?EMPTY(OldPwd) orelse ?EMPTY(NewPwd) of

+ 2 - 2
deploy/charts/emqx-enterprise/templates/configmap.yaml

@@ -16,9 +16,9 @@ data:
   EMQX_CLUSTER__K8S__SERVICE_NAME:  {{ include "emqx.fullname" . }}-headless
   EMQX_CLUSTER__K8S__NAMESPACE: {{ .Release.Namespace }}
   EMQX_CLUSTER__K8S__ADDRESS_TYPE: "hostname"
-  EMQX_CLUSTER__K8S__SUFFIX: "svc.cluster.local"
+  EMQX_CLUSTER__K8S__SUFFIX: "svc.{{ .Values.clusterDomain }}"
   {{- else if eq (.Values.emqxConfig.EMQX_CLUSTER__DISCOVERY_STRATEGY)  "dns"  }}
-  EMQX_CLUSTER__DNS__NAME: "{{  include "emqx.fullname" . }}-headless.{{ .Release.Namespace }}.svc.cluster.local"
+  EMQX_CLUSTER__DNS__NAME: "{{  include "emqx.fullname" . }}-headless.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}"
   EMQX_CLUSTER__DNS__RECORD_TYPE: "srv"
   {{- end -}}
   {{- range $index, $value := .Values.emqxConfig }}

+ 2 - 0
deploy/charts/emqx-enterprise/values.yaml

@@ -35,6 +35,8 @@ serviceAccount:
 ## Forces the recreation of pods during helm upgrades. This can be useful to update configuration values even if the container image did not change.
 recreatePods: false
 
+clusterDomain: cluster.local
+
 podAnnotations: {}
 
 # Pod deployment policy

+ 2 - 2
deploy/charts/emqx/templates/configmap.yaml

@@ -16,9 +16,9 @@ data:
   EMQX_CLUSTER__K8S__SERVICE_NAME:  {{ include "emqx.fullname" . }}-headless
   EMQX_CLUSTER__K8S__NAMESPACE: {{ .Release.Namespace }}
   EMQX_CLUSTER__K8S__ADDRESS_TYPE: "hostname"
-  EMQX_CLUSTER__K8S__SUFFIX: "svc.cluster.local"
+  EMQX_CLUSTER__K8S__SUFFIX: "svc.{{ .Values.clusterDomain }}"
   {{- else if eq (.Values.emqxConfig.EMQX_CLUSTER__DISCOVERY_STRATEGY)  "dns"  }}
-  EMQX_CLUSTER__DNS__NAME: "{{  include "emqx.fullname" . }}-headless.{{ .Release.Namespace }}.svc.cluster.local"
+  EMQX_CLUSTER__DNS__NAME: "{{  include "emqx.fullname" . }}-headless.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}"
   EMQX_CLUSTER__DNS__RECORD_TYPE: "srv"
   {{- end -}}
   {{- range $index, $value := .Values.emqxConfig }}

+ 2 - 0
deploy/charts/emqx/values.yaml

@@ -35,6 +35,8 @@ serviceAccount:
 ## Forces the recreation of pods during helm upgrades. This can be useful to update configuration values even if the container image did not change.
 recreatePods: false
 
+clusterDomain: cluster.local
+
 podAnnotations: {}
 
 # Pod deployment policy

+ 1 - 0
lib-ee/emqx_ee_conf/etc/emqx-enterprise.conf

@@ -0,0 +1 @@
+telemetry.enable = false

+ 16 - 17
scripts/merge-config.escript

@@ -30,7 +30,7 @@ main(_) ->
     case IsEnterprise of
         true ->
             EnterpriseCfgs = get_all_cfgs("lib-ee"),
-            EnterpriseConf = merge("", EnterpriseCfgs),
+            EnterpriseConf = merge(<<"">>, EnterpriseCfgs),
             ok = file:write_file("apps/emqx_conf/etc/emqx-enterprise.conf.all", EnterpriseConf);
         false ->
             ok
@@ -41,22 +41,21 @@ is_enterprise() ->
     nomatch =/= string:find(Profile, "enterprise").
 
 merge(BaseConf, Cfgs) ->
-    lists:foldl(
-        fun(CfgFile, Acc) ->
-            case filelib:is_regular(CfgFile) of
-                true ->
-                    {ok, Bin1} = file:read_file(CfgFile),
-                    case string:trim(Bin1, both) of
-                        <<>> -> Acc;
-                        Bin2 -> [Acc, io_lib:nl(), io_lib:nl(), Bin2]
-                    end;
-                false ->
-                    Acc
-            end
-        end,
-        BaseConf,
-        Cfgs
-    ).
+    Confs = [BaseConf | lists:map(fun read_conf/1, Cfgs)],
+    infix(lists:filter(fun(I) -> iolist_size(I) > 0 end, Confs), [io_lib:nl(), io_lib:nl()]).
+
+read_conf(CfgFile) ->
+    case filelib:is_regular(CfgFile) of
+        true ->
+            {ok, Bin1} = file:read_file(CfgFile),
+            string:trim(Bin1, both);
+        false ->
+            <<>>
+    end.
+
+infix([], _With) -> [];
+infix([One], _With) -> [One];
+infix([H | T], With) -> [H, With, infix(T, With)].
 
 get_all_cfgs(Root) ->
     Apps0 = filelib:wildcard("*", Root) -- ["emqx_machine", "emqx_conf"],