8000 remove unused config map keys · nginx/kubernetes-ingress@3f111b2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3f111b2

Browse files
committed
remove unused config map keys
Signed-off-by: Haywood Shannon <5781935+haywoodsh@users.noreply.github.com>
1 parent 7530e71 commit 3f111b2

File tree

3 files changed

+12
-28
lines changed

3 files changed

+12
-28
lines changed

internal/configs/config_params.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ type ConfigParams struct {
3838
MainOpenTracingLoadModule bool
3939
MainOpenTracingTracer string
4040
MainOpenTracingTracerConfig string
41-
MainOtelEnabled bool
4241
MainOtelLoadModule bool
4342
MainOtelGlobalTraceEnabled bool
4443
MainOtelExporterEndpoint string

internal/configs/configmaps.go

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -615,23 +615,6 @@ func ParseConfigMap(ctx context.Context, cfgm *v1.ConfigMap, nginxPlus bool, has
615615
cfgParams.MainOtelLoadModule = true
616616
}
617617

618-
if otelEnabled, exists, err := GetMapKeyAsBool(cfgm.Data, "otel-enabled", cfgm); exists {
619-
if err != nil {
620-
nl.Error(l, err)
621-
eventLog.Event(cfgm, v1.EventTypeWarning, nl.EventReasonInvalidValue, err.Error())
622-
configOk = false
623-
} else {
624-
if cfgParams.MainOtelLoadModule {
625-
cfgParams.MainOtelEnabled = otelEnabled
626-
} else {
627-
errorText := fmt.Sprintf("ConfigMap %s/%s: 'otel-enabled' is ignored because 'otel-exporter-endpoint' is not set, ignoring", cfgm.GetNamespace(), cfgm.GetName())
628-
nl.Error(l, errorText)
629-
eventLog.Event(cfgm, v1.EventTypeWarning, nl.EventReasonInvalidValue, errorText)
630-
configOk = false
631-
}
632-
}
633-
}
634-
635618
if hasAppProtect {
636619
if appProtectFailureModeAction, exists := cfgm.Data["app-protect-failure-mode-action"]; exists {
637620
if appProtectFailureModeAction == "pass" || appProtectFailureModeAction == "drop" {
@@ -1026,7 +1009,6 @@ func GenerateNginxMainConfig(staticCfgParams *StaticConfigParams, config *Config
10261009
OpenTracingLoadModule: config.MainOpenTracingLoadModule,
10271010
OpenTracingTracer: config.MainOpenTracingTracer,
10281011
OpenTracingTracerConfig: config.MainOpenTracingTracerConfig,
1029-
MainOtelEnabled: config.MainOtelEnabled,
10301012
MainOtelLoadModule: config.MainOtelLoadModule,
10311013
MainOtelGlobalTraceEnabled: config.MainOtelGlobalTraceEnabled,
10321014
MainOtelExporterEndpoint: config.MainOtelExporterEndpoint,

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