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

Commit

Permalink
address PR comments, fix the silly bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
pbecotte committed Nov 8, 2019
1 parent 20aac54 commit f21dba0
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 38 deletions.
2 changes: 1 addition & 1 deletion apm-server/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ version: 7.4.0
appVersion: 7.4.0
sources:
- https://github.com/elastic/apm
icon: https://github.com/elastic/apm/blob/master/apm-logo.svg
icon: https://helm.elastic.co/icons/apm.png
13 changes: 6 additions & 7 deletions apm-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
This functionality is in beta and is subject to change. The design and code is less mature than official GA features and is being provided as-is with no warranties. Beta features are not subject to the support SLA of official GA features.

This helm chart is a lightweight way to configure and run our official
[APM Server docker image](https://www.elastic.co/guide/en/apm/server/7.4/running-on-docker.html).
[APM Server docker image](https://www.elastic.co/guide/en/apm/server/current/running-on-docker.html).

## Requirements

Expand Down Expand Up @@ -50,7 +50,6 @@ helm install --name apm-server elastic/apm-server --set imageTag=7.4.0
## Configuration
| Parameter | Description | Default |
| ------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| `elasticsearchHosts` | Comma seperated list of Elasticsearch masters to ship logs to | `http://elasticsearch-master:9200` |
| `apmConfig` | Allows you to add any config files in `/usr/share/apm-server/config` such as `apm-server.yml`. See [values.yaml](./values.yaml) for an example of the formatting with the default configuration. | see [values.yaml](./values.yaml) |
| `replicas` | Number of APM servers to run | `1` |
| `extraEnvs` | Extra [environment variables](https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/#using-environment-variables-inside-of-your-config) which will be appended to the `env:` definition for the container | `[]` |
Expand All @@ -61,15 +60,15 @@ helm install --name apm-server elastic/apm-server --set imageTag=7.4.0
| `imagePullPolicy` | The Kubernetes [imagePullPolicy](https://kubernetes.io/docs/concepts/containers/images/#updating-images) value | `IfNotPresent` |
| `imagePullSecrets` | Configuration for [imagePullSecrets](https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/#create-a-pod-that-uses-your-secret) so that you can use a private registry for your image | `[]` |
| `managedServiceAccount` | Whether the `serviceAccount` should be managed by this helm chart. Set this to `false` in order to manage your own service account and related roles. | `true` |
| `podAnnotations` | Configurable [annotations](https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/) applied to all Filebeat pods | `{}` |
| `labels` | Configurable [label](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/) applied to all Filebeat pods | `{}` |
| `podSecurityContext` | Configurable [podSecurityContext](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/) for Filebeat pod execution environment | `runAsUser: 0`<br>`privileged: false` |
| `podAnnotations` | Configurable [annotations](https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/) applied to all APM Server pods | `{}` |
| `labels` | Configurable [label](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/) applied to all APM server pods | `{}` |
| `podSecurityContext` | Configurable [podSecurityContext](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/) for APM Server pod execution environment | `runAsUser: 0`<br>`privileged: false` |
| `livenessProbe` | Parameters to pass to [liveness probe](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/) checks for values such as timeouts and thresholds. | `failureThreshold: 3`<br>`initialDelaySeconds: 10`<br>`periodSeconds: 10`<br>`successThreshold: 3`<br>`timeoutSeconds: 5` |
| `readinessProbe` | Parameters to pass to [readiness probe](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/) checks for values such as timeouts and thresholds. | `failureThreshold: 3`<br>`initialDelaySeconds: 10`<br>`periodSeconds: 10`<br>`successThreshold: 3`<br>`timeoutSeconds: 5` |
| `resources` | Allows you to set the [resources](https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/) for the `DaemonSet` | `requests.cpu: 100m`<br>`requests.memory: 100Mi`<br>`limits.cpu: 1000m`<br>`limits.memory: 200Mi` |
| `serviceAccount` | Custom [serviceAccount](https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/) that Filebeat will use during execution. By default will use the service account created by this chart. | `""` |
| `serviceAccount` | Custom [serviceAccount](https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/) that APM Server will use during execution. By default will use the service account created by this chart. | `""` |
| `secretMounts` | Allows you easily mount a secret as a file inside the `DaemonSet`. Useful for mounting certificates and other secrets. See [values.yaml](./values.yaml) for an example | `[]` |
| `terminationGracePeriod` | Termination period (in seconds) to wait before killing Filebeat pod process on pod shutdown | `30` |
| `terminationGracePeriod` | Termination period (in seconds) to wait before killing APM Server pod process on pod shutdown | `30` |
| `tolerations` | Configurable [tolerations](https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/) | `[]` |
| `nodeSelector` | Configurable [nodeSelector](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector) | `{}` |
| `affinity` | Configurable [affinity](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity) | `{}` |
Expand Down
24 changes: 21 additions & 3 deletions apm-server/examples/oss/values.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
# Is there an oss version of this image? How to find it?
#image: docker.elastic.co/apm/apm-server-oss
image: docker.elastic.co/apm/apm-server-oss:7.4.0

elasticsearchHosts: "http://oss-master:9200"
elasticsearchHosts:
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
2 changes: 0 additions & 2 deletions apm-server/examples/security/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ apmConfig:
host: "${SERVER_HOST}"
queue: {}
output.file:
enabled: false
output.elasticsearch:
username: '${ELASTICSEARCH_USERNAME}'
Expand Down
7 changes: 7 additions & 0 deletions apm-server/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ Return the appropriate apiVersion for ingress.
{{- 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
*/}}
Expand Down
10 changes: 4 additions & 6 deletions apm-server/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,10 @@ spec:
- name: apm-server
image: "{{ .Values.image }}:{{ .Values.imageTag }}"
imagePullPolicy: "{{ .Values.imagePullPolicy }}"
{{- with .Values.extraEnvs }}
env:
- name: ELASTICSEARCH_HOSTS
value: "{{ .Values.elasticsearchHosts }}"
{{- if .Values.extraEnvs }}
{{ toYaml .Values.extraEnvs | indent 10 }}
{{- end }}
{{ toYaml . | nindent 10 }}
{{- end }}
{{- if .Values.podSecurityContext }}
securityContext:
{{ toYaml .Values.podSecurityContext | indent 10 }}
Expand All @@ -92,7 +90,7 @@ spec:
port: http
initialDelaySeconds: 30
ports:
- containerPort: {{ .Values.httpPort }}
- containerPort: {{ .Values.service.port }}
name: http
{{- if .Values.lifecycle }}
lifecycle:
Expand Down
3 changes: 1 addition & 2 deletions apm-server/templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- if .Values.autoscaling.enabled }}
apiVersion: autoscaling/v2beta1
apiVersion: {{ template "apm.ingress.apiVersion" . }}
kind: HorizontalPodAutoscaler
metadata:
name: {{ template "fullname" . }}
Expand All @@ -14,5 +14,4 @@ spec:
apiVersion: apps/v1
kind: Deployment
name: {{ template "fullname" . }}
{{ (unset .Values.autoscaling "enabled") | toYaml | indent 2 }}
{{- end }}
8 changes: 4 additions & 4 deletions apm-server/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
{{- if .Values.service.nodePort }}
nodePort: {{ .Values.service.nodePort }}
{{- end }}
{{- with .Values.service.nodePort }}
nodePort: {{ . }}
{{- end }}
protocol: TCP
name: http
targetPort: {{ .Values.httpPort }}
targetPort: {{ .Values.service.port }}
selector:
app: {{ .Chart.Name }}
release: {{ .Release.Name | quote }}
9 changes: 1 addition & 8 deletions apm-server/tests/apmserver_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

project = 'apm-server'
name = 'release-name-' + project
elasticsearchHosts = 'http://elasticsearch-master:9200'


def test_defaults():
Expand All @@ -26,12 +25,6 @@ def test_defaults():
assert c['image'].startswith('docker.elastic.co/apm/apm-server:')
assert c['ports'][0]['containerPort'] == 8200

assert c['env'][0]['name'] == 'ELASTICSEARCH_HOSTS'
assert c['env'][0]['value'] == elasticsearchHosts

assert c['env'][1]['name'] == 'SERVER_HOST'
assert c['env'][1]['value'] == '0.0.0.0:8200'


def test_adding_envs():
config = '''
Expand Down Expand Up @@ -106,7 +99,7 @@ def test_setting_pod_security_context():
assert c['securityContext']['privileged'] is False


def test_adding_in_filebeat_config():
def test_adding_in_apm_config():
config = '''
apmConfig:
apm-server.yml: |
Expand Down
6 changes: 1 addition & 5 deletions apm-server/values.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
---
# Comma separated list of hosts
elasticsearchHosts: "http://elasticsearch-master:9200"
# Allows you to add config files
apmConfig:
apm-server.yml: |
apm-server:
host: "0.0.0.0:8200"
queue: {}
output.file:
enabled: false
output.elasticsearch:
hosts: ["${ELASTICSEARCH_HOSTS}"]
hosts: ["http://elasticsearch-master:9200"]
## If you have security enabled- you'll need to add the credentials
## as environment variables
# username: "${ELASTICSEARCH_USERNAME}"
Expand Down

0 comments on commit f21dba0

Please sign in to comment.