-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prefetch ConfigMap before initial NGINX Config generation #298
Conversation
18ee8d1
to
668b753
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Added a couple of suggestions.
nginx-controller/main.go
Outdated
if cfg.MainServerSSLDHParamFileContent != nil { | ||
fileName, err := ngxc.AddOrUpdateDHParam(*cfg.MainServerSSLDHParamFileContent) | ||
if err != nil { | ||
glog.Errorf("Configmap %s/%s: Could not update dhparams: %v", ns, name, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's exit the Ingress controller in case it fails to write the DHParam file -- use glog.Fatalf
} else { | ||
config.MainServerSSLDHParam = fileName | ||
} | ||
} | ||
mainCfg := &NginxMainConfig{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use GenerateNginxMainConfig
function
if cnf.config.MainServerSSLDHParamFileContent != nil { | ||
fileName, err := cnf.nginx.AddOrUpdateDHParam(*cnf.config.MainServerSSLDHParamFileContent) | ||
if err != nil { | ||
glog.Errorf("Could not update dhparams: %v", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's return an error here
nginx-controller/nginx/config.go
Outdated
|
||
// ParseConfigMap Parse ConfigMap to Config | ||
func ParseConfigMap(cfgm *api_v1.ConfigMap, nginxPlus bool) *Config { | ||
var cfg Config |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
initialize cfg with nginx.NewDefaultConfig()
8acbc47
to
904cf2d
Compare
ConfigMap is applied to the NGINX Config before Config is generated This removes the need for additional NGINX Config generations on startup
904cf2d
to
b303c59
Compare
When the Ingress controller is starting and the ConfigMap is configured via
-nginx-configmaps
cli argument, ensure that the ConfigMap is fetched and applied before the initial NGINX config is generated.