Skip to content

Commit

Permalink
feat: add urn to deployment labels (#48)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
ishanarya0 authored Jul 26, 2023
1 parent cadc134 commit 2217ff1
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions modules/firehose/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 2217ff1

Please sign in to comment.