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

Revert to original main-template without pod downtime #6661

Merged
merged 12 commits into from
Oct 18, 2024
4 changes: 4 additions & 0 deletions internal/configs/configmaps.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,10 +347,14 @@ func ParseConfigMap(ctx context.Context, cfgm *v1.ConfigMap, nginxPlus bool, has

if mainTemplate, exists := cfgm.Data["main-template"]; exists {
cfgParams.MainTemplate = &mainTemplate
} else {
cfgParams.MainTemplate = nil
}

if ingressTemplate, exists := cfgm.Data["ingress-template"]; exists {
cfgParams.IngressTemplate = &ingressTemplate
} else {
cfgParams.IngressTemplate = nil
}
j1m-ryan marked this conversation as resolved.
Show resolved Hide resolved

if virtualServerTemplate, exists := cfgm.Data["virtualserver-template"]; exists {
Expand Down
4 changes: 4 additions & 0 deletions internal/configs/configurator.go
Original file line number Diff line number Diff line change
Expand Up @@ -1310,11 +1310,15 @@ func (cnf *Configurator) UpdateConfig(cfgParams *ConfigParams, resources Extende
cfgParams.MainServerSSLDHParam = fileName
}

// Apply custom main-template defined in ConfigMap obj
if cfgParams.MainTemplate != nil {
err := cnf.templateExecutor.UpdateMainTemplate(cfgParams.MainTemplate)
if err != nil {
return allWarnings, fmt.Errorf("error when parsing the main template: %w", err)
}
} else {
// Reverse to default main template parsed at NIC startup.
cnf.templateExecutor.UseOriginalMainTemplate()
}

if cfgParams.IngressTemplate != nil {
Expand Down
Loading
Loading