Skip to content

Commit

Permalink
Revert to original main-template without pod downtime (#6661)
Browse files Browse the repository at this point in the history
  • Loading branch information
jjngx authored Oct 18, 2024
1 parent 55b123d commit ef2d77c
Show file tree
Hide file tree
Showing 5 changed files with 1,508 additions and 10 deletions.
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
}

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

0 comments on commit ef2d77c

Please sign in to comment.