Skip to content

Commit

Permalink
feat: add elasticsearch, fluent-bit, and kibana
Browse files Browse the repository at this point in the history
* add charts used to support EFK stack for logging and visualization
  • Loading branch information
dmccaffery committed Nov 5, 2019
1 parent c85cb50 commit 0cf6720
Show file tree
Hide file tree
Showing 97 changed files with 3,977 additions and 1 deletion.
2 changes: 2 additions & 0 deletions charts/elastic/elasticsearch/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tests/
.pytest_cache/
12 changes: 12 additions & 0 deletions charts/elastic/elasticsearch/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
appVersion: 7.4.1
description: Official Elastic helm chart for Elasticsearch
home: https://github.com/elastic/helm-charts
icon: https://helm.elastic.co/icons/elasticsearch.png
maintainers:
- email: helm-charts@elastic.co
name: Elastic
name: elasticsearch
sources:
- https://github.com/elastic/elasticsearch
version: 7.4.1
1 change: 1 addition & 0 deletions charts/elastic/elasticsearch/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include ../helpers/common.mk
315 changes: 315 additions & 0 deletions charts/elastic/elasticsearch/README.md

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions charts/elastic/elasticsearch/examples/6.x/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
default: test
include ../../../helpers/examples.mk

RELEASE := helm-es-six

install:
helm upgrade --wait --timeout=600 --install $(RELEASE) --values ./values.yaml ../../

restart:
helm upgrade --set terminationGracePeriod=121 --wait --timeout=600 --install $(RELEASE) --values ./values.yaml ../../

test: install goss

purge:
helm del --purge $(RELEASE)
17 changes: 17 additions & 0 deletions charts/elastic/elasticsearch/examples/6.x/test/goss.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
http:
http://localhost:9200/_cluster/health:
status: 200
timeout: 2000
body:
- 'green'
- '"number_of_nodes":3'
- '"number_of_data_nodes":3'

http://localhost:9200:
status: 200
timeout: 2000
body:
- '"number" : "6.8.4"'
- '"cluster_name" : "six"'
- '"name" : "six-master-0"'
- 'You Know, for Search'
4 changes: 4 additions & 0 deletions charts/elastic/elasticsearch/examples/6.x/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---

clusterName: "six"
imageTag: "6.8.4"
19 changes: 19 additions & 0 deletions charts/elastic/elasticsearch/examples/config/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
default: test
include ../../../helpers/examples.mk

RELEASE := helm-es-config

install:
helm upgrade --wait --timeout=600 --install $(RELEASE) --values ./values.yaml ../../

secrets:
kubectl delete secret elastic-config-credentials elastic-config-secret elastic-config-slack elastic-config-custom-path || true
kubectl create secret generic elastic-config-credentials --from-literal=password=changeme --from-literal=username=elastic
kubectl create secret generic elastic-config-slack --from-literal=xpack.notification.slack.account.monitoring.secure_url='https://hooks.slack.com/services/asdasdasd/asdasdas/asdasd'
kubectl create secret generic elastic-config-secret --from-file=xpack.watcher.encryption_key=./watcher_encryption_key
kubectl create secret generic elastic-config-custom-path --from-literal=slack_url='https://hooks.slack.com/services/asdasdasd/asdasdas/asdasd' --from-literal=thing_i_don_tcare_about=test

test: secrets install goss

purge:
helm del --purge $(RELEASE)
3 changes: 3 additions & 0 deletions charts/elastic/elasticsearch/examples/config/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Config

An example testing suite for testing some of the optional features of this chart.
26 changes: 26 additions & 0 deletions charts/elastic/elasticsearch/examples/config/test/goss.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
http:
http://localhost:9200/_cluster/health:
status: 200
timeout: 2000
body:
- 'green'
- '"number_of_nodes":1'
- '"number_of_data_nodes":1'

http://localhost:9200:
status: 200
timeout: 2000
body:
- '"cluster_name" : "config"'
- '"name" : "config-master-0"'
- 'You Know, for Search'

command:
"elasticsearch-keystore list":
exit-status: 0
stdout:
- keystore.seed
- bootstrap.password
- xpack.notification.slack.account.monitoring.secure_url
- xpack.notification.slack.account.otheraccount.secure_url
- xpack.watcher.encryption_key
31 changes: 31 additions & 0 deletions charts/elastic/elasticsearch/examples/config/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---

clusterName: "config"
replicas: 1

extraEnvs:
- name: ELASTIC_PASSWORD
valueFrom:
secretKeyRef:
name: elastic-credentials
key: password
- name: ELASTIC_USERNAME
valueFrom:
secretKeyRef:
name: elastic-credentials
key: username

# This is just a dummy file to make sure that
# the keystore can be mounted at the same time
# as a custom elasticsearch.yml
esConfig:
elasticsearch.yml: |
path.data: /usr/share/elasticsearch/data
keystore:
- secretName: elastic-config-secret
- secretName: elastic-config-slack
- secretName: elastic-config-custom-path
items:
- key: slack_url
path: xpack.notification.slack.account.otheraccount.secure_url
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
supersecret
16 changes: 16 additions & 0 deletions charts/elastic/elasticsearch/examples/default/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
default: test

include ../../../helpers/examples.mk

RELEASE := helm-es-default

install:
helm upgrade --wait --timeout=600 --install $(RELEASE) ../../

restart:
helm upgrade --set terminationGracePeriod=121 --wait --timeout=600 --install $(RELEASE) ../../

test: install goss

purge:
helm del --purge $(RELEASE)
19 changes: 19 additions & 0 deletions charts/elastic/elasticsearch/examples/default/rolling_upgrade.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash -x

kubectl proxy || true &

make &
PROC_ID=$!

while kill -0 "$PROC_ID" >/dev/null 2>&1; do
echo "PROCESS IS RUNNING"
if curl --fail 'http://localhost:8001/api/v1/proxy/namespaces/default/services/elasticsearch-master:9200/_search' ; then
echo "cluster is healthy"
else
echo "cluster not healthy!"
exit 1
fi
sleep 1
done
echo "PROCESS TERMINATED"
exit 0
39 changes: 39 additions & 0 deletions charts/elastic/elasticsearch/examples/default/test/goss.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
kernel-param:
vm.max_map_count:
value: '262144'

http:
http://elasticsearch-master:9200/_cluster/health:
status: 200
timeout: 2000
body:
- 'green'
- '"number_of_nodes":3'
- '"number_of_data_nodes":3'

http://localhost:9200:
status: 200
timeout: 2000
body:
- '"number" : "7.4.1"'
- '"cluster_name" : "elasticsearch"'
- '"name" : "elasticsearch-master-0"'
- 'You Know, for Search'

file:
/usr/share/elasticsearch/data:
exists: true
mode: "2775"
owner: root
group: elasticsearch
filetype: directory

mount:
/usr/share/elasticsearch/data:
exists: true

user:
elasticsearch:
exists: true
uid: 1000
gid: 1000
12 changes: 12 additions & 0 deletions charts/elastic/elasticsearch/examples/docker-for-mac/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
default: test

RELEASE := helm-es-docker-for-mac

install:
helm upgrade --wait --timeout=900 --install --values values.yaml $(RELEASE) ../../

test: install
helm test $(RELEASE)

purge:
helm del --purge $(RELEASE)
23 changes: 23 additions & 0 deletions charts/elastic/elasticsearch/examples/docker-for-mac/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
# Permit co-located instances for solitary minikube virtual machines.
antiAffinity: "soft"

# Shrink default JVM heap.
esJavaOpts: "-Xmx128m -Xms128m"

# Allocate smaller chunks of memory per pod.
resources:
requests:
cpu: "100m"
memory: "512M"
limits:
cpu: "1000m"
memory: "512M"

# Request smaller persistent volumes.
volumeClaimTemplate:
accessModes: [ "ReadWriteOnce" ]
storageClassName: "hostpath"
resources:
requests:
storage: 100M
12 changes: 12 additions & 0 deletions charts/elastic/elasticsearch/examples/kubernetes-kind/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
default: test

RELEASE := helm-es-kind

install:
helm upgrade --wait --timeout=900 --install --values values.yaml $(RELEASE) ../../

test: install
helm test $(RELEASE)

purge:
helm del --purge $(RELEASE)
36 changes: 36 additions & 0 deletions charts/elastic/elasticsearch/examples/kubernetes-kind/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
# Permit co-located instances for solitary minikube virtual machines.
antiAffinity: "soft"

# Shrink default JVM heap.
esJavaOpts: "-Xmx128m -Xms128m"

# Allocate smaller chunks of memory per pod.
resources:
requests:
cpu: "100m"
memory: "512M"
limits:
cpu: "1000m"
memory: "512M"

# Request smaller persistent volumes.
volumeClaimTemplate:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 100M
extraInitContainers: |
- name: create
image: busybox:1.28
command: ['mkdir', '/usr/share/elasticsearch/data/nodes/']
volumeMounts:
- mountPath: /usr/share/elasticsearch/data
name: elasticsearch-master
- name: file-permissions
image: busybox:1.28
command: ['chown', '-R', '1000:1000', '/usr/share/elasticsearch/']
volumeMounts:
- mountPath: /usr/share/elasticsearch/data
name: elasticsearch-master
10 changes: 10 additions & 0 deletions charts/elastic/elasticsearch/examples/migration/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
PREFIX := helm-es-migration

data:
helm upgrade --wait --timeout=600 --install --values ./data.yml $(PREFIX)-data ../../

master:
helm upgrade --wait --timeout=600 --install --values ./master.yml $(PREFIX)-master ../../

client:
helm upgrade --wait --timeout=600 --install --values ./client.yml $(PREFIX)-client ../../
Loading

0 comments on commit 0cf6720

Please sign in to comment.