Skip to content

Commit

Permalink
[nr-k8s-otel-collector] add control plane metrics and differentiate s…
Browse files Browse the repository at this point in the history
…crape jobs by name (#1400)

<!--
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

#### What this PR does / why we need it:

#### 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
- [ ] Variables are documented in the README.md
- [x] Title of the PR starts with chart name (e.g. `[mychartname]`)
  • Loading branch information
csongnr authored Jun 25, 2024
1 parent 6970f9e commit f1c4b79
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 1 deletion.
2 changes: 1 addition & 1 deletion charts/nr-k8s-otel-collector/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,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.3.4
version: 0.4.0

dependencies:
- name: common-library
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ data:
source_labels:
- __meta_kubernetes_node_name
target_label: __metrics_path__
- action: replace
target_label: job_label
replacement: cadvisor
scheme: https
tls_config:
ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
Expand All @@ -108,11 +111,15 @@ data:
source_labels:
- __meta_kubernetes_node_name
target_label: __metrics_path__
- action: replace
target_label: job_label
replacement: kubelet
scheme: https
tls_config:
ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
insecure_skip_verify: false
server_name: kubernetes
filelog:
include:
- /var/log/pods/*/*/*.log
Expand Down
65 changes: 65 additions & 0 deletions charts/nr-k8s-otel-collector/templates/deployment-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ data:
regex: kube-state-metrics
source_labels:
- __meta_kubernetes_pod_label_app_kubernetes_io_name
- action: replace
target_label: job_label
replacement: kube-state-metrics
- job_name: apiserver
scrape_interval: {{ .Values.receivers.prometheus.scrapeInterval }}
kubernetes_sd_configs:
Expand Down Expand Up @@ -53,6 +56,68 @@ data:
source_labels:
- __meta_kubernetes_service_name
target_label: service
- action: replace
target_label: job_label
replacement: apiserver
- job_name: controller-manager
scrape_interval: {{ .Values.receivers.prometheus.scrapeInterval }}
metrics_path: /metrics
kubernetes_sd_configs:
- role: endpoints
scheme: https
tls_config:
ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
insecure_skip_verify: false
bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
relabel_configs:
- action: keep
regex: default;kubernetes;https
source_labels:
- __meta_kubernetes_namespace
- __meta_kubernetes_service_name
- __meta_kubernetes_endpoint_port_name
- action: replace
source_labels:
- __meta_kubernetes_namespace
target_label: namespace
- action: replace
source_labels:
- __meta_kubernetes_pod_name
target_label: pod
- action: replace
source_labels:
- __meta_kubernetes_service_name
target_label: service
- action: replace
target_label: job_label
replacement: controller-manager
- job_name: scheduler
scrape_interval: {{ .Values.receivers.prometheus.scrapeInterval }}
kubernetes_sd_configs:
- role: endpoints
scheme: https
tls_config:
ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
insecure_skip_verify: true
bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
relabel_configs:
- action: keep
regex: default;kubernetes;https
source_labels:
- __meta_kubernetes_namespace
- __meta_kubernetes_service_name
- __meta_kubernetes_endpoint_port_name
- action: replace
source_labels:
- __meta_kubernetes_namespace
target_label: namespace
- action: replace
source_labels:
- __meta_kubernetes_service_name
target_label: service
- action: replace
target_label: job_label
replacement: scheduler
k8s_cluster:
auth_type: serviceAccount
Expand Down

0 comments on commit f1c4b79

Please sign in to comment.