Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion charts/apisix/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ The command removes all the Kubernetes components associated with the chart and
| apisix.luaModuleHook.hookPoint | string | `""` | the hook module which will be used to inject third party code into APISIX use the lua require style like: "module.say_hello" |
| apisix.luaModuleHook.luaPath | string | `""` | extend lua_package_path to load third party code |
| apisix.nginx.configurationSnippet | object | `{"httpAdmin":"","httpEnd":"","httpSrv":"","httpStart":"","main":"","stream":""}` | Custom configuration snippet. |
| apisix.nginx.customLuaSharedDicts | list | `[]` | Add custom [lua_shared_dict](https://github.com/openresty/lua-nginx-module#toc88) settings, click [here](https://github.com/apache/apisix-helm-chart/blob/master/charts/apisix/values.yaml#L27-L30) to learn the format of a shared dict |
| apisix.nginx.customLuaSharedDicts | list | `[]` | Add custom [lua_shared_dict](https://github.com/openresty/lua-nginx-module?tab=readme-ov-file#lua_shared_dict) settings, click [here](https://github.com/apache/apisix-helm-chart/blob/master/charts/apisix/values.yaml#L27-L30) to learn the format of a shared dict |
| apisix.nginx.enableCPUAffinity | bool | `true` | |
| apisix.nginx.envs | list | `[]` | |
| apisix.nginx.keepaliveTimeout | string | `"60s"` | Timeout during which a keep-alive client connection will stay open on the server side. |
Expand All @@ -102,6 +102,7 @@ The command removes all the Kubernetes components associated with the chart and
| apisix.nginx.logs.enableAccessLog | bool | `true` | Enable access log or not, default true |
| apisix.nginx.logs.errorLog | string | `"/dev/stderr"` | Error log path |
| apisix.nginx.logs.errorLogLevel | string | `"warn"` | Error log level |
| apisix.nginx.luaSharedDicts | list | `[]` | Override default [lua_shared_dict](https://github.com/apache/apisix/blob/master/conf/config.yaml.example#L250-L276) settings, click [here](https://github.com/apache/apisix-helm-chart/blob/master/charts/apisix/values.yaml#L27-L30) to learn the format of a shared dict |
| apisix.nginx.workerConnections | string | `"10620"` | |
| apisix.nginx.workerProcesses | string | `"auto"` | |
| apisix.nginx.workerRlimitNofile | string | `"20480"` | |
Expand Down
6 changes: 6 additions & 0 deletions charts/apisix/templates/configmap.yaml
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not work.
The nginx config is like this

lua_shared_dict:
     prometheus-metrics: 20m

This created config like this

lua_shared_dict:
      - prometheus-metrics: 20m

so this should be

{{- range $dict := .Values.apisix.nginx.luaSharedDicts }}
         {{ $dict.name }}: {{ $dict.size }}

https://github.com/apache/apisix/blob/master/conf/config.yaml.example#L250-L276

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed. Here's the pr: #832

Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,12 @@ data:
{{ $dict.name }}: {{ $dict.size }}
{{- end }}
{{- end }}
{{- if .Values.apisix.nginx.luaSharedDicts }}
lua_shared_dict:
{{- range $dict := .Values.apisix.nginx.luaSharedDicts }}
- {{ $dict.name }}: {{ $dict.size }}
{{- end }}
{{- end }}
{{- if .Values.apisix.nginx.configurationSnippet.main }}
main_configuration_snippet: {{- toYaml .Values.apisix.nginx.configurationSnippet.main | indent 6 }}
{{- end }}
Expand Down
8 changes: 7 additions & 1 deletion charts/apisix/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -440,14 +440,20 @@ apisix:

stream: |

# -- Add custom [lua_shared_dict](https://github.com/openresty/lua-nginx-module#toc88) settings,
# -- Add custom [lua_shared_dict](https://github.com/openresty/lua-nginx-module?tab=readme-ov-file#lua_shared_dict) settings,
# click [here](https://github.com/apache/apisix-helm-chart/blob/master/charts/apisix/values.yaml#L27-L30) to learn the format of a shared dict
customLuaSharedDicts: []
# - name: foo
# size: 10k
# - name: bar
# size: 1m

# -- Override default [lua_shared_dict](https://github.com/apache/apisix/blob/master/conf/config.yaml.example#L250-L276) settings,
# click [here](https://github.com/apache/apisix-helm-chart/blob/master/charts/apisix/values.yaml#L27-L30) to learn the format of a shared dict
luaSharedDicts: []
# - name: prometheus-metrics
# size: 20m
Comment on lines +454 to +455
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example is inappropriate, prometheus is defined using the special command for meta { lua_shared_dict }, which cannot be overridden by http { lua_shared_dict }, but it does override other dict values, such as those used by limit-count.

ref: https://github.com/apache/apisix/blob/master/conf/config.yaml.example#L165-L168

This is a special case for creating shared memory between the HTTP subsystem and the stream subsystem.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bzp2010 I actually tried meta but it doesn't work. And overriding it under http does

At least it didn't work for me. Maybe I'm missing something.

Copy link
Copy Markdown
Contributor

@bzp2010 bzp2010 May 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dennispan

Maybe we can move to another example case that is sure to be ok, so we can merge it first, and if it works on prometheus-metrics, that would solve your problem, and you can report it to community

Copy link
Copy Markdown
Contributor

@Baoyuantop Baoyuantop May 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dennispan, can you provide your test steps? Maybe we can find the problem from them.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used this to test (after a re-deployment to pick up the configuration changes):

/usr/local/openresty/nginx/sbin/nginx -T \
  -p /usr/local/apisix/ \
  -c conf/nginx.conf \
| grep lua_shared_dict

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Baoyuantop @bzp2010 any update on this? Anything else needed from me to move this forward?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the Prometheus plugin is not enabled under the stream subsystem (default behavior), http { lua_shared_dict } is useful: https://github.com/apache/apisix/blob/58066abc88df37a490f6c04011ed9588a0bda0d1/apisix/cli/ngx_tpl.lua#L329-L331
so this example can be retained.
@dennispan can you fix CI of this PR? you can run make helm-docs in your local and commit changes of docs.


discovery:
# -- Enable or disable Apache APISIX integration service discovery
enabled: false
Expand Down