Skip to content

Commit

Permalink
[nr-ebpf-agent] Supporting global.cluster name supplied by the nri bu…
Browse files Browse the repository at this point in the history
…ndle. (#1525)

<!--
Thank you for contributing to New Relic's Helm charts. Before you submit
this PR we'd like to
make sure you are aware of our technical requirements:

*
https://github.com/newrelic-experimental/helm-charts/blob/master/CONTRIBUTING.md#technical-requirements

For a quick overview across what we will look at reviewing your PR,
please read
our review guidelines:

*
https://github.com/newrelic-experimental/helm-charts/blob/master/REVIEW_GUIDELINES.md

Following our best practices right from the start will accelerate the
review process and
help get your PR merged quicker.

When updates to your PR are requested, please add new commits and do not
squash the
history. This will make it easier to identify new changes. The PR will
be squashed
anyways when it is merged. Thanks.

For fast feedback, please @-mention maintainers that are listed in the
Chart.yaml file.

Please make sure you test your changes before you push them. Once
pushed, a Github Action
will run across your changes and do some initial checks and linting.
These checks run
very quickly. Please check the results. We would like these checks to
pass before we
even continue reviewing your changes.
-->
#### Is this a new chart
No. 

#### What this PR does / why we need it:
Adds support for values.global.chart as the chart name for the ebpf
agent.
Is needed to support the ebpf agent being added to the nri bundle. 

#### Which issue this PR fixes
*(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)`
format, will close that issue when PR gets merged)*
  - fixes # N/A

#### Special notes for your reviewer:
values.global.chart is coming from the nri bundle values.yaml and is
documented in the nri-bundle readme.

#### Checklist
[Place an '[x]' (no spaces) in all applicable fields. Please remove
unrelated fields.]
- [x] Chart Version bumped
- [x] Variables are documented in the README.md
- [x] Title of the PR starts with chart name (e.g. `[mychartname]`)

Signed-off-by: pbeckwith <[email protected]>
  • Loading branch information
Philip-R-Beckwith authored Nov 7, 2024
1 parent 5f9669c commit 89c5551
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion charts/nr-ebpf-agent/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.9
version: 0.1.10
dependencies:
- name: common-library
version: 1.3.0
Expand Down
11 changes: 11 additions & 0 deletions charts/nr-ebpf-agent/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,17 @@ Create the name of the service account to use
{{- end }}
{{- end }}

{{/*
Return the cluster name
*/}}
{{- define "nr-ebpf-agent.clusterName" -}}
{{- if .Values.global }}
{{- .Values.global.cluster | default "" -}}
{{- else -}}
{{- "" -}}
{{- end -}}
{{- end -}}

{{/*
Return the licenseKey
*/}}
Expand Down
9 changes: 7 additions & 2 deletions charts/nr-ebpf-agent/templates/otel-collector-config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- $globalClusterName := include "nr-ebpf-agent.clusterName" . -}}
apiVersion: v1
kind: ConfigMap
metadata:
Expand Down Expand Up @@ -111,7 +112,7 @@ data:
service:
pipelines:
traces:
receivers:
receivers:
- otlp
processors:
- resource/setup_for_local_k8s_md
Expand All @@ -122,7 +123,7 @@ data:
exporters:
- otlp
metrics:
receivers:
receivers:
- otlp
processors:
- resource/setup_for_local_k8s_md
Expand All @@ -132,4 +133,8 @@ data:
- resource/setup_for_export
exporters:
- otlp
{{- if $globalClusterName}}
clusterName: {{ $globalClusterName }}
{{ else }}
clusterName: {{ required "Please set the Kubernetes cluster name" .Values.cluster | quote }}
{{ end }}

0 comments on commit 89c5551

Please sign in to comment.