Skip to content

Commit 0c9c7f5

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

File tree

2 files changed

+11
-25
lines changed

2 files changed

+11
-25
lines changed

internal/configs/configmaps.go

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

629-
if otelEnabled, exists, err := GetMapKeyAsBool(cfgm.Data, "otel-enabled", cfgm); exists {
630-
if err != nil {
631-
nl.Error(l, err)
632-
eventLog.Event(cfgm, v1.EventTypeWarning, nl.EventReasonInvalidValue, err.Error())
633-
configOk = false
634-
} else {
635-
if cfgParams.MainOtelLoadModule {
636-
cfgParams.MainOtelEnabled = otelEnabled
637-
} else {
638-
errorText := fmt.Sprintf("ConfigMap %s/%s: 'otel-enabled' is ignored because 'otel-exporter-endpoint' is not set, ignoring", cfgm.GetNamespace(), cfgm.GetName())
639-
nl.Error(l, errorText)
640-
eventLog.Event(cfgm, v1.EventTypeWarning, nl.EventReasonInvalidValue, errorText)
641-
configOk = false
642-
}
643-
}
644-
}
645-
646629
if hasAppProtect {
647630
if appProtectFailureModeAction, exists := cfgm.Data["app-protect-failure-mode-action"]; exists {
648631
if appProtectFailureModeAction == "pass" || appProtectFailureModeAction == "drop" {

internal/configs/version1/nginx-plus.tmpl

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -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)