Skip to content

Commit af6de29

Browse files
haywoodshpdabelf5
authored andcommitted
remove unused config map keys
Signed-off-by: Haywood Shannon <[email protected]>
1 parent 1f0c5bd commit af6de29

File tree

2 files changed

+12
-26
lines changed

2 files changed

+12
-26
lines changed

internal/configs/configmaps.go

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -578,23 +578,6 @@ func ParseConfigMap(ctx context.Context, cfgm *v1.ConfigMap, nginxPlus bool, has
578578
cfgParams.MainOtelLoadModule = true
579579
}
580580

581-
if otelEnabled, exists, err := GetMapKeyAsBool(cfgm.Data, "otel-enabled", cfgm); exists {
582-
if err != nil {
583-
nl.Error(l, err)
584-
eventLog.Event(cfgm, v1.EventTypeWarning, nl.EventReasonInvalidValue, err.Error())
585-
configOk = false
586-
} else {
587-
if cfgParams.MainOtelLoadModule {
588-
cfgParams.MainOtelEnabled = otelEnabled
589-
} else {
590-
errorText := fmt.Sprintf("ConfigMap %s/%s: 'otel-enabled' is ignored because 'otel-exporter-endpoint' is not set, ignoring", cfgm.GetNamespace(), cfgm.GetName())
591-
nl.Error(l, errorText)
592-
eventLog.Event(cfgm, v1.EventTypeWarning, nl.EventReasonInvalidValue, errorText)
593-
configOk = false
594-
}
595-
}
596-
}
597-
598581
if hasAppProtect {
599582
if appProtectFailureModeAction, exists := cfgm.Data["app-protect-failure-mode-action"]; exists {
600583
if appProtectFailureModeAction == "pass" || appProtectFailureModeAction == "drop" {

internal/configs/version1/nginx-plus.tmpl

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ error_log stderr {{.ErrorLogLevel}};
1313
pid /var/lib/nginx/nginx.pid;
1414

1515
{{- if .MainOtelLoadModule}}
16-
#load_module modules/ngx_otel_module.so;
16+
load_module modules/ngx_otel_module.so;
1717
{{- end}}
1818
{{- if .AppProtectLoadModule}}
1919
load_module modules/ngx_http_app_protect_module.so;
@@ -145,20 +145,23 @@ http {
145145
{{- if .SSLDHParam}}
146146
ssl_dhparam {{.SSLDHParam}};
147147
{{- end}}
148-
149-
{{- if .MainOtelEnabled}}
150-
# otel_exporter {
151-
# endpoint {{ .MainOtelExporterEndpoint}};
152-
# header {{ .MainOtelExporterHeaderName }} {{ .MainOtelExporterHeaderValue }};
148+
149+
{{- if .MainOtelLoadModule}}
150+
otel_exporter {
151+
endpoint {{ .MainOtelExporterEndpoint}};
152+
{{ if and .MainOtelExporterHeaderName .MainOtelExporterHeaderValue }}
153+
header {{ .MainOtelExporterHeaderName }} "{{ .MainOtelExporterHeaderValue }}";
154+
{{- end }}
153155
{{ if .MainOtelExporterTrustedCA}}
154156
# trusted_certificate <path>;
155157
{{- end }}
158+
}
159+
156160
{{ if .MainOtelServiceName}}
157-
# otel_service_name {{ .MainOtelServiceName }};
158-
# }
161+
otel_service_name {{ .MainOtelServiceName }};
159162
{{- end }}
160163
{{ if .MainOtelGlobalTraceEnabled }}
161-
# otel_trace on;
164+
otel_trace on;
162165
{{- end}}
163166
{{- end}}
164167

0 commit comments

Comments
 (0)