This is an automated email from the ASF dual-hosted git repository. tokers pushed a commit to branch feat/mount-custom-plugins in repository https://gitbox.apache.org/repos/asf/apisix-helm-chart.git
commit 93b90a4eca739cc1d005dd300ec289bded5b8358 Author: Chao Zhang <[email protected]> AuthorDate: Tue Oct 26 14:28:28 2021 +0800 feat: support to mount 3rd plugins from configmap Signed-off-by: Chao Zhang <[email protected]> --- charts/apisix/templates/configmap.yaml | 18 +++++++++++++++++- charts/apisix/templates/deployment.yaml | 16 ++++++++++++++++ charts/apisix/values.yaml | 22 ++++++++++++++++++++++ 3 files changed, 55 insertions(+), 1 deletion(-) diff --git a/charts/apisix/templates/configmap.yaml b/charts/apisix/templates/configmap.yaml index 8ed462b..f625c5a 100644 --- a/charts/apisix/templates/configmap.yaml +++ b/charts/apisix/templates/configmap.yaml @@ -49,6 +49,10 @@ data: enable_ipv6: true config_center: etcd # etcd: use etcd to store the config value # yaml: fetch the config value from local yaml file `/your_path/conf/apisix.yaml` + {{- if .Values.customPlugins.enabled }} + extra_lua_path: {{ .Values.customPlugins.luaPath | quote }} + {{- end }} + #proxy_protocol: # Proxy Protocol configuration # listen_http_port: 9181 # The port with proxy protocol for http, it differs from node_listen and port_admin. @@ -171,12 +175,24 @@ data: {{- if .Values.plugins }} plugins: # plugin list - {{- end }} {{- range $plugin := .Values.plugins }} - {{ $plugin }} {{- end }} + {{- if .Values.customPlugins.enabled }} + {{- range $plugin := .Values.customPlugins.plugins }} + - {{ $plugin.name }} + {{- end }} + {{- end }} + {{- end }} stream_plugins: {{- range $plugin := .Values.stream_plugins }} - {{ $plugin }} {{- end }} + + {{- if .Values.customPlugins.enabled }} + plugin_attr: + {{- range $plugin := .Values.customPlugins.plugins }} + {{ $plugin.name }}: {{ $plugin.attrs | toYaml | nindent 8 }} + {{- end }} + {{- end }} {{- end }} diff --git a/charts/apisix/templates/deployment.yaml b/charts/apisix/templates/deployment.yaml index 9cf7d40..bccbcba 100644 --- a/charts/apisix/templates/deployment.yaml +++ b/charts/apisix/templates/deployment.yaml @@ -82,6 +82,15 @@ spec: - mountPath: /usr/local/apisix/conf/config.yaml name: apisix-config subPath: config.yaml + {{- if .Values.customPlugins.enabled }} + {{- range $plugin := .Values.customPlugins.plugins }} + {{- range $mount := $plugin.configMap.mounts }} + - mountPath: {{ $mount.path }} + name: plugin-{{ $plugin.configMap.name }} + subPath: {{ $mount.key }} + {{- end }} + {{- end }} + {{- end }} resources: {{- toYaml .Values.apisix.resources | nindent 12 }} {{- if .Values.etcd.enabled }} @@ -94,6 +103,13 @@ spec: - configMap: name: {{ include "apisix.fullname" . }} name: apisix-config + {{- if .Values.customPlugins.enabled }} + {{- range $plugin := .Values.customPlugins.plugins }} + - name: plugin-{{ $plugin.configMap.name }} + configMap: + name: {{ $plugin.configMap.name }} + {{- end }} + {{- end }} {{- with .Values.apisix.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} diff --git a/charts/apisix/values.yaml b/charts/apisix/values.yaml index e4a161d..dad0390 100644 --- a/charts/apisix/values.yaml +++ b/charts/apisix/values.yaml @@ -178,6 +178,28 @@ stream_plugins: - ip-restriction - limit-conn +# customPlugins allows you to mount your own HTTP plugins. +customPlugins: + enabled: false + # the lua_path that tells APISIX where it can find plugins, + # note the last ';' is required. + luaPath: "/opts/custom_plugins/?.lua;" + plugins: + # plugin name. + - name: "" + # plugin attrs + attrs: | + # plugin codes can be saved inside configmap object. + configMap: + # name of configmap. + name: "" + # since keys in configmap is flat, mountPath allows to define the mount + # path, so that plugin codes can be mounted hierarchically. + mounts: + - key: "" + path: "" + - key: "" + path: "" dns: resolvers:
