Merge pull request #2333 from oilbeater/fix/disable-lua

disable lua for arch s390x and ppc64le
This commit is contained in:
k8s-ci-robot 2018-04-12 05:46:58 -07:00 committed by GitHub
commit 353c63153e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 21 additions and 7 deletions

View file

@ -195,10 +195,14 @@ func parseFlags() (bool, *controller.Configuration, error) {
glog.Warningf("Check of SSL certificate chain is disabled (--enable-ssl-chain-completion=false)")
}
if *dynamicConfigurationEnabled && (runtime.GOARCH == "s390x" || runtime.GOARCH == "ppc64le") {
b := false
dynamicConfigurationEnabled = &b
glog.Warningf("Disabling dynamic configuration feature (LuaJIT is not available in s390x and ppc64le)")
// LuaJIT is not available on arch s390x and ppc64le
disableLua := false
if runtime.GOARCH == "s390x" || runtime.GOARCH == "ppc64le" {
disableLua = true
if *dynamicConfigurationEnabled {
*dynamicConfigurationEnabled = false
glog.Warningf("Disabling dynamic configuration feature (LuaJIT is not available in s390x and ppc64le)")
}
}
config := &controller.Configuration{
@ -225,6 +229,7 @@ func parseFlags() (bool, *controller.Configuration, error) {
UseNodeInternalIP: *useNodeInternalIP,
SyncRateLimit: *syncRateLimit,
DynamicConfigurationEnabled: *dynamicConfigurationEnabled,
DisableLua: disableLua,
ListenPorts: &ngx_config.ListenPorts{
Default: *defServerPort,
Health: *healthzPort,

File diff suppressed because one or more lines are too long

View file

@ -657,6 +657,7 @@ type TemplateConfig struct {
ListenPorts *ListenPorts
PublishService *apiv1.Service
DynamicConfigurationEnabled bool
DisableLua bool
}
// ListenPorts describe the ports required to run the

View file

@ -97,6 +97,8 @@ type Configuration struct {
SyncRateLimit float32
DynamicConfigurationEnabled bool
DisableLua bool
}
// GetPublishService returns the configured service used to set ingress status

View file

@ -628,6 +628,7 @@ func (n *NGINXController) OnUpdate(ingressCfg ingress.Configuration) error {
ListenPorts: n.cfg.ListenPorts,
PublishService: n.GetPublishService(),
DynamicConfigurationEnabled: n.cfg.DynamicConfigurationEnabled,
DisableLua: n.cfg.DisableLua,
}
content, err := n.t.Write(tc)

View file

@ -36,6 +36,7 @@ events {
}
http {
{{ if not $all.DisableLua }}
lua_package_cpath "/usr/local/lib/lua/?.so;/usr/lib/x86_64-linux-gnu/lua/5.1/?.so;;";
lua_package_path "/etc/nginx/lua/?.lua;/etc/nginx/lua/vendor/?.lua;/usr/local/lib/lua/?.lua;;";
@ -73,6 +74,7 @@ http {
balancer.init_worker()
}
{{ end }}
{{ end }}
{{/* we use the value of the header X-Forwarded-For to be able to use the geo_ip module */}}
{{ if $cfg.UseProxyProtocol }}
real_ip_header proxy_protocol;
@ -494,7 +496,7 @@ http {
access_log off;
return 200;
}
{{ if not $all.DisableLua }}
location /is-dynamic-lb-initialized {
{{ if $cfg.EnableOpentracing }}
opentracing off;
@ -513,7 +515,7 @@ http {
ngx.exit(ngx.HTTP_OK)
}
}
{{ end }}
location /nginx_status {
set $proxy_upstream_name "internal";
{{ if $cfg.EnableOpentracing }}
@ -816,6 +818,7 @@ stream {
{{ end }}
location {{ $path }} {
{{ if not $all.DisableLua }}
{{ if shouldConfigureLuaRestyWAF $all.Cfg.DisableLuaRestyWAF $location.LuaRestyWAF.Mode }}
access_by_lua_block {
local lua_resty_waf = require("resty.waf")
@ -866,6 +869,8 @@ stream {
balancer.call()
{{ end }}
}
{{ end }}
{{ if (and (not (empty $server.SSLCertificate)) $all.Cfg.HSTS) }}
if ($scheme = https) {
more_set_headers "Strict-Transport-Security: max-age={{ $all.Cfg.HSTSMaxAge }}{{ if $all.Cfg.HSTSIncludeSubdomains }}; includeSubDomains{{ end }}{{ if $all.Cfg.HSTSPreload }}; preload{{ end }}";