Skip to content

Commit c302ebc

Browse files
author
jorikvdwerf
authored
[charts/newrelic-infrastructure] imported (#31)
* [charts/newrelic-infrastructure] copied over chart from official (deprecated) helm repo * [charts/newrelic-infrastructure] updated codeowners according to repo structure * [charts/newrelic-infrastructure] updated installation instructions * [charts/newrelic-infrastructure] test CI * [charts/newrelic-infrastructure] updated NOTES.txt to point to new chart location * [charts/newrelic-infrastructure] CI not working, forcing new commit * [charts/newrelic-infrastructure] added test licenseKey
1 parent f4a7dc4 commit c302ebc

15 files changed

+774
-1
lines changed

CODEOWNERS

+2
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@
88
# Simple nginx chart for testing purposes
99

1010
charts/simple-nginx/* @douglascamata
11+
12+
charts/newrelic-infrastructure/* @jorikvdwerf @douglascamata @alejandrodnm

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ helm repo add newrelic https://helm-charts.newrelic.com
3535
You can list all the available charts from the `newrelic` repository using [`helm search`][helm-search]:
3636

3737
```sh
38-
helm search repo | grep newrelic/
38+
helm search repo newrelic/
3939
```
4040

4141
To install one of the charts, run [`helm install`][helm-install] passing the name of the chart to install and the values you want to set as arguments. You can find a list of all the values and their defaults in the documentation of each chart.
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apiVersion: v1
2+
description: A Helm chart to deploy the New Relic Infrastructure Agent as a DaemonSet
3+
name: newrelic-infrastructure
4+
version: 0.13.32
5+
appVersion: 1.20.0
6+
home: https://hub.docker.com/r/newrelic/infrastructure-k8s/
7+
source:
8+
- https://github.com/kubernetes/kubernetes/tree/master/examples/newrelic-infrastructure
9+
engine: gotpl
10+
icon: https://newrelic.com/assets/newrelic/source/NewRelic-logo-square.svg
11+
maintainers:
12+
- name: rk295
13+
14+
- name: jfjoly
15+
16+
- name: areina
17+
- name: douglascamata
18+
- name: jorikvdwerf
19+
- name: alejandrodnm
20+
- name: rk295
21+
keywords:
22+
- infrastructure
23+
- newrelic
24+
- monitoring
+100
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# newrelic-infrastructure
2+
3+
## Chart Details
4+
5+
This chart will deploy the New Relic Infrastructure agent as a Daemonset.
6+
7+
## Configuration
8+
9+
| Parameter | Description | Default |
10+
| ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------- |
11+
| `cluster` | The cluster name for the Kubernetes cluster. | |
12+
| `licenseKey` | The [license key](https://docs.newrelic.com/docs/accounts/install-new-relic/account-setup/license-key) for your New Relic Account. This will be preferred configuration option if both `licenseKey` and `customSecret` are specified. | |
13+
| `customSecretName` | Name of the Secret object where the license key is stored | |
14+
| `customSecretLicenseKey` | Key in the Secret object where the license key is stored. | |
15+
| `config` | A `newrelic.yml` file if you wish to provide. | |
16+
| `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). | |
17+
| `disableKubeStateMetrics` | Disables kube-state-metrics data parsing if the value is ` true`. | `false` |
18+
| `kubeStateMetricsUrl` | If provided, the discovery process for kube-state-metrics endpoint won't be triggered. Example: http://172.17.0.3:8080 | |
19+
| `kubeStateMetricsPodLabel` | If provided, the kube-state-metrics pod will be discovered using this label. (should be `true` on target pod) | |
20+
| `kubeStateMetricsTimeout` | Timeout for accessing kube-state-metrics in milliseconds. If not set the newrelic default is 5000 | |
21+
| `kubeStateMetricsScheme` | If `kubeStateMetricsPodLabel` is present, it changes the scheme used to send to request to the pod. | `http` |
22+
| `kubeStateMetricsPort` | If `kubeStateMetricsPodLabel` is present, it changes the port queried in the pod. | 8080 |
23+
| `rbac.create` | Enable Role-based authentication | `true` |
24+
| `rbac.pspEnabled` | Enable pod security policy support | `false` |
25+
| `privileged` | Enable privileged mode. | `true` |
26+
| `image.repository` | The container to pull. | `newrelic/infrastructure` |
27+
| `image.pullPolicy` | The pull policy. | `IfNotPresent` |
28+
| `image.tag` | The version of the container to pull. | `1.20.0` |
29+
| `resources` | Any resources you wish to assign to the pod. | See Resources below |
30+
| `verboseLog` | Should the agent log verbosely. (Boolean) | `false` |
31+
| `priorityClassName` | Scheduling priority of the pod | `nil` |
32+
| `nodeSelector` | Node label to use for scheduling | `nil` |
33+
| `tolerations` | List of node taints to tolerate (requires Kubernetes >= 1.6) | See Tolerarions below |
34+
| `updateStrategy` | Strategy for DaemonSet updates (requires Kubernetes >= 1.6) | `RollingUpdate` |
35+
| `serviveAccount.create` | If true, a service account would be created and assigned to the deployment | true |
36+
| `serviveAccount.name` | The service account to assign to the deployment. If `serviveAccount.create` is true then this name will be used when creating the service account | |
37+
| `etcdTlsSecretName` | Name of the secret containing the cacert, cert and key used for setting the mTLS config for retrieving metrics from ETCD. | |
38+
| `etcdTlsSecretNamespace` | Namespace where the secret specified in `etcdTlsSecretName` was created. | `default` |
39+
| `etcdEndpointUrl` | Explicitly sets the etcd component url. | |
40+
| `apiServerSecurePort` | Set to query the API Server over a secure port. | |
41+
| `apiServerEndpointUrl` | Explicitly sets the api server componenturl. | |
42+
| `schedulerEndpointUrl` | Explicitly sets the scheduler component url. | |
43+
| `controllerManagerEndpointUrl` | Explicitly sets the controller manager component url. | |
44+
| `eventQueueDepth` | Iincreases the in-memory cache of the agent to accommodate for more samples at a time.
45+
46+
## Example
47+
48+
Make sure you have [added the New Relic chart repository.](../../README.md#installing-charts)
49+
50+
Then, to install this chart, run the following command:
51+
52+
```sh
53+
helm install newrelic/newrelic-infrastructure \
54+
--set licenseKey=<enter_new_relic_license_key> \
55+
--set cluster=my-k8s-cluster
56+
```
57+
58+
## Globals
59+
60+
**Important:** global parameters have higher precedence than locals with the same name.
61+
62+
These are meant to be used when you are writing a chart with subcharts. It helps to avoid
63+
setting values multiple times on different subcharts.
64+
65+
More information on globals and subcharts can be found at [Helm's official documentation](https://helm.sh/docs/topics/chart_template_guide/subcharts_and_globals/).
66+
67+
| Parameter |
68+
| ------------------------------- |
69+
| `global.cluster` |
70+
| `global.licenseKey` |
71+
| `global.customSecretName` |
72+
| `global.customSecretLicenseKey` |
73+
74+
## Resources
75+
76+
The default set of resources assigned to the pods is shown below:
77+
78+
```yaml
79+
resources:
80+
limits:
81+
memory: 150M
82+
requests:
83+
cpu: 100m
84+
memory: 30M
85+
```
86+
87+
## Tolerations
88+
89+
The default set of relations assigned to our daemonset is shown below:
90+
91+
```yaml
92+
- operator: "Exists"
93+
effect: "NoSchedule"
94+
- operator: "Exists"
95+
effect: "NoExecute"
96+
```
97+
98+
# Config file
99+
100+
If you wish to provide your own `newrelic.yml` you may do so under `config`. There are a few notable exceptions you should be aware of. Some options have been omitted because they are handled either by variables, or a secret. They are `display_name`, `license_key`, `log_file` and `verbose`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
global:
2+
licenseKey: 1234567890abcdef1234567890abcdef12345678
3+
cluster: test-cluster
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{{- if (include "newrelic.areValuesValid" .) }}
2+
Your deployment of the New Relic Infrastructure agent is complete. You can check on the progress of this by running the following command:
3+
4+
kubectl get daemonset -o wide -w --namespace {{ .Release.Namespace }} {{ template "newrelic.fullname" . }}
5+
{{- else -}}
6+
##############################################################################
7+
#### ERROR: You did not set a licenseKey and/or cluster name. ####
8+
##############################################################################
9+
10+
This deployment will be incomplete until you get your API key from New Relic.
11+
12+
Then run:
13+
14+
helm upgrade {{ .Release.Name }} \
15+
--set licenseKey=YOUR-KEY-HERE \
16+
--set cluster=YOUR-CLUSTER-NAME \
17+
newrelic/newrelic-infrastructure
18+
19+
{{- end -}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
{{/* vim: set filetype=mustache: */}}
2+
{{/*
3+
Expand the name of the chart.
4+
*/}}
5+
{{- define "newrelic.name" -}}
6+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
7+
{{- end -}}
8+
9+
{{/*
10+
Create a default fully qualified app name.
11+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
12+
*/}}
13+
{{- define "newrelic.fullname" -}}
14+
{{- $name := default .Chart.Name .Values.nameOverride -}}
15+
{{- if ne $name .Release.Name -}}
16+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
17+
{{- else -}}
18+
{{- printf "%s" $name | trunc 63 | trimSuffix "-" -}}
19+
{{- end -}}
20+
{{- end -}}
21+
22+
{{/* Generate mode label */}}
23+
{{- define "newrelic.mode" }}
24+
{{- if .Values.privileged -}}
25+
privileged
26+
{{- else -}}
27+
unprivileged
28+
{{- end }}
29+
{{- end -}}
30+
31+
{{/* Generate basic labels */}}
32+
{{- define "newrelic.labels" }}
33+
app: {{ template "newrelic.name" . }}
34+
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
35+
heritage: {{.Release.Service }}
36+
release: {{.Release.Name }}
37+
mode: {{ template "newrelic.mode" . }}
38+
{{- end }}
39+
40+
{{/*
41+
Create chart name and version as used by the chart label.
42+
*/}}
43+
{{- define "newrelic.chart" -}}
44+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
45+
{{- end -}}
46+
47+
{{/*
48+
Create the name of the service account to use
49+
*/}}
50+
{{- define "newrelic.serviceAccountName" -}}
51+
{{- if .Values.serviceAccount.create -}}
52+
{{ default (include "newrelic.fullname" .) .Values.serviceAccount.name }}
53+
{{- else -}}
54+
{{ default "default" .Values.serviceAccount.name }}
55+
{{- end -}}
56+
{{- end -}}
57+
58+
{{/*
59+
Create the image name depending on the "privileged" flag
60+
*/}}
61+
{{- define "newrelic.image" -}}
62+
{{- if .Values.privileged -}}
63+
"{{ .Values.image.repository }}:{{ .Values.image.tag }}"
64+
{{- else -}}
65+
"{{ .Values.image.repository }}:{{ .Values.image.tag }}-unprivileged"
66+
{{- end -}}
67+
{{- end -}}
68+
69+
{{/*
70+
Return the licenseKey
71+
*/}}
72+
{{- define "newrelic.licenseKey" -}}
73+
{{- if .Values.global}}
74+
{{- if .Values.global.licenseKey }}
75+
{{- .Values.global.licenseKey -}}
76+
{{- else -}}
77+
{{- .Values.licenseKey | default "" -}}
78+
{{- end -}}
79+
{{- else -}}
80+
{{- .Values.licenseKey | default "" -}}
81+
{{- end -}}
82+
{{- end -}}
83+
84+
{{/*
85+
Return the cluster
86+
*/}}
87+
{{- define "newrelic.cluster" -}}
88+
{{- if .Values.global -}}
89+
{{- if .Values.global.cluster -}}
90+
{{- .Values.global.cluster -}}
91+
{{- else -}}
92+
{{- .Values.cluster | default "" -}}
93+
{{- end -}}
94+
{{- else -}}
95+
{{- .Values.cluster | default "" -}}
96+
{{- end -}}
97+
{{- end -}}
98+
99+
{{/*
100+
Return the customSecretName
101+
*/}}
102+
{{- define "newrelic.customSecretName" -}}
103+
{{- if .Values.global }}
104+
{{- if .Values.global.customSecretName }}
105+
{{- .Values.global.customSecretName -}}
106+
{{- else -}}
107+
{{- .Values.customSecretName | default "" -}}
108+
{{- end -}}
109+
{{- else -}}
110+
{{- .Values.customSecretName | default "" -}}
111+
{{- end -}}
112+
{{- end -}}
113+
114+
{{/*
115+
Return the customSecretLicenseKey
116+
*/}}
117+
{{- define "newrelic.customSecretLicenseKey" -}}
118+
{{- if .Values.global }}
119+
{{- if .Values.global.customSecretLicenseKey }}
120+
{{- .Values.global.customSecretLicenseKey -}}
121+
{{- else -}}
122+
{{- .Values.customSecretLicenseKey | default "" -}}
123+
{{- end -}}
124+
{{- else -}}
125+
{{- .Values.customSecretLicenseKey | default "" -}}
126+
{{- end -}}
127+
{{- end -}}
128+
129+
{{/*
130+
Returns if the template should render, it checks if the required values
131+
licenseKey and cluster are set.
132+
*/}}
133+
{{- define "newrelic.areValuesValid" -}}
134+
{{- $cluster := include "newrelic.cluster" . -}}
135+
{{- $licenseKey := include "newrelic.licenseKey" . -}}
136+
{{- $customSecretName := include "newrelic.customSecretName" . -}}
137+
{{- $customSecretLicenseKey := include "newrelic.customSecretLicenseKey" . -}}
138+
{{- and (or $licenseKey (and $customSecretName $customSecretLicenseKey)) $cluster}}
139+
{{- end -}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{{- if .Values.rbac.create }}
2+
apiVersion: rbac.authorization.k8s.io/v1
3+
kind: ClusterRole
4+
metadata:
5+
labels: {{ include "newrelic.labels" . | indent 4 }}
6+
name: {{ template "newrelic.fullname" . }}
7+
rules:
8+
- apiGroups: [""]
9+
resources:
10+
- "nodes"
11+
- "nodes/metrics"
12+
- "nodes/stats"
13+
- "nodes/proxy"
14+
- "pods"
15+
- "services"
16+
- "secrets"
17+
verbs: ["get", "list"]
18+
- nonResourceURLs: ["/metrics"]
19+
verbs: ["get"]
20+
{{- if .Values.rbac.pspEnabled }}
21+
- apiGroups:
22+
- extensions
23+
resources:
24+
- podsecuritypolicies
25+
resourceNames:
26+
- privileged-{{ template "newrelic.fullname" . }}
27+
verbs:
28+
- use
29+
{{- end -}}
30+
{{- end -}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{{- if .Values.rbac.create }}
2+
apiVersion: rbac.authorization.k8s.io/v1
3+
kind: ClusterRoleBinding
4+
metadata:
5+
labels: {{ include "newrelic.labels" . | indent 4 }}
6+
name: {{ template "newrelic.fullname" . }}
7+
roleRef:
8+
apiGroup: rbac.authorization.k8s.io
9+
kind: ClusterRole
10+
name: {{ template "newrelic.fullname" . }}
11+
subjects:
12+
- kind: ServiceAccount
13+
name: {{ template "newrelic.serviceAccountName" . }}
14+
namespace: {{ .Release.Namespace }}
15+
{{- end -}}

0 commit comments

Comments
 (0)