build(helm): add loaded-plugins and loaded-modules to helm configmap

turn off telemetry in CI
This commit is contained in:
zhanghongtong 2021-01-20 16:29:19 +08:00 committed by Rory Z
parent 2c03bca6ae
commit 17ee5b0af5
10 changed files with 97 additions and 17 deletions

View File

@ -25,6 +25,7 @@ emqx_test(){
unzip -q ${PACKAGE_PATH}/$packagename unzip -q ${PACKAGE_PATH}/$packagename
sed -i "/zone.external.server_keepalive/c zone.external.server_keepalive = 60" ${PACKAGE_PATH}/emqx/etc/emqx.conf sed -i "/zone.external.server_keepalive/c zone.external.server_keepalive = 60" ${PACKAGE_PATH}/emqx/etc/emqx.conf
sed -i "/mqtt.max_topic_alias/c mqtt.max_topic_alias = 10" ${PACKAGE_PATH}/emqx/etc/emqx.conf sed -i "/mqtt.max_topic_alias/c mqtt.max_topic_alias = 10" ${PACKAGE_PATH}/emqx/etc/emqx.conf
sed -i '/emqx_telemetry/d' ${PACKAGE_PATH}/emqx/data/loaded_plugins
if [ ! -z $(echo ${EMQX_DEPS_DEFAULT_VSN#v} | grep -oE "[0-9]+\.[0-9]+(\.[0-9]+)?-(alpha|beta|rc)\.[0-9]") ]; then if [ ! -z $(echo ${EMQX_DEPS_DEFAULT_VSN#v} | grep -oE "[0-9]+\.[0-9]+(\.[0-9]+)?-(alpha|beta|rc)\.[0-9]") ]; then
if [ ! -d ${PACKAGE_PATH}/emqx/lib/emqx-${EMQX_DEPS_DEFAULT_VSN#v} ] || [ ! -d ${PACKAGE_PATH}/emqx/releases/${EMQX_DEPS_DEFAULT_VSN#v} ] ;then if [ ! -d ${PACKAGE_PATH}/emqx/lib/emqx-${EMQX_DEPS_DEFAULT_VSN#v} ] || [ ! -d ${PACKAGE_PATH}/emqx/releases/${EMQX_DEPS_DEFAULT_VSN#v} ] ;then
@ -111,6 +112,7 @@ running_test(){
sed -i "/zone.external.server_keepalive/c zone.external.server_keepalive = 60" /etc/emqx/emqx.conf sed -i "/zone.external.server_keepalive/c zone.external.server_keepalive = 60" /etc/emqx/emqx.conf
sed -i "/mqtt.max_topic_alias/c mqtt.max_topic_alias = 10" /etc/emqx/emqx.conf sed -i "/mqtt.max_topic_alias/c mqtt.max_topic_alias = 10" /etc/emqx/emqx.conf
sed -i '/emqx_telemetry/d' /var/lib/emqx/loaded_plugins
emqx start || tail /var/log/emqx/erlang.log.1 emqx start || tail /var/log/emqx/erlang.log.1
IDLE_TIME=0 IDLE_TIME=0

View File

@ -16,6 +16,7 @@ services:
- -c - -c
- | - |
sed -i "s 127.0.0.1 $$(ip route show |grep "link" |awk '{print $$1}') g" /opt/emqx/etc/acl.conf sed -i "s 127.0.0.1 $$(ip route show |grep "link" |awk '{print $$1}') g" /opt/emqx/etc/acl.conf
sed -i '/emqx_telemetry/d' /opt/emqx/data/loaded_plugins
/usr/bin/start.sh /usr/bin/start.sh
healthcheck: healthcheck:
test: ["CMD", "/opt/emqx/bin/emqx_ctl", "status"] test: ["CMD", "/opt/emqx/bin/emqx_ctl", "status"]
@ -42,6 +43,7 @@ services:
- -c - -c
- | - |
sed -i "s 127.0.0.1 $$(ip route show |grep "link" |awk '{print $$1}') g" /opt/emqx/etc/acl.conf sed -i "s 127.0.0.1 $$(ip route show |grep "link" |awk '{print $$1}') g" /opt/emqx/etc/acl.conf
sed -i '/emqx_telemetry/d' /opt/emqx/data/loaded_plugins
/usr/bin/start.sh /usr/bin/start.sh
healthcheck: healthcheck:
test: ["CMD", "/opt/emqx/bin/emqx_ctl", "status"] test: ["CMD", "/opt/emqx/bin/emqx_ctl", "status"]

View File

@ -26,6 +26,7 @@
!cd emqx !cd emqx
!sed -i 's|listener.wss.external[ \t]*=.*|listener.wss.external = 8085|g' etc/emqx.conf !sed -i 's|listener.wss.external[ \t]*=.*|listener.wss.external = 8085|g' etc/emqx.conf
!sed -i '/emqx_telemetry/d' data/loaded_plugins
!./bin/emqx start !./bin/emqx start
?EMQ X Broker $old_vsn is started successfully! ?EMQ X Broker $old_vsn is started successfully!
@ -42,6 +43,7 @@
?SH-PROMPT ?SH-PROMPT
!cd emqx2 !cd emqx2
!sed -i '/emqx_telemetry/d' data/loaded_plugins
!./bin/emqx start !./bin/emqx start
?EMQ X Broker $old_vsn is started successfully! ?EMQ X Broker $old_vsn is started successfully!

View File

@ -58,7 +58,7 @@ ignore=title-trailing-punctuation, T1, T2, T3, T4, T5, T6, T8, B1, B2, B3, B4, B
# python-style regex that the commit-msg title must match # python-style regex that the commit-msg title must match
# Note that the regex can contradict with other rules if not used correctly # Note that the regex can contradict with other rules if not used correctly
# (e.g. title-must-not-contain-word). # (e.g. title-must-not-contain-word).
regex=^(feat|feature|fix|docs|style|refactor|test|chore|perf|improve)\(.+\): .+ regex=^(feat|feature|fix|docs|style|refactor|test|chore|build|perf|improve)\(.+\): .+
# [body-max-line-length] # [body-max-line-length]
# line-length=72 # line-length=72

View File

@ -91,6 +91,7 @@ jobs:
run: | run: |
pkg_name=$(basename _packages/emqx/emqx-macos-*.zip) pkg_name=$(basename _packages/emqx/emqx-macos-*.zip)
unzip _packages/emqx/$pkg_name unzip _packages/emqx/$pkg_name
gsed -i '/emqx_telemetry/d' ./emqx/data/loaded_plugins
./emqx/bin/emqx start || cat emqx/log/erlang.log.1 ./emqx/bin/emqx start || cat emqx/log/erlang.log.1
./emqx/bin/emqx_ctl status ./emqx/bin/emqx_ctl status
./emqx/bin/emqx stop ./emqx/bin/emqx stop

View File

@ -77,6 +77,7 @@ jobs:
sed -i -r "s/^appVersion: .*$/appVersion: \"${version}\"/g" deploy/charts/emqx/Chart.yaml sed -i -r "s/^appVersion: .*$/appVersion: \"${version}\"/g" deploy/charts/emqx/Chart.yaml
sed -i -r 's/ pullPolicy: .*$/ pullPolicy: Never/g' deploy/charts/emqx/values.yaml sed -i -r 's/ pullPolicy: .*$/ pullPolicy: Never/g' deploy/charts/emqx/values.yaml
sed -i '/emqx_telemetry/d' deploy/charts/emqx/values.yaml
helm install emqx --set emqxAclConfig="" --set emqxConfig.EMQX_ZONE__EXTERNAL__RETRY_INTERVAL=2s --set emqxConfig.EMQX_MQTT__MAX_TOPIC_ALIAS=10 deploy/charts/emqx --debug --dry-run helm install emqx --set emqxAclConfig="" --set emqxConfig.EMQX_ZONE__EXTERNAL__RETRY_INTERVAL=2s --set emqxConfig.EMQX_MQTT__MAX_TOPIC_ALIAS=10 deploy/charts/emqx --debug --dry-run
helm install emqx --set emqxAclConfig="" --set emqxConfig.EMQX_ZONE__EXTERNAL__RETRY_INTERVAL=2s --set emqxConfig.EMQX_MQTT__MAX_TOPIC_ALIAS=10 deploy/charts/emqx helm install emqx --set emqxAclConfig="" --set emqxConfig.EMQX_ZONE__EXTERNAL__RETRY_INTERVAL=2s --set emqxConfig.EMQX_MQTT__MAX_TOPIC_ALIAS=10 deploy/charts/emqx
@ -89,6 +90,11 @@ jobs:
echo "waiting emqx started"; echo "waiting emqx started";
sleep 10; sleep 10;
done done
- name: get pods log
if: failure()
env:
KUBECONFIG: "/etc/rancher/k3s/k3s.yaml"
run: kubectl describe pods emqx-0
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with: with:
repository: emqx/paho.mqtt.testing repository: emqx/paho.mqtt.testing

View File

@ -49,6 +49,18 @@ spec:
app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/instance: {{ .Release.Name }}
spec: spec:
volumes: volumes:
- name: emqx-loaded-plugins
configMap:
name: {{ include "emqx.fullname" . }}-loaded-plugins
items:
- key: loaded_plugins
path: loaded_plugins
- name: emqx-loaded-modules
configMap:
name: {{ include "emqx.fullname" . }}-loaded-modules
items:
- key: loaded_modules
path: loaded_modules
- name: emqx-acl - name: emqx-acl
configMap: configMap:
name: {{ include "emqx.fullname" . }}-acl name: {{ include "emqx.fullname" . }}-acl
@ -128,6 +140,12 @@ spec:
- name: emqx-acl - name: emqx-acl
mountPath: "/opt/emqx/etc/acl.conf" mountPath: "/opt/emqx/etc/acl.conf"
subPath: "acl.conf" subPath: "acl.conf"
- name: emqx-loaded-plugins
mountPath: "/opt/emqx/data/loaded_plugins"
subPath: "loaded_plugins"
- name: emqx-loaded-modules
mountPath: "/opt/emqx/data/loaded_modules"
subPath: "loaded_modules"
{{ if .Values.emqxLicneseSecretName }} {{ if .Values.emqxLicneseSecretName }}
- name: emqx-license - name: emqx-license
mountPath: "/opt/emqx/etc/emqx.lic" mountPath: "/opt/emqx/etc/emqx.lic"

View File

@ -11,4 +11,49 @@ metadata:
data: data:
{{- range $index, $value := .Values.emqxConfig}} {{- range $index, $value := .Values.emqxConfig}}
{{$index}}: "{{ $value }}" {{$index}}: "{{ $value }}"
{{- end}} {{- end}}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "emqx.fullname" . }}-acl
namespace: {{ .Release.Namespace }}
labels:
app.kubernetes.io/name: {{ include "emqx.name" . }}
helm.sh/chart: {{ include "emqx.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
data:
"acl.conf": |
{{ .Values.emqxAclConfig }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "emqx.fullname" . }}-loaded-plugins
namespace: {{ .Release.Namespace }}
labels:
app.kubernetes.io/name: {{ include "emqx.name" . }}
helm.sh/chart: {{ include "emqx.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
data:
"loaded_plugins": |
{{ .Values.emqxLoadedPlugins }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "emqx.fullname" . }}-loaded-modules
namespace: {{ .Release.Namespace }}
labels:
app.kubernetes.io/name: {{ include "emqx.name" . }}
helm.sh/chart: {{ include "emqx.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
data:
"loaded_modules": |
{{ .Values.emqxLoadedModules }}

View File

@ -1,13 +0,0 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "emqx.fullname" . }}-acl
namespace: {{ .Release.Namespace }}
labels:
app.kubernetes.io/name: {{ include "emqx.name" . }}
helm.sh/chart: {{ include "emqx.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
data:
"acl.conf": |
{{ .Values.emqxAclConfig }}

View File

@ -3,7 +3,7 @@
## Declare variables to be passed into your templates. ## Declare variables to be passed into your templates.
## It is recommended to have odd number of nodes in a cluster, otherwise the emqx cluster cannot be automatically healed in case of net-split. ## It is recommended to have odd number of nodes in a cluster, otherwise the emqx cluster cannot be automatically healed in case of net-split.
replicaCount: 3 replicaCount: 3
image: image:
repository: emqx/emqx repository: emqx/emqx
pullPolicy: IfNotPresent pullPolicy: IfNotPresent
@ -74,6 +74,23 @@ emqxAclConfig: >
{deny, all, subscribe, ["$SYS/#", {eq, "#"}]}. {deny, all, subscribe, ["$SYS/#", {eq, "#"}]}.
{allow, all}. {allow, all}.
emqxLoadedPlugins: >
{emqx_management, true}.
{emqx_recon, true}.
{emqx_retainer, true}.
{emqx_dashboard, true}.
{emqx_telemetry, true}.
{emqx_rule_engine, true}.
{emqx_bridge_mqtt, false}.
emqxLoadedModules: >
{emqx_mod_acl_internal, true}.
{emqx_mod_presence, true}.
{emqx_mod_delayed, false}.
{emqx_mod_rewrite, false}.
{emqx_mod_subscription, false}.
{emqx_mod_topic_metrics, false}.
## EMQX Enterprise Edition requires manual creation of a Secret containing the licensed content. Write the name of Secret to the value of "emqxLicneseSecretName" ## EMQX Enterprise Edition requires manual creation of a Secret containing the licensed content. Write the name of Secret to the value of "emqxLicneseSecretName"
## Example: ## Example:
## kubectl create secret generic emqx-license-secret-name --from-file=/path/to/emqx.lic ## kubectl create secret generic emqx-license-secret-name --from-file=/path/to/emqx.lic
@ -86,7 +103,7 @@ service:
## Port for MQTT ## Port for MQTT
## ##
mqtt: 1883 mqtt: 1883
## Port for MQTT(SSL) ## Port for MQTT(SSL)
## ##
mqttssl: 8883 mqttssl: 8883
## Port for mgmt API ## Port for mgmt API