From 2217ff1d6ae7bf59471ec7f954a4db7d3a7cbbe9 Mon Sep 17 00:00:00 2001 From: Ishan Arya Date: Wed, 26 Jul 2023 23:07:41 +0530 Subject: [PATCH] feat: add urn to deployment labels (#48) * feat: add urn to deployment labels - this can be used as a metrics tag * fix: new map for template labels * fix: remove urn label form entropylabels --- modules/firehose/driver.go | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/modules/firehose/driver.go b/modules/firehose/driver.go index 3e13f719..b6bfb301 100644 --- a/modules/firehose/driver.go +++ b/modules/firehose/driver.go @@ -35,17 +35,13 @@ const ( labelDeployment = "deployment" labelOrchestrator = "orchestrator" + labelURN = "urn" orchestratorLabelValue = "entropy" ) const defaultKey = "default" -const ( - metricStatsdHost = "localhost" - metricStatsdPort = "8152" -) - var defaultDriverConf = driverConf{ Namespace: "firehose", ChartValues: ChartValues{ @@ -207,6 +203,10 @@ func (fd *firehoseDriver) getHelmRelease(res resource.Resource, conf Config, labelOrchestrator: orchestratorLabelValue, } + otherLabels := map[string]string{ + labelURN: res.URN, + } + deploymentLabels, err := renderTpl(fd.conf.Labels, cloneAndMergeMaps(res.Labels, entropyLabels)) if err != nil { return nil, err @@ -267,13 +267,10 @@ func (fd *firehoseDriver) getHelmRelease(res resource.Resource, conf Config, } if telegrafConf.Enabled { - conf.EnvVariables, err = renderTpl(conf.EnvVariables, cloneAndMergeMaps(conf.EnvVariables, cloneAndMergeMaps(deploymentLabels, cloneAndMergeMaps(res.Labels, entropyLabels)))) + conf.EnvVariables, err = renderTpl(conf.EnvVariables, cloneAndMergeMaps(cloneAndMergeMaps(conf.EnvVariables, cloneAndMergeMaps(deploymentLabels, cloneAndMergeMaps(res.Labels, entropyLabels))), otherLabels)) if err != nil { return nil, err } - - conf.EnvVariables["METRIC_STATSD_HOST"] = metricStatsdHost - conf.EnvVariables["METRIC_STATSD_PORT"] = metricStatsdPort } rc := helm.DefaultReleaseConfig()