diff --git a/src/compute-plane-services/nvca/internal/miniservice/reconcile.go b/src/compute-plane-services/nvca/internal/miniservice/reconcile.go index 283fa5da1..117c945bd 100644 --- a/src/compute-plane-services/nvca/internal/miniservice/reconcile.go +++ b/src/compute-plane-services/nvca/internal/miniservice/reconcile.go @@ -739,7 +739,11 @@ func (r *Reconciler) doInstall(ctx context.Context, } // Apply BYOO telemetry annotations to workload objects for Helm-rendered pods metaInput.EnvVars = append(metaInput.EnvVars, byooEnvs...) - metaInput.OTelCollectorEnvVars = append(metaInput.OTelCollectorEnvVars, r.cfg.Agent.BYOOOTelCollectorEnvVars()...) + collectorEnvs := r.cfg.Agent.BYOOOTelCollectorEnvVars() + metaInput.OTelCollectorEnvVars = append(metaInput.OTelCollectorEnvVars, collectorEnvs...) + // The webhook special-cases Helm utils pods and skips metadata-carried collector + // env injection, so inject the envs directly into the BYOO collector sidecar. + k8sutil.AddBYOOEnvVarsToPodSpec(&utilsPod.Spec, collectorEnvs) } // Task-specific mutators. diff --git a/src/compute-plane-services/nvca/internal/miniservice/reconcile_test.go b/src/compute-plane-services/nvca/internal/miniservice/reconcile_test.go index c33a4e230..ae4341afd 100644 --- a/src/compute-plane-services/nvca/internal/miniservice/reconcile_test.go +++ b/src/compute-plane-services/nvca/internal/miniservice/reconcile_test.go @@ -256,7 +256,7 @@ func TestReconcile_Function(t *testing.T) { r.cfg.Agent.SharedStorage.Server.Image = "smb:latest" exporterBatchMaxSizeBytes := int64(1000000) r.cfg.Agent.BYOOLogChunking = nvcaconfig.BYOOLogChunkingConfig{ - MaxBodyBytes: 983040, + MaxBodyBytes: 262144, DryRun: true, ExporterBatchMaxSizeBytes: &exporterBatchMaxSizeBytes, } @@ -659,6 +659,21 @@ rules: assert.Len(t, c.Resources.Requests, 2) } } + var byooCollector *corev1.Container + for i := range utilsPod.Spec.Containers { + if utilsPod.Spec.Containers[i].Name == common.ByooOTelCollectorPodNameBase { + byooCollector = &utilsPod.Spec.Containers[i] + break + } + } + require.NotNil(t, byooCollector, "utils pod should include BYOO collector sidecar") + byooCollectorEnv := map[string]string{} + for _, env := range byooCollector.Env { + byooCollectorEnv[env.Name] = env.Value + } + assert.Equal(t, "262144", byooCollectorEnv[nvcaconfig.BYOOLogChunkMaxBodyBytesEnv]) + assert.Equal(t, "true", byooCollectorEnv[nvcaconfig.BYOOLogChunkDryRunEnv]) + assert.Equal(t, "1000000", byooCollectorEnv[nvcaconfig.BYOOLogExporterBatchMaxSizeBytesEnv]) assert.Contains(t, utilsPod.Spec.Tolerations, configuredToleration) assert.Equal(t, mergeMaps(translatedLabels, map[string]string{ common.BYOOMetricsEgressTargetLabelKey: common.BYOOMetricsEgressTargetLabelValue, @@ -818,7 +833,7 @@ rules: for _, env := range msMeta.OTelCollectorEnvVars { otelCollectorEnv[env.Name] = env.Value } - assert.Equal(t, "983040", otelCollectorEnv[nvcaconfig.BYOOLogChunkMaxBodyBytesEnv]) + assert.Equal(t, "262144", otelCollectorEnv[nvcaconfig.BYOOLogChunkMaxBodyBytesEnv]) assert.Equal(t, "true", otelCollectorEnv[nvcaconfig.BYOOLogChunkDryRunEnv]) assert.Equal(t, "1000000", otelCollectorEnv[nvcaconfig.BYOOLogExporterBatchMaxSizeBytesEnv]) assert.Equal(t, "true", otelCollectorEnv[nvcaconfig.BYOOMetricSubsetEnabledEnv])