From 0cf85decb978d06ef638cf11eca3f320dad2178c Mon Sep 17 00:00:00 2001 From: Carlos Date: Mon, 17 Feb 2020 09:55:29 +0000 Subject: [PATCH] Upgrade k8s integration with new configuration option for integrations configurations (#20765) Signed-off-by: croman --- stable/newrelic-infrastructure/Chart.yaml | 2 +- stable/newrelic-infrastructure/README.md | 5 +-- .../templates/configmap.yaml | 14 ++++++++ .../templates/daemonset.yaml | 9 ++++++ stable/newrelic-infrastructure/values.yaml | 32 +++++++++++++++++++ 5 files changed, 59 insertions(+), 3 deletions(-) diff --git a/stable/newrelic-infrastructure/Chart.yaml b/stable/newrelic-infrastructure/Chart.yaml index dd1d44ba23..2aae34cc20 100644 --- a/stable/newrelic-infrastructure/Chart.yaml +++ b/stable/newrelic-infrastructure/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v1 description: A Helm chart to deploy the New Relic Infrastructure Agent as a DaemonSet name: newrelic-infrastructure -version: 0.13.22 +version: 0.13.23 appVersion: 1.13.2 home: https://hub.docker.com/r/newrelic/infrastructure-k8s/ source: diff --git a/stable/newrelic-infrastructure/README.md b/stable/newrelic-infrastructure/README.md index ed7cd8f196..6c954c3f56 100644 --- a/stable/newrelic-infrastructure/README.md +++ b/stable/newrelic-infrastructure/README.md @@ -13,8 +13,9 @@ This chart will deploy the New Relic Infrastructure agent as a Daemonset. | `customSecretName` | Name of the Secret object where the license key is stored | | | `customSecretLicenseKey` | Key in the Secret object where the license key is stored. | | | `config` | A `newrelic.yml` file if you wish to provide. | | -| `kubeStateMetricsUrl` | If provided, the discovery process for kube-state-metrics endpoint won't be triggered. Example: http://172.17.0.3:8080 | -| `kubeStateMetricsPodLabel` | If provided, the kube-state-metrics pod will be discovered using this label. (should be `true` on target pod) | +| `integrations_config` | List of Integrations configuration to monitor services running on Kubernetes. More information on can be found [here](https://docs.newrelic.com/docs/integrations/kubernetes-integration/link-apps-services/monitor-services-running-kubernetes). | | +| `kubeStateMetricsUrl` | If provided, the discovery process for kube-state-metrics endpoint won't be triggered. Example: http://172.17.0.3:8080 | | +| `kubeStateMetricsPodLabel` | If provided, the kube-state-metrics pod will be discovered using this label. (should be `true` on target pod) | | | `kubeStateMetricsTimeout` | Timeout for accessing kube-state-metrics in milliseconds. If not set the newrelic default is 5000 | | | `rbac.create` | Enable Role-based authentication | `true` | | `rbac.pspEnabled` | Enable pod security policy support | `false` | diff --git a/stable/newrelic-infrastructure/templates/configmap.yaml b/stable/newrelic-infrastructure/templates/configmap.yaml index 1e9cc9a76f..5fd02ef651 100644 --- a/stable/newrelic-infrastructure/templates/configmap.yaml +++ b/stable/newrelic-infrastructure/templates/configmap.yaml @@ -8,3 +8,17 @@ data: newrelic-infra.yml: | {{ toYaml .Values.config | indent 6 }} {{ end }} +{{ if .Values.integrations_config }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + labels: {{ include "newrelic.labels" . | indent 4 }} + name: {{ template "newrelic.fullname" . }}-integrations-cfg +data: +{{ range .Values.integrations_config -}} +{{ .name | indent 2 }}: | + --- +{{ toYaml .data | indent 4 }} +{{ end }} +{{ end }} diff --git a/stable/newrelic-infrastructure/templates/daemonset.yaml b/stable/newrelic-infrastructure/templates/daemonset.yaml index 7a32f224c0..cb6c031327 100644 --- a/stable/newrelic-infrastructure/templates/daemonset.yaml +++ b/stable/newrelic-infrastructure/templates/daemonset.yaml @@ -107,6 +107,10 @@ spec: mountPath: /etc/newrelic-infra.yml subPath: newrelic-infra.yml {{- end }} + {{- if .Values.integrations_config }} + - name: nri-integrations-cfg-volume + mountPath: /etc/newrelic-infra/integrations.d/ + {{- end }} {{- if .Values.privileged }} - name: dev mountPath: /dev @@ -163,6 +167,11 @@ spec: - key: newrelic-infra.yml path: newrelic-infra.yml {{- end }} + {{- if .Values.integrations_config }} + - name: nri-integrations-cfg-volume + configMap: + name: {{ template "newrelic.fullname" . }}-integrations-cfg + {{- end }} {{- if $.Values.priorityClassName }} priorityClassName: {{ $.Values.priorityClassName }} {{- end }} diff --git a/stable/newrelic-infrastructure/values.yaml b/stable/newrelic-infrastructure/values.yaml index bdb0d42f3a..cffe62adf2 100644 --- a/stable/newrelic-infrastructure/values.yaml +++ b/stable/newrelic-infrastructure/values.yaml @@ -112,3 +112,35 @@ customAttribues: "'{\"clusterName\":\"$(CLUSTER_NAME)\"}'" # etcdTlsSecretName: newrelic-infra-etcd-tls-secret etcdTlsSecretNamespace: default + +# If you wish to monitor services running on Kubernetes you can provide integrations +# configuration under integrations_config. You just need to create a new entry where +# the "name" is the filename of the configuration file and the data is the content of +# the integration configuration. The name must end in ".yaml" as this will be the +# filename generated and the Infrastructure agent only looks for YAML files. The data +# part is the actual integration configuration as described in the spec here: +# https://docs.newrelic.com/docs/integrations/integrations-sdk/file-specifications/integration-configuration-file-specifications-agent-v180 + +# For example, if you wanted do to monitor a Redis instance that has a label "app=redis" +# you could do so by adding following entry: + # integrations_config: + # - name: nri-rabbit.yaml + # data: + # discovery: + # command: + # # Run NRI Discovery for Kubernetes + # # https://github.com/newrelic/nri-discovery-kubernetes + # exec: /var/db/newrelic-infra/nri-discovery-kubernetes + # match: + # label.app: redis + # integrations: + # - name: nri-redis + # env: + # # using the discovered IP as the hostname address + # HOSTNAME: ${discovery.ip} + # PORT: 6379 + # labels: + # env: test +# For more details on monitoring services on Kubernetes see +# https://docs.newrelic.com/docs/integrations/kubernetes-integration/link-apps-services/monitor-services-running-kubernetes +integrations_config: {}