mirror of
https://github.com/helm/charts.git
synced 2026-08-23 22:37:45 +00:00
Adds NewRelic beta Kubernetes integration (#4917)
* adds new relic beta kubernetes integration * fix labels * adding labels to cluster role
This commit is contained in:
committed by
k8s-ci-robot
parent
c11e1e0f10
commit
78c4b01630
@@ -1,8 +1,8 @@
|
||||
apiVersion: v1
|
||||
description: A Helm chart to deploy the New Relic Infrastructure Agent as a DaemonSet
|
||||
name: newrelic-infrastructure
|
||||
version: 0.0.4
|
||||
appVersion: 0.0.12
|
||||
version: 0.1.0
|
||||
appVersion: 0.0.19
|
||||
home: https://hub.docker.com/r/newrelic/infrastructure/
|
||||
source:
|
||||
- https://github.com/kubernetes/kubernetes/tree/master/examples/newrelic-infrastructure
|
||||
|
||||
@@ -8,10 +8,11 @@ This chart will deploy the New Relic Infrastructure agent as a Daemonset.
|
||||
|
||||
| Parameter | Description | Default |
|
||||
| ------------------ | ------------------------------------------------------------ | -------------------------- |
|
||||
| `config` | A `newrelic-infra.yml` file if you wish to provide. | ` ` |
|
||||
| `cluster` | The cluster name for the Kubernetes cluster. | `` |
|
||||
| `config` | A `newrelic.yml` file if you wish to provide. | ` ` |
|
||||
| `image.name` | The container to pull. | `newrelic/infrastructure` |
|
||||
| `image.pullPolicy` | The pull policy. | `IfNotPresent` |
|
||||
| `image.tag` | The version of the container to pull. | `0.0.11` |
|
||||
| `image.tag` | The version of the container to pull. | `1.0.0-beta1.0` |
|
||||
| `licenseKey` | The license key for your New Relic Account. | `` |
|
||||
| `resources` | Any resources you wish to assign to the pod. | See Resources below |
|
||||
| `verboseLog` | Should the agent log verbosely. (Boolean) | `false` |
|
||||
@@ -32,4 +33,4 @@ The default set of resources assigned to the pods is shown below:
|
||||
|
||||
# Config file
|
||||
|
||||
If you wish to provide your own `newrelic-infra.yml` you may do so under `config`. There are a few notable exceptions you should be aware of. Three options have been omitted because they are handled either by variables, or a secret. They are license_key, log_file and verbose.
|
||||
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. Three options have been omitted because they are handled either by variables, or a secret. They are license_key, log_file and verbose.
|
||||
|
||||
@@ -1,17 +1,19 @@
|
||||
{{- if .Values.licenseKey -}}
|
||||
{{- if and .Values.licenseKey .Values.cluster }}
|
||||
Your deployment of the New Relic Infrastructure agent is complete. You can check on the progress of this by running the following command:
|
||||
|
||||
kubectl get daemonset -o wide -w --namespace {{ .Release.Namespace }} {{ template "newrelic-infra.fullname" . }}
|
||||
kubectl get daemonset -o wide -w --namespace {{ .Release.Namespace }} {{ template "newrelic.fullname" . }}
|
||||
{{- else -}}
|
||||
##############################################################################
|
||||
#### ERROR: You did not set a licenseKey. ####
|
||||
#### ERROR: You did not set a licenseKey and cluster name. ####
|
||||
##############################################################################
|
||||
|
||||
This deployment will be incomplete until you get your API key from New Relic.
|
||||
This deployment will be incomplete until you get your API key from New Relic.
|
||||
|
||||
Then run:
|
||||
|
||||
helm upgrade {{ .Release.Name }} \
|
||||
--set licenseKey=YOUR-KEY-HERE stable/newrelic-infrastructure
|
||||
--set licenseKey=YOUR-KEY-HERE \
|
||||
--set cluster=YOUR-CLUSTER-NAME \
|
||||
stable/newrelic-infrastructure
|
||||
|
||||
{{- end -}}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "newrelic-infra.name" -}}
|
||||
{{- define "newrelic.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -10,7 +10,7 @@ Expand the name of the chart.
|
||||
Create a default fully qualified app name.
|
||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||
*/}}
|
||||
{{- define "newrelic-infra.fullname" -}}
|
||||
{{- define "newrelic.fullname" -}}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
||||
{{- if ne $name .Release.Name -}}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
|
||||
@@ -20,9 +20,27 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
|
||||
{{- end -}}
|
||||
|
||||
{{/* Generate basic labels */}}
|
||||
{{- define "newrelic-infra.labels" }}
|
||||
app: {{ template "newrelic-infra.name" . }}
|
||||
{{- define "newrelic.labels" }}
|
||||
app: {{ template "newrelic.name" . }}
|
||||
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
|
||||
heritage: {{.Release.Service }}
|
||||
release: {{.Release.Name }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create chart name and version as used by the chart label.
|
||||
*/}}
|
||||
{{- define "newrelic.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create the name of the service account to use
|
||||
*/}}
|
||||
{{- define "newrelic.serviceAccountName" -}}
|
||||
{{- if .Values.serviceAccount.create -}}
|
||||
{{ default (include "newrelic.fullname" .) .Values.serviceAccount.name }}
|
||||
{{- else -}}
|
||||
{{ default "default" .Values.serviceAccount.name }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
{{ if .Values.config }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
labels: {{ include "newrelic-infra.labels" . | indent 4 }}
|
||||
name: {{ template "newrelic-infra.fullname" . }}
|
||||
labels: {{ include "newrelic.labels" . | indent 4 }}
|
||||
name: {{ template "newrelic.fullname" . }}
|
||||
data:
|
||||
newrelic-infra.yml: |
|
||||
{{ toYaml .Values.config | indent 6 }}
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
{{- if .Values.licenseKey }}
|
||||
apiVersion: extensions/v1beta1
|
||||
{{- if and .Values.licenseKey .Values.cluster }}
|
||||
apiVersion: apps/v1
|
||||
kind: DaemonSet
|
||||
metadata:
|
||||
labels: {{ include "newrelic-infra.labels" . | indent 4 }}
|
||||
name: {{ template "newrelic-infra.fullname" . }}
|
||||
labels: {{ include "newrelic.labels" . | indent 4 }}
|
||||
name: {{ template "newrelic.fullname" . }}
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: {{ template "newrelic.name" . }}
|
||||
release: {{.Release.Name }}
|
||||
template:
|
||||
metadata:
|
||||
{{- if .Values.podAnnotations }}
|
||||
@@ -12,41 +16,48 @@ spec:
|
||||
{{ toYaml .Values.podAnnotations | indent 8}}
|
||||
{{- end }}
|
||||
labels:
|
||||
app: {{ template "newrelic-infra.name" . }}
|
||||
app: {{ template "newrelic.name" . }}
|
||||
release: {{.Release.Name }}
|
||||
{{- if .Values.podLabels}}
|
||||
{{ toYaml .Values.podLabels }}
|
||||
{{- end }}
|
||||
spec:
|
||||
hostPID: true
|
||||
hostIPC: true
|
||||
hostNetwork: true
|
||||
serviceAccountName: {{ template "newrelic.serviceAccountName" . }}
|
||||
containers:
|
||||
- name: {{ template "newrelic-infra.name" . }}
|
||||
- name: {{ template "newrelic.name" . }}
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
||||
imagePullPolicy: "{{ .Values.image.pullPolicy }}"
|
||||
securityContext:
|
||||
privileged: true
|
||||
command: [ "bash", "-c", "source /etc/kube-nr-infra/config && /usr/bin/newrelic-infra -config /etc/newrelic/newrelic-infra.yml" ]
|
||||
{{- if or (.Values.verboseLog) (.Values.logFile) }}
|
||||
env:
|
||||
- name: NRIA_LICENSE_KEY
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ template "newrelic.fullname" . }}-config
|
||||
key: license
|
||||
- name: "CLUSTER_NAME"
|
||||
value: "{{ .Values.cluster }}"
|
||||
- name: "NRIA_DISPLAY_NAME"
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
apiVersion: "v1"
|
||||
fieldPath: "spec.nodeName"
|
||||
- name: "NRIA_PASSTHROUGH_ENVIRONMENT"
|
||||
value: "KUBERNETES_SERVICE_HOST,KUBERNETES_SERVICE_PORT,CLUSTER_NAME"
|
||||
{{- if .Values.verboseLog }}
|
||||
- name: NRIA_VERBOSE
|
||||
value: 1
|
||||
value: "1"
|
||||
{{- end }}
|
||||
{{- if .Values.logFile }}
|
||||
- name: NRIA_LOG_FILE
|
||||
value: {{ .Values.logFile }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
{{- if .Values.config }}
|
||||
- name: config
|
||||
mountPath: /etc/newrelic/
|
||||
mountPath: /etc/newrelic
|
||||
subPath: newrelic-infra.yml
|
||||
{{- end }}
|
||||
- name: newrelic-config
|
||||
mountPath: /etc/kube-nr-infra
|
||||
readOnly: true
|
||||
- name: dev
|
||||
mountPath: /dev
|
||||
- name: run
|
||||
@@ -61,9 +72,6 @@ spec:
|
||||
{{ toYaml .Values.resources | indent 12 }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
- name: newrelic-config
|
||||
secret:
|
||||
secretName: {{ template "newrelic-infra.fullname" . }}-config
|
||||
- name: dev
|
||||
hostPath:
|
||||
path: /dev
|
||||
@@ -76,14 +84,12 @@ spec:
|
||||
- name: host-root
|
||||
hostPath:
|
||||
path: /
|
||||
{{- if .Values.config }}
|
||||
- name: config
|
||||
configMap:
|
||||
name: {{ template "newrelic-infra.fullname" . }}
|
||||
name: {{ template "newrelic.fullname" . }}
|
||||
items:
|
||||
- key: newrelic-infra.yml
|
||||
path: newrelic-infra.yml
|
||||
{{- end }}
|
||||
{{- if $.Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{ toYaml $.Values.nodeSelector | indent 8 }}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
{{- if .Values.rbac.create }}
|
||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
labels: {{ include "newrelic.labels" . | indent 4 }}
|
||||
name: {{ template "newrelic.fullname" . }}
|
||||
rules:
|
||||
- apiGroups: [""]
|
||||
resources:
|
||||
- "nodes"
|
||||
- "nodes/stats"
|
||||
- "nodes/proxy"
|
||||
- "pods"
|
||||
- "services"
|
||||
verbs: ["get", "list"]
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
labels: {{ include "newrelic.labels" . | indent 4 }}
|
||||
name: {{ template "newrelic.fullname" . }}
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: {{ template "newrelic.fullname" . }}
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ template "newrelic.serviceAccountName" . }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- end -}}
|
||||
@@ -1,8 +1,10 @@
|
||||
{{- if .Values.licenseKey }}
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
labels: {{ include "newrelic-infra.labels" . | indent 4 }}
|
||||
name: {{ template "newrelic-infra.fullname" . }}-config
|
||||
labels: {{ include "newrelic.labels" . | indent 4 }}
|
||||
name: {{ template "newrelic.fullname" . }}-config
|
||||
type: Opaque
|
||||
data:
|
||||
config: {{ ( printf "export NRIA_LICENSE_KEY=%s" .Values.licenseKey ) | b64enc }}
|
||||
license: {{ .Values.licenseKey | b64enc }}
|
||||
{{- end }}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
{{- if .Values.serviceAccount.create }}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
labels:
|
||||
app: {{ template "newrelic.name" . }}
|
||||
chart: {{ template "newrelic.chart" . }}
|
||||
heritage: "{{ .Release.Service }}"
|
||||
release: "{{ .Release.Name }}"
|
||||
name: {{ template "newrelic.serviceAccountName" . }}
|
||||
{{- end -}}
|
||||
@@ -1,14 +1,18 @@
|
||||
# IMPORTANT: Specify your New Relic API key here.
|
||||
# licenseKey:
|
||||
|
||||
# IMPORTANT: The Kubernetes cluster name
|
||||
# https://docs.newrelic.com/docs/kubernetes-monitoring-integration
|
||||
# cluster: ""
|
||||
|
||||
verboseLog: false
|
||||
|
||||
# This can be set, the default is shown below
|
||||
# logFile: /var/log/nr-infra.log
|
||||
|
||||
image:
|
||||
repository: newrelic/infrastructure
|
||||
tag: 0.0.12
|
||||
repository: newrelic/infrastructure-k8s
|
||||
tag: 1.0.0-beta1.0
|
||||
pullPolicy: IfNotPresent
|
||||
|
||||
resources:
|
||||
@@ -19,6 +23,17 @@ resources:
|
||||
cpu: 100m
|
||||
memory: 128Mi
|
||||
|
||||
rbac:
|
||||
# Specifies whether RBAC resources should be created
|
||||
create: true
|
||||
|
||||
serviceAccount:
|
||||
# Specifies whether a ServiceAccount should be created
|
||||
create: true
|
||||
# The name of the ServiceAccount to use.
|
||||
# If not set and create is true, a name is generated using the fullname template
|
||||
name:
|
||||
|
||||
# If you wish to provide additional labels to apply to the pod(s), specify
|
||||
# them here
|
||||
# podLabels:
|
||||
|
||||
Reference in New Issue
Block a user