Skip to content

Commit

Permalink
feat: add chart logging-demo
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Sagi-Kazar <[email protected]>
  • Loading branch information
sagikazarmark committed Feb 9, 2023
1 parent 9352ddf commit c1ee3b3
Show file tree
Hide file tree
Showing 19 changed files with 638 additions and 0 deletions.
26 changes: 26 additions & 0 deletions charts/logging-demo/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/

ci/
README.md.gotmpl
29 changes: 29 additions & 0 deletions charts/logging-demo/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
apiVersion: v2
type: application
name: logging-demo
version: 4.0.0-rc17
appVersion: 4.0.0-rc17
kubeVersion: ">=1.16.0-0"
description: Logging operator demo application
keywords:
- logging
- fluentd
- fluentbit
home: https://kube-logging.github.io
sources:
- https://github.com/kube-logging/logging-operator
- https://github.com/kube-logging/helm-charts/tree/main/charts/logging-demo
annotations:
artifacthub.io/changes: |
- kind: changed
description: Moved to to location
dependencies:
- name: minio
version: 8.x.x
repository: https://helm.min.io/
condition: minio.enabled
- name: log-generator
version: 0.1.x
repository: https://kubernetes-charts.banzaicloud.com/
condition: logGenerator.enabled
60 changes: 60 additions & 0 deletions charts/logging-demo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# logging-demo

![version: 4.0.0-rc17](https://img.shields.io/badge/version-4.0.0--rc17-informational?style=flat-square) ![type: application](https://img.shields.io/badge/type-application-informational?style=flat-square) ![app version: 4.0.0-rc17](https://img.shields.io/badge/app%20version-4.0.0--rc17-informational?style=flat-square) ![kube version: >=1.16.0-0](https://img.shields.io/badge/kube%20version->=1.16.0--0-informational?style=flat-square) [![artifact hub](https://img.shields.io/badge/artifact%20hub-logging--demo-informational?style=flat-square)](https://artifacthub.io/packages/helm/kube-logging/logging-demo)

Logging operator demo application

**Homepage:** <https://kube-logging.github.io>

## TL;DR;

```bash
helm repo add kube-logging https://kube-logging.github.io/helm-charts
helm install --generate-name --wait kube-logging/logging-demo
```

## Introduction

This chart demonstrates the use of the [Logging Operator](https://github.com/kube-logging/helm-charts/tree/main/charts/logging-operator) with a
[Log-Generator](https://github.com/banzaicloud/log-generator) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.

## Prerequisites

- [Logging Operator](https://github.com/kube-logging/logging-operator) available on the cluster.

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| nameOverride | string | `""` | A name in place of the chart name for `app:` labels. |
| fullnameOverride | string | `""` | A name to substitute for the full names of resources. |
| loggingOperator.clusterDomain | string | `"cluster.local"` | |
| loggingOperator.controlNamespace | string | `nil` | |
| loggingOperator.fluentd | object | `{}` | Fluentd configuration |
| loggingOperator.fluentbit | object | `{}` | Fluentbit configuration |
| loggingOperator.tls.enabled | bool | `true` | Enable secure connection between fluentd and fluent-bit |
| loggingOperator.tls.fluentdSecretName | string | `""` | Specified secret name, which contain tls certs |
| loggingOperator.tls.fluentbitSecretName | string | `""` | Specified secret name, which contain tls certs |
| loggingOperator.tls.sharedKey | string | `""` | |
| file.enabled | bool | `false` | |
| minio.enabled | bool | `false` | |
| minio.existingSecret | string | `"logging-s3"` | |
| minio.persistence.enabled | bool | `false` | |
| minio.environment.MINIO_REGION | string | `"test_region"` | |
| minio.defaultBucket.enabled | bool | `true` | |
| minio.defaultBucket.name | string | `"demo"` | |
| minio.resources.requests.memory | string | `"256Mi"` | |
| elasticsearch.enabled | bool | `false` | Enable ElasticSearch logging output |
| loki.enabled | bool | `false` | Enable Grafana Loki logging output |
| kafka.enabled | bool | `false` | Enable Kafka logging output |
| cloudwatch.enabled | bool | `false` | Enable AWS Cloudwatch logging output |
| cloudwatch.aws.secret_key | string | `""` | |
| cloudwatch.aws.access_key | string | `""` | |
| cloudwatch.aws.region | string | `""` | |
| cloudwatch.aws.log_group_name | string | `""` | |
| cloudwatch.aws.log_stream_name | string | `""` | |
| logdna.enabled | bool | `false` | Enable LogDNA logging output |
| logdna.api_key | string | `""` | |
| logdna.app | string | `""` | |
| logdna.hostname | string | `""` | |
| logGenerator.enabled | bool | `true` | Enable Demo Log-Gen application |
12 changes: 12 additions & 0 deletions charts/logging-demo/README.md.gotmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{ template "chart.baseHead" . }}

## Introduction

This chart demonstrates the use of the [Logging Operator](https://github.com/kube-logging/helm-charts/tree/main/charts/logging-operator) with a
[Log-Generator](https://github.com/banzaicloud/log-generator) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.

## Prerequisites

- [Logging Operator](https://github.com/kube-logging/logging-operator) available on the cluster.

{{ template "chart.valuesSection" . }}
65 changes: 65 additions & 0 deletions charts/logging-demo/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "logging-demo.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).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "logging-demo.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{- define "flow.fullname" -}}
{{- printf "%s-%s" (include "logging-demo.fullname" .) "flow" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{- define "output.fullname" -}}
{{- printf "%s-%s" (include "logging-demo.fullname" .) "output" | trunc 63 | trimSuffix "-" -}}
{{- end -}}


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

{{/*
Common labels
*/}}
{{- define "logging-demo.labels" -}}
app.kubernetes.io/name: {{ include "logging-demo.name" . }}
helm.sh/chart: {{ include "logging-demo.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}

{{/*
Formats the cluster domain as a suffix, e.g.:
.Values.loggingOperator.clusterDomain == "", returns ""
.Values.loggingOperator.clusterDomain == "cluster.local", returns ".cluster.local"
*/}}
{{- define "logging-demo.clusterDomainAsSuffix" -}}
{{- if .Values.loggingOperator.clusterDomain -}}
{{- printf ".%s" .Values.loggingOperator.clusterDomain -}}
{{- end -}}
{{- end -}}
44 changes: 44 additions & 0 deletions charts/logging-demo/templates/flow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
apiVersion: logging.banzaicloud.io/v1beta1
kind: Flow
metadata:
name: {{ include "flow.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{ include "logging-demo.labels" . | indent 4 }}
spec:
filters:
- tag_normaliser: {}
- parser:
remove_key_name_field: true
reserve_data: true
parse:
type: nginx
match:
- select:
labels:
app.kubernetes.io/name: log-generator
app.kubernetes.io/instance: {{ .Release.Name }}
localOutputRefs:

{{- if or .Values.file.enabled (and (not .Values.cloudwatch.enabled) (not .Values.elasticsearch.enabled) (not .Values.kafka.enabled) (not .Values.loki.enabled) (not .Values.minio.enabled) (not .Values.logdna.enabled)) }}
- {{ include "output.fullname" . }}-file
{{- end }}
{{- if .Values.cloudwatch.enabled }}
- {{ include "output.fullname" . }}-cloudwatch
{{- end }}
{{- if .Values.elasticsearch.enabled }}
- {{ include "output.fullname" . }}-elasticsearch
{{- end }}
{{- if .Values.kafka.enabled }}
- {{ include "output.fullname" . }}-kafka
{{- end }}
{{- if .Values.loki.enabled }}
- {{ include "output.fullname" . }}-loki
{{- end }}
{{- if .Values.minio.enabled }}
- {{ include "output.fullname" . }}-minio
{{- end }}
{{- if .Values.logdna.enabled }}
- {{ include "output.fullname" . }}-logdna
{{- end }}

31 changes: 31 additions & 0 deletions charts/logging-demo/templates/logging.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
apiVersion: logging.banzaicloud.io/v1beta1
kind: Logging
metadata:
name: {{ include "logging-demo.fullname" . }}
spec:
syslogNG:
metrics:
path: "/metrics"
{{- if .Values.loggingOperator.tls.enabled }}
tls:
enabled: true
secretName: {{ .Values.loggingOperator.tls.fluentdSecretName | default (printf "%s-%s" (include "logging-demo.name" . ) "fluentd-tls" ) }}
sharedKey: "{{ .Values.loggingOperator.tls.sharedKey }}"
{{- end }}
{{- if .Values.loggingOperator.fluentd }}
{{ toYaml .Values.loggingOperator.fluentd | indent 4}}
{{- end}}

fluentbit:
{{- if .Values.loggingOperator.tls.enabled }}
tls:
enabled: true
secretName: {{ .Values.loggingOperator.tls.fluentbitSecretName | default (printf "%s-%s" (include "logging-demo.name" . ) "fluentbit-tls" ) }}
sharedKey: "{{ .Values.loggingOperator.tls.sharedKey }}"
{{- end }}
{{- if .Values.loggingOperator.fluentbit }}
{{ toYaml .Values.loggingOperator.fluentbit | indent 4}}
{{- end}}

clusterDomain: {{ .Values.loggingOperator.clusterDomain }}
controlNamespace: {{ .Values.loggingOperator.controlNamespace | default .Release.Namespace }}
29 changes: 29 additions & 0 deletions charts/logging-demo/templates/output_cloudwatch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{{- if and .Values.cloudwatch.enabled }}
apiVersion: logging.banzaicloud.io/v1beta1
kind: Output
metadata:
name: {{ include "output.fullname" . }}-cloudwatch
namespace: {{ .Release.Namespace }}
labels:
{{ include "logging-demo.labels" . | indent 4 }}
spec:
cloudwatch:
aws_key_id:
valueFrom:
secretKeyRef:
name: logging-cloudwatch
key: accesskey
aws_sec_key:
valueFrom:
secretKeyRef:
name: logging-cloudwatch
key: secretkey
log_group_name: {{ .Values.cloudwatch.aws.log_group_name }}
log_stream_name: {{ .Values.cloudwatch.aws.log_stream_name }}
region: {{ .Values.cloudwatch.aws.region }}
auto_create_stream: true
buffer:
timekey: 30s
timekey_wait: 30s
timekey_use_utc: true
{{- end }}
26 changes: 26 additions & 0 deletions charts/logging-demo/templates/output_elasticsearch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{{- if and .Values.elasticsearch.enabled }}
apiVersion: logging.banzaicloud.io/v1beta1
kind: Output
metadata:
name: {{ include "output.fullname" . }}-elasticsearch
namespace: {{ .Release.Namespace }}
labels:
{{ include "logging-demo.labels" . | indent 4 }}
spec:
elasticsearch:
host: quickstart-es-http.{{ .Release.Namespace }}
port: 9200
scheme: https
ssl_verify: false
ssl_version: TLSv1_2
user: elastic
password:
valueFrom:
secretKeyRef:
name: quickstart-es-elastic-user
key: elastic
buffer:
timekey: 1m
timekey_wait: 30s
timekey_use_utc: true
{{- end }}
16 changes: 16 additions & 0 deletions charts/logging-demo/templates/output_file.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{- if or .Values.file.enabled (and (not .Values.cloudwatch.enabled) (not .Values.elasticsearch.enabled) (not .Values.kafka.enabled) (not .Values.loki.enabled) (not .Values.minio.enabled) (not .Values.logdna.enabled)) }}
apiVersion: logging.banzaicloud.io/v1beta1
kind: Output
metadata:
name: {{ include "output.fullname" . }}-file
namespace: {{ .Release.Namespace }}
labels:
{{ include "logging-demo.labels" . | indent 4 }}
spec:
file:
path: /tmp/logs/${tag}/%Y/%m/%d.%H.%M
buffer:
timekey: 1m
timekey_wait: 30s
timekey_use_utc: true
{{- end }}
20 changes: 20 additions & 0 deletions charts/logging-demo/templates/output_kafka.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{{- if and .Values.kafka.enabled }}
apiVersion: logging.banzaicloud.io/v1beta1
kind: Output
metadata:
name: {{ include "output.fullname" . }}-kafka
namespace: {{ .Release.Namespace }}
labels:
{{ include "logging-demo.labels" . | indent 4 }}
spec:
kafka:
brokers: kafka-headless.kafka.svc.cluster.local:29092
default_topic: topic
format:
type: json
buffer:
tags: topic
timekey: 1m
timekey_wait: 30s
timekey_use_utc: true
{{- end }}
15 changes: 15 additions & 0 deletions charts/logging-demo/templates/output_logdna.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{{- if and .Values.logdna.enabled }}
apiVersion: logging.banzaicloud.io/v1beta1
kind: Output
metadata:
name: {{ include "output.fullname" . }}-logdna
namespace: {{ .Release.Namespace }}
labels:
{{ include "logging-demo.labels" . | indent 4 }}
spec:
logdna:
api_key: {{ .Values.logdna.api_key }}
{{/* hostname: {{ .Values.logdna.hostname }}*/}}
hostname: "$.kubernetes.host"
app: {{ .Values.logdna.app }}
{{- end }}
Loading

0 comments on commit c1ee3b3

Please sign in to comment.