admin管理员组文章数量:1353252
I'm customizing the ingress-nginx controller by using a modified nginx-base image. Specifically, I want to add the NJS module to enable advanced CORS handling logic via js_import and js_header_filter directives.
I build my own nginx-base image based on registry.k8s.io/ingress-nginx/nginx:v1.2.1, only added the NJS module.
Source: /
Built from the helm-chart-4.12.1 branch The issue
When I use the custom base image and enable my custom CORS logic via http-snippet in the HelmRelease config:
config:
http-snippet: |
include /etc/nginx/CORS_http.conf;
cat /etc/nginx/CORS_http.conf
js_var $cors_config_file; # set or override in server or location contexts of nginx configuration to point to configuration file
js_var $cors_is_valid_preflight_request; # set by cors.header_filter to signal detection of a valid pre-flight request
js_import cors from /etc/nginx/njs/http/cors.js;
I get the following error: failed to load the 'resty.core' module
2025/03/31 09:41:20 [alert] 18#18: failed to load the 'resty.core' module (); ensure you are using an OpenResty release from .html (reason: module 'resty.core' not found:
no field package.preload['resty.core']
no file '/etc/nginx/lua/resty/core.lua'
no file '../lua-resty-core/lib/resty/core.lua'
no file '../lua-resty-lrucache/lib/resty/core.lua'
no file './resty/core.lua'
no file '/usr/local/share/luajit-2.1/resty/core.lua'
no file '/usr/local/share/lua/5.1/resty/core.lua'
no file '/usr/local/share/lua/5.1/resty/core/init.lua'
Which seems unrelated to my CORS config or NJS module.
This error disappears when I comment out the http-snippet. But the snippet itself only references js_import (NJS), and does not use Lua at all.
It seems like enabling NJS somehow triggers Lua module loading even when Lua isn't used.
Also tried building from main, from branches starting with controller v1.12.0 down to v1.10.0, and from helm-chart-4.12.1 down to helm-chart-4.10.0 - same result every time. Tried both building manually and using the current ci.yaml from a fork of the ingress-nginx repo.
Thanks.
本文标签:
版权声明:本文标题:kubernetes - Ingress-nginx: Failed to load the resty.core module when using include with js_import in http-snippet - Stack Overf 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743891370a2556979.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论