Skip to content

Commit

Permalink
Use string instead of map
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinFairise2 committed Aug 19, 2024
1 parent e598a7a commit 5134cc5
Showing 1 changed file with 13 additions and 23 deletions.
36 changes: 13 additions & 23 deletions e2e-tests/otel-collector/helm/otel_collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"github.com/DataDog/test-infra-definitions/components/datadog/fakeintake"
"github.com/DataDog/test-infra-definitions/resources/helm"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"gopkg.in/yaml.v3"

otelcomp "github.com/DataDog/opentelemetry-collector-contrib/e2e-tests/otel-collector/component"
"github.com/DataDog/opentelemetry-collector-contrib/e2e-tests/otel-collector/otelparams"
Expand Down Expand Up @@ -68,28 +67,19 @@ imagePullSecrets:

func buildFakeintakeValues(fakeintake *fakeintake.Fakeintake) pulumi.AssetOutput {
return fakeintake.URL.ApplyT(func(url string) (pulumi.Asset, error) {
defaultValues := map[string]interface{}{
"config": map[string]interface{}{
"exporters": map[string]interface{}{
"datadog": map[string]interface{}{
"metrics": map[string]interface{}{
"endpoint": url,
},
"traces": map[string]interface{}{
"endpoint": url,
},
"logs": map[string]interface{}{
"endpoint": url,
},
},
},
},
}
valuesYAML, err := yaml.Marshal(defaultValues)
if err != nil {
return nil, err
}
return pulumi.NewStringAsset(string(valuesYAML)), nil
defaultValuesYAML := fmt.Sprintf(`
config:
exporters:
datadog:
metrics:
endpoint: %[1]s
traces:
endpoint: %[1]s
logs:
endpoint: %[1]s
`, url)

return pulumi.NewStringAsset(string(defaultValuesYAML)), nil

}).(pulumi.AssetOutput)
}

0 comments on commit 5134cc5

Please sign in to comment.