Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.

Commit

Permalink
Merge pull request #121 from elastic/beam_em_up
Browse files Browse the repository at this point in the history
Add integration tests and other tweaks for filebeat
  • Loading branch information
Crazybus authored May 9, 2019
2 parents 7461e94 + 1ce8dbe commit 9b406f8
Show file tree
Hide file tree
Showing 37 changed files with 388 additions and 84 deletions.
2 changes: 1 addition & 1 deletion elasticsearch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ This chart is tested with the latest supported versions. The currently tested ve

| 5.x | 6.x | 7.x |
| ------ | ----- | ----- |
| 5.6.16 | 6.7.1 | 7.0.1 |
| 5.6.16 | 6.7.2 | 7.0.1 |

Examples of installing older major versions can be found in the [examples](./examples) directory.

Expand Down
2 changes: 1 addition & 1 deletion elasticsearch/examples/6.x/test/goss.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ http:
status: 200
timeout: 2000
body:
- '"number" : "6.7.1"'
- '"number" : "6.7.2"'
- '"cluster_name" : "six"'
- '"name" : "six-master-0"'
- 'You Know, for Search'
2 changes: 1 addition & 1 deletion elasticsearch/examples/6.x/values.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---

clusterName: "six"
imageTag: "6.7.1"
imageTag: "6.7.2"
esMajorVersion: 6
12 changes: 12 additions & 0 deletions elasticsearch/examples/oss/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
default: test
include ../../../helpers/examples.mk

RELEASE := helm-es-oss

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

test: install goss

purge:
helm del --purge $(RELEASE)
17 changes: 17 additions & 0 deletions elasticsearch/examples/oss/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" : "7.0.1"'
- '"cluster_name" : "oss"'
- '"name" : "oss-master-0"'
- 'You Know, for Search'
4 changes: 4 additions & 0 deletions elasticsearch/examples/oss/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---

clusterName: "oss"
image: "docker.elastic.co/elasticsearch/elasticsearch-oss"
4 changes: 2 additions & 2 deletions filebeat/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ maintainers:
- email: [email protected]
name: Elastic
name: filebeat
version: 7.0.0-alpha1
appVersion: 7.0.0
version: 7.0.1-alpha1
appVersion: 7.0.1
sources:
- https://github.com/elastic/beats
icon: https://helm.elastic.co/icons/filebeat.png
51 changes: 26 additions & 25 deletions filebeat/README.md

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions filebeat/examples/6.x/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
default: test

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

RELEASE := helm-filebeat-six

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

test: install goss

purge:
helm del --purge $(RELEASE)
21 changes: 21 additions & 0 deletions filebeat/examples/6.x/test/goss.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
port:
tcp:5066:
listening: true
ip:
- '127.0.0.1'

mount:
/usr/share/filebeat/data:
exists: true
user:
filebeat:
exists: true
uid: 1000
gid: 1000

http:
http://six-master:9200/_cat/indices:
status: 200
timeout: 2000
body:
- 'filebeat-6.7.2'
5 changes: 5 additions & 0 deletions filebeat/examples/6.x/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
imageTag: 6.7.2

extraEnvs:
- name: ELASTICSEARCH_HOSTS
value: six-master:9200
2 changes: 1 addition & 1 deletion filebeat/examples/default/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ include ../../../helpers/examples.mk
RELEASE := helm-filebeat-default

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

test: install goss

Expand Down
32 changes: 32 additions & 0 deletions filebeat/examples/default/test/goss.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,41 @@ port:
mount:
/usr/share/filebeat/data:
exists: true
/run/docker.sock:
exists: true
/var/lib/docker/containers:
exists: true
opts:
- ro
/usr/share/filebeat/filebeat.yml:
exists: true
opts:
- ro

user:
filebeat:
exists: true
uid: 1000
gid: 1000

http:
http://elasticsearch-master:9200/_cat/indices:
status: 200
timeout: 2000
body:
- 'filebeat-7.0.1'

file:
/usr/share/filebeat/filebeat.yml:
exists: true
contains:
- 'add_kubernetes_metadata'
- 'output.elasticsearch'
- 'elasticsearch-master:9200'

command:
cd /usr/share/filebeat && filebeat test output:
exit-status: 0
stdout:
- 'elasticsearch: http://elasticsearch-master:9200'
- 'version: 7.0.1'
17 changes: 0 additions & 17 deletions filebeat/examples/default/values.yaml

This file was deleted.

13 changes: 13 additions & 0 deletions filebeat/examples/oss/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
default: test

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

RELEASE := helm-filebeat-oss

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

test: install goss

purge:
helm del --purge $(RELEASE)
22 changes: 22 additions & 0 deletions filebeat/examples/oss/test/goss.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
port:
tcp:5066:
listening: true
ip:
- '127.0.0.1'

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

user:
filebeat:
exists: true
uid: 1000
gid: 1000

http:
http://oss-master:9200/_cat/indices:
status: 200
timeout: 2000
body:
- 'filebeat-7.0.1'
5 changes: 5 additions & 0 deletions filebeat/examples/oss/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
image: docker.elastic.co/beats/filebeat-oss

extraEnvs:
- name: ELASTICSEARCH_HOSTS
value: oss-master:9200
13 changes: 13 additions & 0 deletions filebeat/examples/security/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
default: test

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

RELEASE := helm-filebeat-security

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

test: install goss

purge:
helm del --purge $(RELEASE)
9 changes: 9 additions & 0 deletions filebeat/examples/security/test/goss.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
http:
https://security-master:9200/_cat/indices:
status: 200
timeout: 2000
body:
- 'filebeat-7.0.1'
allow-insecure: true
username: '{{ .Env.ELASTICSEARCH_USERNAME }}'
password: '{{ .Env.ELASTICSEARCH_PASSWORD }}'
34 changes: 34 additions & 0 deletions filebeat/examples/security/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
filebeatConfig:
filebeat.yml: |
filebeat.inputs:
- type: docker
containers.ids:
- '*'
processors:
- add_kubernetes_metadata:
in_cluster: true
output.elasticsearch:
username: '${ELASTICSEARCH_USERNAME}'
password: '${ELASTICSEARCH_PASSWORD}'
protocol: https
hosts: ["security-master:9200"]
ssl.certificate_authorities:
- /usr/share/filebeat/config/certs/elastic-certificate.pem
secretMounts:
- name: elastic-certificate-pem
secretName: elastic-certificate-pem
path: /usr/share/filebeat/config/certs

extraEnvs:
- name: 'ELASTICSEARCH_USERNAME'
valueFrom:
secretKeyRef:
name: elastic-credentials
key: username
- name: 'ELASTICSEARCH_PASSWORD'
valueFrom:
secretKeyRef:
name: elastic-credentials
key: password
4 changes: 1 addition & 3 deletions filebeat/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
1. Watch all cluster members come up.
1. Watch all containers come up.
$ kubectl get pods --namespace={{ .Release.Namespace }} -l app={{ template "fullname" . }} -w
2. Test cluster health using Helm test.
$ helm test {{ .Release.Name }}
12 changes: 12 additions & 0 deletions filebeat/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,15 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Use the fullname if the serviceAccount value is not set
*/}}
{{- define "serviceAccount" -}}
{{- if .Values.serviceAccount }}
{{- .Values.serviceAccount -}}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
2 changes: 1 addition & 1 deletion filebeat/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
name: {{ .Values.serviceAccount }}-cluster-role
name: {{ template "serviceAccount" . }}-cluster-role
labels:
app: "{{ template "fullname" . }}"
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
Expand Down
6 changes: 3 additions & 3 deletions filebeat/templates/clusterrolebinding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: {{ .Values.serviceAccount }}-cluster-role-binding
name: {{ template "serviceAccount" . }}-cluster-role-binding
labels:
app: "{{ template "fullname" . }}"
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
heritage: {{ .Release.Service | quote }}
release: {{ .Release.Name | quote }}
roleRef:
kind: ClusterRole
name: {{ .Values.serviceAccount }}-cluster-role
name: {{ template "serviceAccount" . }}-cluster-role
apiGroup: rbac.authorization.k8s.io
subjects:
- kind: ServiceAccount
name: {{ .Values.serviceAccount }}
name: {{ template "serviceAccount" . }}
namespace: {{ .Release.Namespace }}
{{- end -}}
4 changes: 2 additions & 2 deletions filebeat/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "name" . }}-config
name: {{ template "fullname" . }}-config
labels:
app: "{{ template "name" . }}"
app: "{{ template "fullname" . }}"
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
heritage: {{ .Release.Service | quote }}
release: {{ .Release.Name | quote }}
Expand Down
Loading

0 comments on commit 9b406f8

Please sign in to comment.