diff --git a/incubator/logstash/.helmignore b/incubator/logstash/.helmignore new file mode 100644 index 0000000000..f0c1319444 --- /dev/null +++ b/incubator/logstash/.helmignore @@ -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 diff --git a/incubator/logstash/Chart.yaml b/incubator/logstash/Chart.yaml new file mode 100644 index 0000000000..c655f21386 --- /dev/null +++ b/incubator/logstash/Chart.yaml @@ -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 diff --git a/incubator/logstash/templates/NOTES.txt b/incubator/logstash/templates/NOTES.txt new file mode 100644 index 0000000000..8d494c1bd0 --- /dev/null +++ b/incubator/logstash/templates/NOTES.txt @@ -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 }} diff --git a/incubator/logstash/templates/_helpers.tpl b/incubator/logstash/templates/_helpers.tpl new file mode 100644 index 0000000000..c8bebdf713 --- /dev/null +++ b/incubator/logstash/templates/_helpers.tpl @@ -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 -}} diff --git a/incubator/logstash/templates/configmap.yaml b/incubator/logstash/templates/configmap.yaml new file mode 100644 index 0000000000..bfb364ed3a --- /dev/null +++ b/incubator/logstash/templates/configmap.yaml @@ -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 diff --git a/incubator/logstash/templates/deployment.yaml b/incubator/logstash/templates/deployment.yaml new file mode 100644 index 0000000000..640c9dc013 --- /dev/null +++ b/incubator/logstash/templates/deployment.yaml @@ -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 }} diff --git a/incubator/logstash/templates/ingress.yaml b/incubator/logstash/templates/ingress.yaml new file mode 100644 index 0000000000..2ea4f683f3 --- /dev/null +++ b/incubator/logstash/templates/ingress.yaml @@ -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 -}} diff --git a/incubator/logstash/templates/patterns-cm.yaml b/incubator/logstash/templates/patterns-cm.yaml new file mode 100644 index 0000000000..1a88d014f3 --- /dev/null +++ b/incubator/logstash/templates/patterns-cm.yaml @@ -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 }} diff --git a/incubator/logstash/templates/pipeline-cm.yaml b/incubator/logstash/templates/pipeline-cm.yaml new file mode 100644 index 0000000000..d4de32f6ba --- /dev/null +++ b/incubator/logstash/templates/pipeline-cm.yaml @@ -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 }} diff --git a/incubator/logstash/templates/service.yaml b/incubator/logstash/templates/service.yaml new file mode 100644 index 0000000000..ea40368e3c --- /dev/null +++ b/incubator/logstash/templates/service.yaml @@ -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 }} diff --git a/incubator/logstash/values.yaml b/incubator/logstash/values.yaml new file mode 100644 index 0000000000..f76d75ba49 --- /dev/null +++ b/incubator/logstash/values.yaml @@ -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}"] + } + }