@@ -578,6 +578,71 @@ func ParseConfigMap(ctx context.Context, cfgm *v1.ConfigMap, nginxPlus bool, has
578578 cfgParams .MainOtelLoadModule = true
579579 }
580580
581+ if otelExporterEndpoint , exists := cfgm .Data ["otel-exporter-endpoint" ]; exists {
582+ otelExporterEndpoint = strings .TrimSpace (otelExporterEndpoint )
583+ if otelExporterEndpoint != "" {
584+ cfgParams .MainOtelExporterEndpoint = otelExporterEndpoint
585+ }
586+ }
587+
588+ if otelExporterTrustedCA , exists := cfgm .Data ["otel-exporter-trusted-ca" ]; exists {
589+ otelExporterTrustedCA = strings .TrimSpace (otelExporterTrustedCA )
590+ if otelExporterTrustedCA != "" {
591+ cfgParams .MainOtelExporterTrustedCA = otelExporterTrustedCA
592+ }
593+ }
594+
595+ if otelExporterHeaderName , exists := cfgm .Data ["otel-exporter-header-name" ]; exists {
596+ otelExporterHeaderName = strings .TrimSpace (otelExporterHeaderName )
597+ if otelExporterHeaderName != "" {
598+ cfgParams .MainOtelExporterHeaderName = otelExporterHeaderName
599+ }
600+ }
601+
602+ if otelExporterHeaderValue , exists := cfgm .Data ["otel-exporter-header-value" ]; exists {
603+ otelExporterHeaderValue = strings .TrimSpace (otelExporterHeaderValue )
604+ if otelExporterHeaderValue != "" {
605+ cfgParams .MainOtelExporterHeaderValue = otelExporterHeaderValue
606+ }
607+ }
608+
609+ if otelServiceName , exists := cfgm .Data ["otel-service-name" ]; exists {
610+ otelServiceName = strings .TrimSpace (otelServiceName )
611+ if otelServiceName != "" {
612+ cfgParams .MainOtelServiceName = otelServiceName
613+ }
614+ }
615+
616+ if otelGlobalTraceEnabled , exists , err := GetMapKeyAsBool (cfgm .Data , "otel-global-trace-enabled" , cfgm ); exists {
617+ if err != nil {
618+ nl .Error (l , err )
619+ eventLog .Event (cfgm , v1 .EventTypeWarning , nl .EventReasonInvalidValue , err .Error ())
620+ configOk = false
621+ }
622+ cfgParams .MainOtelGlobalTraceEnabled = otelGlobalTraceEnabled
623+ }
624+
625+ if cfgParams .MainOtelExporterEndpoint != "" {
626+ cfgParams .MainOtelLoadModule = true
627+ }
628+
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+
581646 if hasAppProtect {
582647 if appProtectFailureModeAction , exists := cfgm .Data ["app-protect-failure-mode-action" ]; exists {
583648 if appProtectFailureModeAction == "pass" || appProtectFailureModeAction == "drop" {
0 commit comments