Skip to content
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

Merged
merged 1 commit into from
Jun 27, 2018

Conversation

Dean-Coakley
Copy link
Contributor

@Dean-Coakley Dean-Coakley commented Jun 22, 2018

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.

@Dean-Coakley Dean-Coakley added the enhancement Pull requests for new features/feature enhancements label Jun 22, 2018
@Dean-Coakley Dean-Coakley self-assigned this Jun 22, 2018
@Dean-Coakley Dean-Coakley force-pushed the prefetch-configmap branch 5 times, most recently from 18ee8d1 to 668b753 Compare June 25, 2018 13:48
Copy link
Contributor

@pleshakov pleshakov left a 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.

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)
Copy link
Contributor

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{
Copy link
Contributor

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)
Copy link
Contributor

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


// ParseConfigMap Parse ConfigMap to Config
func ParseConfigMap(cfgm *api_v1.ConfigMap, nginxPlus bool) *Config {
var cfg Config
Copy link
Contributor

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()

@Dean-Coakley Dean-Coakley force-pushed the prefetch-configmap branch 3 times, most recently from 8acbc47 to 904cf2d Compare June 27, 2018 10:15
ConfigMap is applied to the NGINX Config before Config is generated

This removes the need for additional NGINX Config generations on startup
@pleshakov pleshakov changed the title Prefetch ConfigMap before NGINX Config generation Prefetch ConfigMap before initial NGINX Config generation Jun 27, 2018
@pleshakov pleshakov merged commit 1e67de5 into master Jun 27, 2018
@Dean-Coakley Dean-Coakley deleted the prefetch-configmap branch June 27, 2018 11:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Pull requests for new features/feature enhancements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants