Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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])
Expand Down
Loading