Skip to content

Commit 3dab9de

Browse files
jorikvdwerfDouglas Camata
jorikvdwerf
and
Douglas Camata
authored
[charts/newrelic-logging] imported (#37)
* [charts/newrelic-logging] imported chart * [charts/newrelic-logging] added appVersion * [charts/newrelic-logging] updated maintainers Co-authored-by: Douglas Camata <[email protected]>
1 parent da9b882 commit 3dab9de

12 files changed

+518
-1
lines changed

CODEOWNERS

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
# charts/<CHART_NAME>/* @<GITHUB_USER>
77

88
# Simple nginx chart for testing purposes
9-
109
charts/simple-nginx/* @douglascamata
1110

11+
# Logging chart
12+
charts/newrelic-logging/* @bmcfeely
13+
14+
# Kubernetes Integration chart
1215
charts/newrelic-infrastructure/* @jorikvdwerf @douglascamata @alejandrodnm

charts/newrelic-logging/Chart.yaml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: v1
2+
description: A Helm chart to deploy New Relic Kubernetes Logging as a DaemonSet
3+
name: newrelic-logging
4+
version: 1.0.3
5+
appVersion: 1.2.1
6+
home: https://github.com/newrelic/kubernetes-logging
7+
icon: https://newrelic.com/assets/newrelic/source/NewRelic-logo-square.svg
8+
maintainers:
9+
- name: bmcfeely
10+
11+
keywords:
12+
- logging
13+
- newrelic

charts/newrelic-logging/README.md

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# newrelic-logging
2+
3+
## Chart Details
4+
5+
This chart will deploy the Fluentbit with the New Relic output plugin as a Daemonset.
6+
7+
## Configuration
8+
9+
See [values.yaml](values.yaml) for the default values
10+
11+
| Parameter | Description | Default |
12+
| ---------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------ |
13+
| `global.licenseKey` - `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 the preferred configuration option if both `licenseKey` and `customSecret*` values are specified. | |
14+
| `global.customSecretName` - `customSecretName` | Name of the Secret object where the license key is stored | |
15+
| `global.customSecretKey` - `customSecretKey` | Key in the Secret object where the license key is stored. | |
16+
| `rbac.create` | Enable Role-based authentication | `true` |
17+
| `image.repository` | The container to pull. | `newrelic/newrelic-fluentbit-output` |
18+
| `image.pullPolicy` | The pull policy. | `IfNotPresent` |
19+
| `image.tag` | The version of the container to pull. | See value in [values.yaml]` |
20+
| `resources` | Any resources you wish to assign to the pod. | See Resources below |
21+
| `priorityClassName` | Scheduling priority of the pod | `nil` |
22+
| `nodeSelector` | Node label to use for scheduling | `nil` |
23+
| `tolerations` | List of node taints to tolerate (requires Kubernetes >= 1.6) | See Tolerations below |
24+
| `updateStrategy` | Strategy for DaemonSet updates (requires Kubernetes >= 1.6) | `RollingUpdate` |
25+
| `serviveAccount.create` | If true, a service account would be created and assigned to the deployment | true |
26+
| `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 | |
27+
28+
## Example
29+
30+
Make sure you have [added the New Relic chart repository.](../../README.md#installing-charts)
31+
32+
Then, to install this chart, run the following command:
33+
34+
```sh
35+
helm install newrelic/newrelic-logging \
36+
--set licenseKey=(your-license-key)
37+
```
38+
39+
## Resources
40+
41+
The default set of resources assigned to the pods is shown below:
42+
43+
```yaml
44+
resources:
45+
limits:
46+
cpu: 500m
47+
memory: 128Mi
48+
requests:
49+
cpu: 250m
50+
memory: 64Mi
51+
```
52+
53+
## Tolerations
54+
55+
The default set of tolerations assigned to our daemonset is shown below:
56+
57+
```yaml
58+
tolerations:
59+
- operator: "Exists"
60+
effect: "NoSchedule"
61+
- operator: "Exists"
62+
effect: "NoExecute"
63+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{{- if (include "newrelic-logging.areValuesValid" .) }}
2+
Your deployment of the New Relic Kubernetes Logging 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-logging.fullname" . }}
5+
{{- else -}}
6+
##############################################################################
7+
#### ERROR: You did not set a license key. ####
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-license-key) \
16+
newrelic/newrelic-logging
17+
18+
{{- end -}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
{{/* vim: set filetype=mustache: */}}
2+
{{/*
3+
Expand the name of the chart.
4+
*/}}
5+
{{- define "newrelic-logging.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-logging.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+
23+
{{/* Generate basic labels */}}
24+
{{- define "newrelic-logging.labels" }}
25+
app: {{ template "newrelic-logging.name" . }}
26+
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
27+
heritage: {{.Release.Service }}
28+
release: {{.Release.Name }}
29+
app.kubernetes.io/name: {{ template "newrelic-logging.name" . }}
30+
{{- end }}
31+
32+
{{/*
33+
Create chart name and version as used by the chart label.
34+
*/}}
35+
{{- define "newrelic-logging.chart" -}}
36+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
37+
{{- end -}}
38+
39+
{{/*
40+
Create the name of the service account to use
41+
*/}}
42+
{{- define "newrelic-logging.serviceAccountName" -}}
43+
{{- if .Values.serviceAccount.create -}}
44+
{{ default (include "newrelic-logging.fullname" .) .Values.serviceAccount.name }}
45+
{{- else -}}
46+
{{ default "default" .Values.serviceAccount.name }}
47+
{{- end -}}
48+
{{- end -}}
49+
50+
51+
{{/*
52+
Create the name of the fluent bit config
53+
*/}}
54+
{{- define "newrelic-logging.fluentBitConfig" -}}
55+
{{ template "newrelic-logging.fullname" . }}-fluent-bit-config
56+
{{- end -}}
57+
58+
{{/*
59+
Return the licenseKey
60+
*/}}
61+
{{- define "newrelic-logging.licenseKey" -}}
62+
{{- if .Values.global}}
63+
{{- if .Values.global.licenseKey }}
64+
{{- .Values.global.licenseKey -}}
65+
{{- else -}}
66+
{{- .Values.licenseKey | default "" -}}
67+
{{- end -}}
68+
{{- else -}}
69+
{{- .Values.licenseKey | default "" -}}
70+
{{- end -}}
71+
{{- end -}}
72+
73+
{{/*
74+
Return the clusterName
75+
*/}}
76+
{{- define "newrelic-logging.clusterName" -}}
77+
{{- if .Values.global}}
78+
{{- if .Values.global.clusterName }}
79+
{{- .Values.global.clusterName -}}
80+
{{- else -}}
81+
{{- .Values.clusterName | default "" -}}
82+
{{- end -}}
83+
{{- else -}}
84+
{{- .Values.clusterName | default "" -}}
85+
{{- end -}}
86+
{{- end -}}
87+
88+
{{/*
89+
Return the customSecretName
90+
*/}}
91+
{{- define "newrelic-logging.customSecretName" -}}
92+
{{- if .Values.global }}
93+
{{- if .Values.global.customSecretName }}
94+
{{- .Values.global.customSecretName -}}
95+
{{- else -}}
96+
{{- .Values.customSecretName | default "" -}}
97+
{{- end -}}
98+
{{- else -}}
99+
{{- .Values.customSecretName | default "" -}}
100+
{{- end -}}
101+
{{- end -}}
102+
103+
{{/*
104+
Return the customSecretKey
105+
*/}}
106+
{{- define "newrelic-logging.customSecretKey" -}}
107+
{{- if .Values.global }}
108+
{{- if .Values.global.customSecretKey }}
109+
{{- .Values.global.customSecretKey -}}
110+
{{- else -}}
111+
{{- .Values.customSecretKey | default "" -}}
112+
{{- end -}}
113+
{{- else -}}
114+
{{- .Values.customSecretKey | default "" -}}
115+
{{- end -}}
116+
{{- end -}}
117+
118+
{{/*
119+
Returns if the template should render, it checks if the required values are set.
120+
*/}}
121+
{{- define "newrelic-logging.areValuesValid" -}}
122+
{{- $licenseKey := include "newrelic-logging.licenseKey" . -}}
123+
{{- $customSecretName := include "newrelic-logging.customSecretName" . -}}
124+
{{- $customSecretKey := include "newrelic-logging.customSecretKey" . -}}
125+
{{- and (or $licenseKey (and $customSecretName $customSecretKey))}}
126+
{{- end -}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{{- if .Values.rbac.create }}
2+
apiVersion: rbac.authorization.k8s.io/v1
3+
kind: ClusterRole
4+
metadata:
5+
labels: {{ include "newrelic-logging.labels" . | indent 4 }}
6+
name: {{ template "newrelic-logging.fullname" . }}
7+
rules:
8+
- apiGroups: [""]
9+
resources:
10+
- namespaces
11+
- pods
12+
verbs: ["get", "list", "watch"]
13+
{{- 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-logging.labels" . | indent 4 }}
6+
name: {{ template "newrelic-logging.fullname" . }}
7+
roleRef:
8+
apiGroup: rbac.authorization.k8s.io
9+
kind: ClusterRole
10+
name: {{ template "newrelic-logging.fullname" . }}
11+
subjects:
12+
- kind: ServiceAccount
13+
name: {{ template "newrelic-logging.serviceAccountName" . }}
14+
namespace: {{ .Release.Namespace }}
15+
{{- end -}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
labels: {{ include "newrelic-logging.labels" . | indent 4 }}
5+
name: {{ template "newrelic-logging.fluentBitConfig" . }}
6+
data:
7+
# Configuration files: server, input, filters and output
8+
# ======================================================
9+
fluent-bit.conf: |
10+
[SERVICE]
11+
Flush 1
12+
Log_Level ${LOG_LEVEL}
13+
Daemon off
14+
Parsers_File parsers.conf
15+
HTTP_Server On
16+
HTTP_Listen 0.0.0.0
17+
HTTP_Port 2020
18+
19+
@INCLUDE input-kubernetes.conf
20+
@INCLUDE output-newrelic.conf
21+
@INCLUDE filter-kubernetes.conf
22+
23+
input-kubernetes.conf: |
24+
[INPUT]
25+
Name tail
26+
Tag kube.*
27+
Path ${PATH}
28+
Parser docker
29+
DB /var/log/flb_kube.db
30+
Mem_Buf_Limit 7MB
31+
Skip_Long_Lines On
32+
Refresh_Interval 10
33+
34+
filter-kubernetes.conf: |
35+
[FILTER]
36+
Name record_modifier
37+
Match *
38+
Record cluster_name ${CLUSTER_NAME}
39+
40+
[FILTER]
41+
Name kubernetes
42+
Match kube.*
43+
Kube_URL https://kubernetes.default.svc.cluster.local:443
44+
Merge_JSON_Log Off
45+
46+
output-newrelic.conf: |
47+
[OUTPUT]
48+
Name newrelic
49+
Match *
50+
licenseKey ${LICENSE_KEY}
51+
endpoint ${ENDPOINT}
52+
maxBufferSize ${BUFFER_SIZE}
53+
maxRecords ${MAX_RECORDS}
54+
55+
parsers.conf: |
56+
[PARSER]
57+
Name json
58+
Format json
59+
Time_Key time
60+
Time_Format %d/%b/%Y:%H:%M:%S %z
61+
62+
[PARSER]
63+
Name docker
64+
Format json
65+
Time_Key time
66+
Time_Format %Y-%m-%dT%H:%M:%S.%L
67+
Time_Keep On
68+
# Command | Decoder | Field | Optional Action
69+
# =============|==================|=================
70+
Decode_Field_As escaped log

0 commit comments

Comments
 (0)