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

add apm-server helm chart #324

Merged
merged 2 commits into from
Jan 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ Please look in the chart directories for the documentation for each chart. These
| [Logstash](./logstash/README.md) | https://www.elastic.co/guide/en/logstash/current/docker.html |
| [Filebeat](./filebeat/README.md) | https://www.elastic.co/guide/en/beats/filebeat/current/running-on-docker.html |
| [Metricbeat](./metricbeat/README.md) | https://www.elastic.co/guide/en/beats/metricbeat/current/running-on-docker.html |
| [APM-Server](./apm-server/README.md) | https://www.elastic.co/guide/en/apm/server/current/running-on-docker.html |

## Kubernetes versions
jmlrt marked this conversation as resolved.
Show resolved Hide resolved
## Kubernetes Versions

The charts are [currently tested](https://devops-ci.elastic.co/job/elastic+helm-charts+master/) against all GKE versions available. The exact versions are defined under `KUBERNETES_VERSIONS` in [helpers/matrix.yml](/helpers/matrix.yml)

Expand Down
2 changes: 2 additions & 0 deletions apm-server/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tests/
.pytest_cache/
12 changes: 12 additions & 0 deletions apm-server/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
description: Official Elastic helm chart for Elastic APM Server
jmlrt marked this conversation as resolved.
Show resolved Hide resolved
home: https://github.com/elastic/helm-charts
maintainers:
- email: helm-charts@elastic.co
name: Elastic
name: apm-server
version: 7.5.1
appVersion: 7.5.1
sources:
- https://github.com/elastic/apm
icon: https://helm.elastic.co/icons/apm.png
1 change: 1 addition & 0 deletions apm-server/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include ../helpers/common.mk
153 changes: 153 additions & 0 deletions apm-server/README.md

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions apm-server/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-apm-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)
6 changes: 6 additions & 0 deletions apm-server/examples/6.x/test/goss.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
http:
http://localhost:8200?pretty:
status: 200
timeout: 2000
body:
- '"version" : "6.8.6'
1 change: 1 addition & 0 deletions apm-server/examples/6.x/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
imageTag: "6.8.6"
13 changes: 13 additions & 0 deletions apm-server/examples/default/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
default: test

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

RELEASE := helm-apm-server-default

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

test: install goss

purge:
helm del --purge $(RELEASE)
6 changes: 6 additions & 0 deletions apm-server/examples/default/test/goss.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
http:
http://localhost:8200?pretty:
status: 200
timeout: 2000
body:
- '"version" : "7.5.1"'
13 changes: 13 additions & 0 deletions apm-server/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-apm-server-oss

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

test: install goss

purge:
helm del --purge $(RELEASE)
6 changes: 6 additions & 0 deletions apm-server/examples/oss/test/goss.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
http:
http://localhost:8200?pretty:
status: 200
timeout: 2000
body:
- '"version" : "7.5.1"'
21 changes: 21 additions & 0 deletions apm-server/examples/oss/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
image: docker.elastic.co/apm/apm-server-oss:7.5.1

apmConfig:
apm-server.yml: |
apm-server:
host: "0.0.0.0:8200"

queue: {}
output.file:
enabled: false

output.elasticsearch:
hosts: ["http://oss-master:9200"]
## If you have security enabled- you'll need to add the credentials
## as environment variables
# username: "${ELASTICSEARCH_USERNAME}"
# password: "${ELASTICSEARCH_PASSWORD}"
## If SSL is enabled
# protocol: https
# ssl.certificate_authorities:
# - /usr/share/apm-server/config/certs/elastic-ca.pem
13 changes: 13 additions & 0 deletions apm-server/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-apm-server-security

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

test: install goss

purge:
helm del --purge $(RELEASE)
6 changes: 6 additions & 0 deletions apm-server/examples/security/test/goss.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
http:
http://localhost:8200?pretty:
status: 200
timeout: 2000
body:
- '"version" : "7.5.1"'
29 changes: 29 additions & 0 deletions apm-server/examples/security/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
apmConfig:
apm-server.yml: |
apm-server:
host: "0.0.0.0:8200"
queue: {}
output.elasticsearch:
username: '${ELASTICSEARCH_USERNAME}'
password: '${ELASTICSEARCH_PASSWORD}'
protocol: https
hosts: ["security-master:9200"]
ssl.certificate_authorities:
- /usr/share/apm-server/config/certs/elastic-certificate.pem

secretMounts:
- name: elastic-certificate-pem
secretName: elastic-certificate-pem
path: /usr/share/apm-server/config/certs

extraEnvs:
- name: 'ELASTICSEARCH_USERNAME'
valueFrom:
secretKeyRef:
name: elastic-credentials
key: username
- name: 'ELASTICSEARCH_PASSWORD'
valueFrom:
secretKeyRef:
name: elastic-credentials
key: password
2 changes: 2 additions & 0 deletions apm-server/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
1. Watch all containers come up.
$ kubectl get pods --namespace={{ .Release.Namespace }} -l app={{ template "apm.fullname" . }} -w
44 changes: 44 additions & 0 deletions apm-server/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "apm.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 "apm.fullname" }}
{{- $name := default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-"}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Return the appropriate apiVersion for ingress.
*/}}
{{- define "apm.ingress.apiVersion" -}}
{{- if semverCompare "<1.14-0" .Capabilities.KubeVersion.GitVersion -}}
{{- print "extensions/v1beta1" -}}
{{- else -}}
{{- print "networking.k8s.io/v1beta1" -}}
{{- end -}}
{{- end -}}
{{- define "apm.autoscaling.apiVersion" -}}
{{- if semverCompare "<1.12-0" .Capabilities.KubeVersion.GitVersion -}}
{{- print "autoscaling/v2beta1" -}}
{{- else -}}
{{- print "autoscaling/v2beta2" -}}
{{- end -}}
{{- end -}}
{{/*
Use the fullname if the serviceAccount value is not set
*/}}
{{- define "apm.serviceAccount" -}}
{{- if .Values.serviceAccount }}
{{- .Values.serviceAccount -}}
{{- else }}
{{- template "apm.fullname" . }}
{{- end -}}
{{- end -}}
21 changes: 21 additions & 0 deletions apm-server/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{{- if .Values.managedServiceAccount }}
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
name: {{ template "apm.serviceAccount" . }}-cluster-role
labels:
app: "{{ template "apm.fullname" . }}"
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
heritage: {{ .Release.Service | quote }}
release: {{ .Release.Name | quote }}
rules:
- apiGroups:
- ""
resources:
- namespaces
- pods
verbs:
- get
- list
- watch
{{- end -}}
19 changes: 19 additions & 0 deletions apm-server/templates/clusterrolebinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{- if .Values.managedServiceAccount }}
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: {{ template "apm.serviceAccount" . }}-cluster-role-binding
labels:
app: "{{ template "apm.fullname" . }}"
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
heritage: {{ .Release.Service | quote }}
release: {{ .Release.Name | quote }}
roleRef:
kind: ClusterRole
name: {{ template "apm.serviceAccount" . }}-cluster-role
apiGroup: rbac.authorization.k8s.io
subjects:
- kind: ServiceAccount
name: {{ template "apm.serviceAccount" . }}
namespace: {{ .Release.Namespace }}
{{- end -}}
17 changes: 17 additions & 0 deletions apm-server/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{- if .Values.apmConfig }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "apm.fullname" . }}-config
labels:
app: "{{ template "apm.fullname" . }}"
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
heritage: {{ .Release.Service | quote }}
release: {{ .Release.Name | quote }}
data:
{{- range $path, $config := .Values.apmConfig }}
{{ $path }}: |
{{ $config | indent 4 -}}
{{- end -}}
{{- end -}}
117 changes: 117 additions & 0 deletions apm-server/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "apm.fullname" . }}
labels:
app: {{ .Chart.Name }}
release: {{ .Release.Name | quote }}
{{- range $key, $value := .Values.labels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
spec:
replicas: {{ .Values.replicas }}
strategy:
{{ toYaml .Values.updateStrategy | indent 4 }}
selector:
matchLabels:
app: apm-server
release: {{ .Release.Name | quote }}
template:
metadata:
labels:
app: apm-server
release: {{ .Release.Name | quote }}
jmlrt marked this conversation as resolved.
Show resolved Hide resolved
annotations:
{{- range $key, $value := .Values.podAnnotations }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{/* This forces a restart if the configmap has changed */}}
{{- if .Values.apmConfig }}
configChecksum: {{ include (print .Template.BasePath "/configmap.yaml") . | sha256sum | trunc 63 }}
{{- end }}
spec:
{{- if .Values.priorityClassName }}
priorityClassName: {{ .Values.priorityClassName }}
{{- end }}
{{- if .Values.serviceAccount }}
serviceAccountName: {{ .Values.serviceAccount }}
{{- end }}
volumes:
{{- range .Values.secretMounts }}
- name: {{ .name }}
secret:
secretName: {{ .secretName }}
{{- end }}
{{- if .Values.apmConfig }}
- name: apm-server-config
configMap:
name: {{ template "apm.fullname" . }}-config
defaultMode: 0600
{{- end }}
{{- if .Values.extraVolumes }}
{{ toYaml .Values.extraVolumes | indent 8 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{ toYaml . | indent 8 }}
{{- end }}
{{- if .Values.imagePullSecrets }}
imagePullSecrets:
{{ toYaml .Values.imagePullSecrets | indent 8 }}
{{- end }}
containers:
- name: apm-server
image: "{{ .Values.image }}:{{ .Values.imageTag }}"
imagePullPolicy: "{{ .Values.imagePullPolicy }}"
{{- with .Values.extraEnvs }}
env:
{{ toYaml . | nindent 10 }}
{{- end }}
{{- if .Values.podSecurityContext }}
securityContext:
{{ toYaml .Values.podSecurityContext | indent 10 }}
{{- end }}
livenessProbe:
httpGet:
path: /
port: http
initialDelaySeconds: 30
readinessProbe:
httpGet:
path: /
port: http
initialDelaySeconds: 30
ports:
- containerPort: {{ .Values.service.port }}
name: http
{{- if .Values.lifecycle }}
lifecycle:
{{ toYaml .Values.lifecycle | indent 10 }}
{{- end }}
resources:
{{ toYaml .Values.resources | indent 10 }}
volumeMounts:
{{- range .Values.secretMounts }}
- name: {{ .name }}
mountPath: {{ .path }}
{{- if .subPath }}
subPath: {{ .subPath }}
{{- end }}
{{- end }}
{{- range $path, $config := .Values.apmConfig }}
- name: apm-server-config
mountPath: /usr/share/apm-server/{{ $path }}
subPath: {{ $path }}
readOnly: true
{{- end -}}
{{- if .Values.extraVolumes }}
{{ toYaml .Values.extraVolumeMounts | indent 10 }}
{{- end }}
Loading