Skip to content

Commit

Permalink
[charts/newrelic-logging] imported (#37)
Browse files Browse the repository at this point in the history
* [charts/newrelic-logging] imported chart

* [charts/newrelic-logging] added appVersion

* [charts/newrelic-logging] updated maintainers

Co-authored-by: Douglas Camata <[email protected]>
  • Loading branch information
jorikvdwerf and Douglas Camata authored May 21, 2020
1 parent da9b882 commit 3dab9de
Show file tree
Hide file tree
Showing 12 changed files with 518 additions and 1 deletion.
5 changes: 4 additions & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
# charts/<CHART_NAME>/* @<GITHUB_USER>

# Simple nginx chart for testing purposes

charts/simple-nginx/* @douglascamata

# Logging chart
charts/newrelic-logging/* @bmcfeely

# Kubernetes Integration chart
charts/newrelic-infrastructure/* @jorikvdwerf @douglascamata @alejandrodnm
13 changes: 13 additions & 0 deletions charts/newrelic-logging/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
description: A Helm chart to deploy New Relic Kubernetes Logging as a DaemonSet
name: newrelic-logging
version: 1.0.3
appVersion: 1.2.1
home: https://github.com/newrelic/kubernetes-logging
icon: https://newrelic.com/assets/newrelic/source/NewRelic-logo-square.svg
maintainers:
- name: bmcfeely
email: [email protected]
keywords:
- logging
- newrelic
63 changes: 63 additions & 0 deletions charts/newrelic-logging/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# newrelic-logging

## Chart Details

This chart will deploy the Fluentbit with the New Relic output plugin as a Daemonset.

## Configuration

See [values.yaml](values.yaml) for the default values

| Parameter | Description | Default |
| ---------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------ |
| `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. | |
| `global.customSecretName` - `customSecretName` | Name of the Secret object where the license key is stored | |
| `global.customSecretKey` - `customSecretKey` | Key in the Secret object where the license key is stored. | |
| `rbac.create` | Enable Role-based authentication | `true` |
| `image.repository` | The container to pull. | `newrelic/newrelic-fluentbit-output` |
| `image.pullPolicy` | The pull policy. | `IfNotPresent` |
| `image.tag` | The version of the container to pull. | See value in [values.yaml]` |
| `resources` | Any resources you wish to assign to the pod. | See Resources below |
| `priorityClassName` | Scheduling priority of the pod | `nil` |
| `nodeSelector` | Node label to use for scheduling | `nil` |
| `tolerations` | List of node taints to tolerate (requires Kubernetes >= 1.6) | See Tolerations below |
| `updateStrategy` | Strategy for DaemonSet updates (requires Kubernetes >= 1.6) | `RollingUpdate` |
| `serviveAccount.create` | If true, a service account would be created and assigned to the deployment | true |
| `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 | |

## Example

Make sure you have [added the New Relic chart repository.](../../README.md#installing-charts)

Then, to install this chart, run the following command:

```sh
helm install newrelic/newrelic-logging \
--set licenseKey=(your-license-key)
```

## Resources

The default set of resources assigned to the pods is shown below:

```yaml
resources:
limits:
cpu: 500m
memory: 128Mi
requests:
cpu: 250m
memory: 64Mi
```
## Tolerations
The default set of tolerations assigned to our daemonset is shown below:
```yaml
tolerations:
- operator: "Exists"
effect: "NoSchedule"
- operator: "Exists"
effect: "NoExecute"
```
18 changes: 18 additions & 0 deletions charts/newrelic-logging/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{{- if (include "newrelic-logging.areValuesValid" .) }}
Your deployment of the New Relic Kubernetes Logging 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-logging.fullname" . }}
{{- else -}}
##############################################################################
#### ERROR: You did not set a license key. ####
##############################################################################

This deployment will be incomplete until you get your API key from New Relic.

Then run:

helm upgrade {{ .Release.Name }} \
--set licenseKey=(your-license-key) \
newrelic/newrelic-logging

{{- end -}}
126 changes: 126 additions & 0 deletions charts/newrelic-logging/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "newrelic-logging.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
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-logging.fullname" -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if ne $name .Release.Name -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s" $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}


{{/* Generate basic labels */}}
{{- define "newrelic-logging.labels" }}
app: {{ template "newrelic-logging.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
heritage: {{.Release.Service }}
release: {{.Release.Name }}
app.kubernetes.io/name: {{ template "newrelic-logging.name" . }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "newrelic-logging.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create the name of the service account to use
*/}}
{{- define "newrelic-logging.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "newrelic-logging.fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}


{{/*
Create the name of the fluent bit config
*/}}
{{- define "newrelic-logging.fluentBitConfig" -}}
{{ template "newrelic-logging.fullname" . }}-fluent-bit-config
{{- end -}}

{{/*
Return the licenseKey
*/}}
{{- define "newrelic-logging.licenseKey" -}}
{{- if .Values.global}}
{{- if .Values.global.licenseKey }}
{{- .Values.global.licenseKey -}}
{{- else -}}
{{- .Values.licenseKey | default "" -}}
{{- end -}}
{{- else -}}
{{- .Values.licenseKey | default "" -}}
{{- end -}}
{{- end -}}

{{/*
Return the clusterName
*/}}
{{- define "newrelic-logging.clusterName" -}}
{{- if .Values.global}}
{{- if .Values.global.clusterName }}
{{- .Values.global.clusterName -}}
{{- else -}}
{{- .Values.clusterName | default "" -}}
{{- end -}}
{{- else -}}
{{- .Values.clusterName | default "" -}}
{{- end -}}
{{- end -}}

{{/*
Return the customSecretName
*/}}
{{- define "newrelic-logging.customSecretName" -}}
{{- if .Values.global }}
{{- if .Values.global.customSecretName }}
{{- .Values.global.customSecretName -}}
{{- else -}}
{{- .Values.customSecretName | default "" -}}
{{- end -}}
{{- else -}}
{{- .Values.customSecretName | default "" -}}
{{- end -}}
{{- end -}}

{{/*
Return the customSecretKey
*/}}
{{- define "newrelic-logging.customSecretKey" -}}
{{- if .Values.global }}
{{- if .Values.global.customSecretKey }}
{{- .Values.global.customSecretKey -}}
{{- else -}}
{{- .Values.customSecretKey | default "" -}}
{{- end -}}
{{- else -}}
{{- .Values.customSecretKey | default "" -}}
{{- end -}}
{{- end -}}

{{/*
Returns if the template should render, it checks if the required values are set.
*/}}
{{- define "newrelic-logging.areValuesValid" -}}
{{- $licenseKey := include "newrelic-logging.licenseKey" . -}}
{{- $customSecretName := include "newrelic-logging.customSecretName" . -}}
{{- $customSecretKey := include "newrelic-logging.customSecretKey" . -}}
{{- and (or $licenseKey (and $customSecretName $customSecretKey))}}
{{- end -}}
13 changes: 13 additions & 0 deletions charts/newrelic-logging/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{- if .Values.rbac.create }}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels: {{ include "newrelic-logging.labels" . | indent 4 }}
name: {{ template "newrelic-logging.fullname" . }}
rules:
- apiGroups: [""]
resources:
- namespaces
- pods
verbs: ["get", "list", "watch"]
{{- end -}}
15 changes: 15 additions & 0 deletions charts/newrelic-logging/templates/clusterrolebinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{{- if .Values.rbac.create }}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
labels: {{ include "newrelic-logging.labels" . | indent 4 }}
name: {{ template "newrelic-logging.fullname" . }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ template "newrelic-logging.fullname" . }}
subjects:
- kind: ServiceAccount
name: {{ template "newrelic-logging.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
{{- end -}}
70 changes: 70 additions & 0 deletions charts/newrelic-logging/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
apiVersion: v1
kind: ConfigMap
metadata:
labels: {{ include "newrelic-logging.labels" . | indent 4 }}
name: {{ template "newrelic-logging.fluentBitConfig" . }}
data:
# Configuration files: server, input, filters and output
# ======================================================
fluent-bit.conf: |
[SERVICE]
Flush 1
Log_Level ${LOG_LEVEL}
Daemon off
Parsers_File parsers.conf
HTTP_Server On
HTTP_Listen 0.0.0.0
HTTP_Port 2020
@INCLUDE input-kubernetes.conf
@INCLUDE output-newrelic.conf
@INCLUDE filter-kubernetes.conf
input-kubernetes.conf: |
[INPUT]
Name tail
Tag kube.*
Path ${PATH}
Parser docker
DB /var/log/flb_kube.db
Mem_Buf_Limit 7MB
Skip_Long_Lines On
Refresh_Interval 10
filter-kubernetes.conf: |
[FILTER]
Name record_modifier
Match *
Record cluster_name ${CLUSTER_NAME}
[FILTER]
Name kubernetes
Match kube.*
Kube_URL https://kubernetes.default.svc.cluster.local:443
Merge_JSON_Log Off
output-newrelic.conf: |
[OUTPUT]
Name newrelic
Match *
licenseKey ${LICENSE_KEY}
endpoint ${ENDPOINT}
maxBufferSize ${BUFFER_SIZE}
maxRecords ${MAX_RECORDS}
parsers.conf: |
[PARSER]
Name json
Format json
Time_Key time
Time_Format %d/%b/%Y:%H:%M:%S %z
[PARSER]
Name docker
Format json
Time_Key time
Time_Format %Y-%m-%dT%H:%M:%S.%L
Time_Keep On
# Command | Decoder | Field | Optional Action
# =============|==================|=================
Decode_Field_As escaped log
Loading

0 comments on commit 3dab9de

Please sign in to comment.