[incubator/logstash] Add logstash Chart (#2952)

This commit is contained in:
Johnathan Rodgers
2017-12-15 16:44:49 +01:00
committed by Reinhard Nägele
parent 568291d6e4
commit 5fdb84fdf4
11 changed files with 329 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
# 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
*~
# Various IDEs
.project
.idea/
*.tmproj
+14
View File
@@ -0,0 +1,14 @@
apiVersion: v1
description: A Helm chart for logstash
icon: https://www.elastic.co/assets/blt86e4472872eed314/logo-elastic-logstash-lt.svg
name: logstash
version: 0.3.0
appVersion: 6.0.0
sources:
- https://www.docker.elastic.co
- https://www.elastic.co/guide/en/logstash/current/index.html
maintainers:
- name: rendhalver
email: pete.brown@powerhrg.com
- name: jar361
email: jrodgers@powerhrg.com
+19
View File
@@ -0,0 +1,19 @@
1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range .Values.ingress.hosts }}
http://{{ . }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "logstash.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get svc -w {{ template "logstash.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "logstash.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo http://$SERVICE_IP:{{ .Values.service.externalPort }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "logstash.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl port-forward $POD_NAME 8080:{{ .Values.service.internalPort }}
{{- end }}
+16
View File
@@ -0,0 +1,16 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "logstash.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 "logstash.fullname" -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
@@ -0,0 +1,14 @@
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "logstash.fullname" . }}
labels:
app: {{ template "logstash.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
data:
logstash.yml: |-
http.host: "0.0.0.0"
path.config: /usr/share/logstash/pipeline
@@ -0,0 +1,64 @@
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: {{ template "logstash.fullname" . }}
labels:
app: {{ template "logstash.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
replicas: {{ .Values.replicaCount }}
template:
metadata:
labels:
app: {{ template "logstash.name" . }}
release: {{ .Release.Name }}
spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
{{- range $port := .Values.service.ports }}
- name: {{ $port.serviceName }}
containerPort: {{ $port.containerPort }}
protocol: {{ $port.protocol }}
{{- end }}
livenessProbe:
tcpSocket:
port: {{ .Values.service.internalPort }}
readinessProbe:
tcpSocket:
port: {{ .Values.service.internalPort }}
env:
- name: ELASTICSEARCH_HOST
value: {{ .Values.elasticsearch.host | quote }}
- name: ELASTICSEARCH_PORT
value: {{ .Values.elasticsearch.port | quote }}
- name: SYSLOG_PORT
value: {{ .Values.service.internalPort | quote }}
volumeMounts:
- name: config
mountPath: /usr/share/logstash/config/logstash.yml
subPath: logstash.yml
- name: pipeline
mountPath: /usr/share/logstash/pipeline
- name: patterns
mountPath: /usr/share/logstash/patterns
resources:
{{ toYaml .Values.resources | indent 12 }}
volumes:
- name: config
configMap:
name: {{ template "logstash.fullname" . }}
- name: pipeline
configMap:
name: {{ template "logstash.fullname" . }}-pipeline
- name: patterns
configMap:
name: {{ template "logstash.fullname" . }}-patterns
{{- if .Values.nodeSelector }}
nodeSelector:
{{ toYaml .Values.nodeSelector | indent 8 }}
{{- end }}
+32
View File
@@ -0,0 +1,32 @@
{{- if .Values.ingress.enabled -}}
{{- $serviceName := include "logstash.fullname" . -}}
{{- $servicePort := .Values.service.externalPort -}}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: {{ template "logstash.fullname" . }}
labels:
app: {{ template "logstash.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
annotations:
{{- range $key, $value := .Values.ingress.annotations }}
{{ $key }}: {{ $value | quote }}
{{- end }}
spec:
rules:
{{- range $host := .Values.ingress.hosts }}
- host: {{ $host.name }}
http:
paths:
- path: /
backend:
serviceName: {{ $host.serviceName }}
servicePort: {{ $host.servicePort }}
{{- end -}}
{{- if .Values.ingress.tls }}
tls:
{{ toYaml .Values.ingress.tls | indent 4 }}
{{- end -}}
{{- end -}}
@@ -0,0 +1,15 @@
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "logstash.fullname" . }}-patterns
labels:
app: {{ template "logstash.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
data:
{{- range $key, $value := .Values.patterns }}
{{ $key }}: |-
{{ $value | indent 4 }}
{{- end }}
@@ -0,0 +1,25 @@
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "logstash.fullname" . }}-pipeline
labels:
app: {{ template "logstash.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
data:
{{- range $key, $value := .Values.inputs }}
input_{{ $key }}: |-
{{ $value | indent 4 }}
{{- end }}
{{- range $key, $value := .Values.filters }}
filter_{{ $key }}: |-
{{ $value | indent 4 }}
{{- end }}
{{- range $key, $value := .Values.outputs }}
output_{{ $key }}: |-
{{ $value | indent 4 }}
{{- end }}
+21
View File
@@ -0,0 +1,21 @@
apiVersion: v1
kind: Service
metadata:
name: {{ template "logstash.fullname" . }}
labels:
app: {{ template "logstash.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
type: {{ .Values.service.type }}
ports:
{{- range $port := .Values.service.ports }}
- name: {{ $port.name }}
port: {{ $port.containerPort }}
protocol: {{ $port.protocol }}
targetPort: {{ $port.containerPort }}
{{- end }}
selector:
app: {{ template "logstash.name" . }}
release: {{ .Release.Name }}
+88
View File
@@ -0,0 +1,88 @@
# Default values for logstash.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
replicaCount: 1
image:
repository: docker.elastic.co/logstash/logstash-oss
tag: 6.0.0
pullPolicy: IfNotPresent
service:
type: NodePort
internalPort: 1514
ports:
- name: "syslog-tcp"
protocol: TCP
containerPort: 1514
- name: "syslog-udp"
protocol: UDP
containerPort: 1514
- name: "filebeat-tcp"
protocol: TCP
containerPort: 5044
ingress:
enabled: false
# Used to create an Ingress and Service record.
# hosts:
# - name: "logstash-udp.local"
# protocol: UDP
# serviceName: logstash-udp
# servicePort: 514
annotations:
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
tls:
# Secrets must be manually created in the namespace.
# - secretName: chart-example-tls
# hosts:
# - chart-example.local
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
elasticsearch:
host: "elasticsearch-client.default.svc.cluster.local"
port: 9200
# patterns for filters
# each element will be turned into it's own pattern file
patterns:
# testpattern: |-
# TESTING {"foo":.*}$
inputs:
main: |-
input {
tcp {
port => "${SYSLOG_PORT}"
type => syslog
}
udp {
port => 1514
type => syslog
}
beats {
port => 5044
}
}
filters:
# main: |-
# filter {
# }
outputs:
main: |-
output {
elasticsearch {
hosts => ["${ELASTICSEARCH_HOST}:${ELASTICSEARCH_PORT}"]
}
}