Skip to content

Commit 1066784

Browse files
[nr-k8s-otel-collector] Adding ksmSelector for prometheus receiver (#1966)
<!-- 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: This pull request adds support for customising which `kube-state-metrics` instance is targeted by the Prometheus receiver in the otel deployment. This is useful for clusters running multiple kube-state-metrics instances, allowing users to specify a label selector to avoid scraping duplicate metrics. This is mostly mirroring what's done for the `ksm` component in the `newrelic-infrastructure` chart: https://github.com/newrelic/nri-kubernetes/blob/main/charts/newrelic-infrastructure/values.yaml#L255. This would be useful in migration cases to keep `nri-bundle` and `nr-k8s-otel-collector` up at the same time for example. #### Which issue this PR fixes *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)* - fixes # #### Special notes for your reviewer: #### 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]`) # Release Notes to Publish (nr-k8s-otel-collector) If this PR contains changes in `nr-k8s-otel-collector`, please complete the following section. All other charts should ignore this section. <!--BEGIN-RELEASE-NOTES--> ## 🚀 What's Changed * Added configurable label selector for kube-state-metrics discovery via `receivers.prometheus.ksmSelector` to prevent duplicate metric scraping when running multiple kube-state-metrics instances in the same cluster (e.g., during migration from nri-bundle to nr-k8s-otel-collector). <!--END-RELEASE-NOTES--> --------- Co-authored-by: Daniel Budziwojski <dbudziwojski@newrelic.com>
1 parent ac983dd commit 1066784

File tree

15 files changed

+122
-17
lines changed

15 files changed

+122
-17
lines changed

charts/nr-k8s-otel-collector/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ type: application
1717
# This is the chart version. This version number should be incremented each time you make changes
1818
# to the chart and its templates, including the app version.
1919
# Versions are expected to follow Semantic Versioning (https://semver.org/)
20-
version: 0.9.0
20+
version: 0.9.1
2121

2222

2323
dependencies:

charts/nr-k8s-otel-collector/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ to export data to this connector which can then be connected to the New Relic ma
198198
| receivers.kubeletstats.enabled | bool | `true` | Specifies whether the `kubeletstats` receiver is enabled |
199199
| receivers.kubeletstats.scrapeInterval | string | `1m` | Sets the scrape interval for the `kubeletstats` receiver |
200200
| receivers.prometheus.enabled | bool | `true` | Specifies whether the `prometheus` receiver is enabled |
201+
| receivers.prometheus.ksmSelector | string | `app.kubernetes.io/name=kube-state-metrics` | Label selector that will be used to automatically discover an instance of kube-state-metrics running in the cluster. |
201202
| receivers.prometheus.scrapeInterval | string | `1m` | Sets the scrape interval for the `prometheus` receiver |
202203
| serviceAccount | object | See `values.yaml` | Settings controlling ServiceAccount creation |
203204
| serviceAccount.create | bool | `true` | Specifies whether a ServiceAccount should be created |

charts/nr-k8s-otel-collector/examples/k8s/rendered/clusterrole.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ metadata:
99
app.kubernetes.io/managed-by: Helm
1010
app.kubernetes.io/name: nr-k8s-otel-collector
1111
app.kubernetes.io/version: 1.2.0
12-
helm.sh/chart: nr-k8s-otel-collector-0.9.0
12+
helm.sh/chart: nr-k8s-otel-collector-0.9.1
1313
rules:
1414
- apiGroups:
1515
- ""

charts/nr-k8s-otel-collector/examples/k8s/rendered/clusterrolebinding.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ metadata:
99
app.kubernetes.io/managed-by: Helm
1010
app.kubernetes.io/name: nr-k8s-otel-collector
1111
app.kubernetes.io/version: 1.2.0
12-
helm.sh/chart: nr-k8s-otel-collector-0.9.0
12+
helm.sh/chart: nr-k8s-otel-collector-0.9.1
1313
subjects:
1414
- kind: ServiceAccount
1515
name: nr-k8s-otel-collector

charts/nr-k8s-otel-collector/examples/k8s/rendered/daemonset-configmap.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ metadata:
1010
app.kubernetes.io/managed-by: Helm
1111
app.kubernetes.io/name: nr-k8s-otel-collector
1212
app.kubernetes.io/version: 1.2.0
13-
helm.sh/chart: nr-k8s-otel-collector-0.9.0
13+
helm.sh/chart: nr-k8s-otel-collector-0.9.1
1414
data:
1515
daemonset-config.yaml: |
1616
receivers:
@@ -592,7 +592,7 @@ data:
592592
value: <cluser_name>
593593
- key: "newrelic.chart.version"
594594
action: upsert
595-
value: 0.9.0
595+
value: 0.9.1
596596
- key: newrelic.entity.type
597597
action: upsert
598598
value: "k8s"

charts/nr-k8s-otel-collector/examples/k8s/rendered/daemonset.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ metadata:
1010
app.kubernetes.io/managed-by: Helm
1111
app.kubernetes.io/name: nr-k8s-otel-collector
1212
app.kubernetes.io/version: 1.2.0
13-
helm.sh/chart: nr-k8s-otel-collector-0.9.0
13+
helm.sh/chart: nr-k8s-otel-collector-0.9.1
1414
spec:
1515
selector:
1616
matchLabels:
@@ -24,7 +24,7 @@ spec:
2424
app.kubernetes.io/name: nr-k8s-otel-collector
2525
component: daemonset
2626
annotations:
27-
checksum/config: 8642440e20482bfac3b36b4627568fe20e39b868f724f4eac1c0870ca11ed6e8
27+
checksum/config: a56de7c912a17330a02ac7dccd064585f4462d0988af358ecf102eb7a021fac0
2828
spec:
2929
serviceAccountName: nr-k8s-otel-collector
3030
containers:

charts/nr-k8s-otel-collector/examples/k8s/rendered/deployment-configmap.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ metadata:
1010
app.kubernetes.io/managed-by: Helm
1111
app.kubernetes.io/name: nr-k8s-otel-collector
1212
app.kubernetes.io/version: 1.2.0
13-
helm.sh/chart: nr-k8s-otel-collector-0.9.0
13+
helm.sh/chart: nr-k8s-otel-collector-0.9.1
1414
data:
1515
deployment-config.yaml: |
1616
receivers:
@@ -507,7 +507,7 @@ data:
507507
value: <cluser_name>
508508
- key: "newrelic.chart.version"
509509
action: upsert
510-
value: 0.9.0
510+
value: 0.9.1
511511
- key: newrelic.entity.type
512512
action: upsert
513513
value: "k8s"
@@ -525,7 +525,7 @@ data:
525525
value: <cluser_name>
526526
- key: "newrelic.chart.version"
527527
action: upsert
528-
value: 0.9.0
528+
value: 0.9.1
529529
530530
transform/events:
531531
log_statements:

charts/nr-k8s-otel-collector/examples/k8s/rendered/deployment.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ metadata:
1010
app.kubernetes.io/managed-by: Helm
1111
app.kubernetes.io/name: nr-k8s-otel-collector
1212
app.kubernetes.io/version: 1.2.0
13-
helm.sh/chart: nr-k8s-otel-collector-0.9.0
13+
helm.sh/chart: nr-k8s-otel-collector-0.9.1
1414
spec:
1515
replicas: 1
1616
minReadySeconds: 5
@@ -26,7 +26,7 @@ spec:
2626
app.kubernetes.io/name: nr-k8s-otel-collector
2727
component: deployment
2828
annotations:
29-
checksum/config: 5615ec42ac95ea7c1a64be8653ec13b1435be77de1f1a2f9bbdeef476a6b63ae
29+
checksum/config: ee1dfc4c58f891f8358838b0c5795afe1e42d8f2230d0158a4a8792da8828099
3030
spec:
3131
serviceAccountName: nr-k8s-otel-collector
3232
containers:

charts/nr-k8s-otel-collector/examples/k8s/rendered/secret.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ metadata:
1010
app.kubernetes.io/managed-by: Helm
1111
app.kubernetes.io/name: nr-k8s-otel-collector
1212
app.kubernetes.io/version: 1.2.0
13-
helm.sh/chart: nr-k8s-otel-collector-0.9.0
13+
helm.sh/chart: nr-k8s-otel-collector-0.9.1
1414
data:
1515
licenseKey: PE5SX2xpY2Vuc2VLZXk+

charts/nr-k8s-otel-collector/examples/k8s/rendered/service.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ metadata:
1010
app.kubernetes.io/managed-by: Helm
1111
app.kubernetes.io/name: nr-k8s-otel-collector
1212
app.kubernetes.io/version: 1.2.0
13-
helm.sh/chart: nr-k8s-otel-collector-0.9.0
13+
helm.sh/chart: nr-k8s-otel-collector-0.9.1
1414
spec:
1515
type: ClusterIP
1616
ports:

0 commit comments

Comments
 (0)