Skip to content
This repository was archived by the owner on Feb 22, 2022. It is now read-only.

[stable/apm-server] Add support for Service and Deployment #11661

Merged
merged 6 commits into from
Apr 15, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion stable/apm-server/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v1
description: The server receives data from the Elastic APM agents and stores the data into a datastore like Elasticsearch
icon: https://www.elastic.co/assets/blt47799dcdcf08438d/logo-elastic-beats-lt.svg
name: apm-server
version: 0.1.0
version: 0.2.0
appVersion: 6.2.4
home: https://www.elastic.co/solutions/apm
sources:
Expand Down
17 changes: 17 additions & 0 deletions stable/apm-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,20 @@ The following table lists the configurable parameters of the apm-server chart an
| `image.repository` | The image repository to pull from | `docker.elastic.co/apm/apm-server` |
| `image.tag` | The image tag to pull | `6.2.4` |
| `image.pullPolicy` | Image pull policy | `IfNotPresent` |
| `kind` | Install as Deployment or DaemonSet | `Deployment` |
| `replicaCount` | Number of replicas when kind is Deployment | `1` |
| `updateStrategy` | Allows setting of RollingUpdate strategy | `{}` |
| `service.enabled` | If true, create service pointing to APM Server | `true` |
| `service.type` | type of service | `ClusterIP` |
| `service.port` | Service port | `8200` |
| `service.portName` | Service port name | None |
| `service.clusterIP` | Static clusterIP or None for headless services | None |
| `service.externalIPs` | External IP addresses | None |
| `service.loadBalancerIP` | Load Balancer IP address | None |
| `service.loadBalancerSourceRanges` | Limit load balancer source IPs to list of CIDRs (where available) | `[]` |
| `service.nodePort` | NodePort value if service.type is NodePort | None |
| `service.annotations` | Kubernetes service annotations | None |
| `service.labels` | Kubernetes service labels | None |
| `rbac.create` | If true, create & use RBAC resources | `true` |
| `rbac.serviceAccount` | existing ServiceAccount to use (ignored if rbac.create=true) | `default` |
| `config` | The content of the configuration file consumed by apm-server. See the [apm-server documentation](https://www.elastic.co/guide/en/beats/apm-server/current/apm-server-reference-yml.html) for full details |
Expand All @@ -53,6 +67,9 @@ The following table lists the configurable parameters of the apm-server chart an
| `resources.limits.cpu` | CPU resource limits | |
| `resources.requests.memory` | Memory resource requests | |
| `resources.limits.memory` | Memory resource limits | |
| `nodeSelector` | Node labels for pod assignment | `{}` |
| `tolerations` | List of node taints to tolerate | `[]` |
| `affinity` | Node/Pod affinities | None |

Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,

Expand Down
9 changes: 5 additions & 4 deletions stable/apm-server/templates/daemonset.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if eq .Values.kind "DaemonSet" }}
apiVersion: apps/v1
kind: DaemonSet
metadata:
Expand All @@ -14,9 +15,7 @@ spec:
release: {{ .Release.Name }}
minReadySeconds: 10
updateStrategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 1
{{ toYaml .Values.updateStrategy | indent 4 }}
template:
metadata:
labels:
Expand Down Expand Up @@ -50,7 +49,8 @@ spec:
value: {{ $value }}
{{- end }}
ports:
- containerPort: 8200
- name: http
containerPort: 8200
securityContext:
runAsUser: 0
resources:
Expand Down Expand Up @@ -90,3 +90,4 @@ spec:
affinity:
{{ toYaml .Values.affinity | indent 8 }}
{{- end }}
{{- end }}
91 changes: 91 additions & 0 deletions stable/apm-server/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
{{- if eq .Values.kind "Deployment" }}
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: {{ template "apm-server.fullname" . }}
labels:
app: {{ template "apm-server.name" . }}
chart: {{ template "apm-server.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
replicas: {{ .Values.replicaCount }}
minReadySeconds: 10
strategy:
{{ toYaml .Values.updateStrategy | indent 4 }}
template:
metadata:
labels:
app: {{ template "apm-server.name" . }}
release: {{ .Release.Name }}
{{- range $key, $value := .Values.podLabels }}
{{ $key }}: {{ $value }}
{{- end }}
annotations:
checksum/secret: {{ toYaml .Values.config | sha256sum }}
{{- range $key, $value := .Values.podAnnotations }}
{{ $key }}: {{ $value }}
{{- end }}
spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- "-e"
{{- if .Values.plugins }}
- "--plugin"
- {{ .Values.plugins | join "," | quote }}
{{- end }}
{{- if .Values.extraArgs }}
{{ toYaml .Values.extraArgs | indent 8 }}
{{- end }}
env:
{{- range $key, $value := .Values.extraVars }}
- name: {{ $key }}
value: {{ $value }}
{{- end }}
ports:
- name: http
containerPort: 8200
protocol: TCP
securityContext:
runAsUser: 0
resources:
{{ toYaml .Values.resources | indent 10 }}
volumeMounts:
- name: apm-server-config
mountPath: /usr/share/apm-server/apm-server.yml
readOnly: true
subPath: apm-server.yml
- name: data
mountPath: /usr/share/apm-server/data
{{- if .Values.extraVolumeMounts }}
{{ toYaml .Values.extraVolumeMounts | indent 8 }}
{{- end }}
volumes:
- name: apm-server-config
secret:
secretName: {{ template "apm-server.fullname" . }}
- name: data
hostPath:
path: /var/lib/apm-server
type: DirectoryOrCreate
{{- if .Values.extraVolumes }}
{{ toYaml .Values.extraVolumes | indent 6 }}
{{- end }}
terminationGracePeriodSeconds: 60
serviceAccountName: {{ template "apm-server.serviceAccountName" . }}
{{- if .Values.nodeSelector }}
nodeSelector:
{{ toYaml .Values.nodeSelector | indent 8 }}
{{- end }}
{{- if .Values.tolerations }}
tolerations:
{{ toYaml .Values.tolerations | indent 8 }}
{{- end }}
{{- if .Values.affinity }}
affinity:
{{ toYaml .Values.affinity | indent 8 }}
{{- end }}
{{- end }}
51 changes: 51 additions & 0 deletions stable/apm-server/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{{- if .Values.service.enabled }}
apiVersion: v1
kind: Service
metadata:
labels:
app: {{ template "apm-server.name" . }}
chart: {{ template "apm-server.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- range $key, $value := .Values.service.labels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
name: {{ template "apm-server.fullname" . }}
{{- with .Values.service.annotations }}
annotations:
{{- range $key, $value := . }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- end }}
spec:
{{- if .Values.service.loadBalancerSourceRanges }}
loadBalancerSourceRanges:
{{- range $cidr := .Values.service.loadBalancerSourceRanges }}
- {{ $cidr }}
{{- end }}
{{- end }}
type: {{ .Values.service.type }}
{{- if and (eq .Values.service.type "ClusterIP") .Values.service.clusterIP }}
clusterIP: {{ .Values.service.clusterIP }}
{{- end }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
{{ if (and (eq .Values.service.type "NodePort") (not (empty .Values.service.nodePort))) }}
nodePort: {{ .Values.service.nodePort }}
{{ end }}
{{- if .Values.service.portName }}
name: {{ .Values.service.portName }}
{{- end }}
{{- if .Values.service.externalIPs }}
externalIPs:
{{ toYaml .Values.service.externalIPs | indent 4 }}
{{- end }}
selector:
app: {{ template "apm-server.name" . }}
release: {{ .Release.Name }}
{{- if .Values.service.loadBalancerIP }}
loadBalancerIP: {{ .Values.service.loadBalancerIP }}
{{- end }}
{{- end }}
43 changes: 43 additions & 0 deletions stable/apm-server/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,43 @@ image:
tag: 6.2.4
pullPolicy: IfNotPresent

# DaemonSet or Deployment
kind: DaemonSet

# Number of replicas when kind is Deployment
replicaCount: 1

# The update strategy to apply to the Deployment or DaemonSet
updateStrategy: {}
# rollingUpdate:
# maxUnavailable: 1
# type: RollingUpdate

service:
enabled: false
type: ClusterIP
port: 8200
# portName: apm-server-svc
# clusterIP: None
## External IP addresses of service
## Default: nil
# externalIPs:
# - 192.168.0.1
#
## LoadBalancer IP if service.type is LoadBalancer
## Default: nil
# loadBalancerIP: 10.2.2.2
## Limit load balancer source ips to list of CIDRs (where available)
# loadBalancerSourceRanges: []

annotations: {}
# Annotation example: setup ssl with aws cert when service.type is LoadBalancer
# service.beta.kubernetes.io/aws-load-balancer-ssl-cert: arn:aws:acm:us-east-1:EXAMPLE_CERT
labels: {}
## Label example: show service URL in `kubectl cluster-info`
# kubernetes.io/cluster-service: "true"


config:
apm-server: {}
### Defines the host and port the server is listening on
Expand Down Expand Up @@ -54,11 +91,13 @@ config:
# When a key contains a period, use this format for setting values on the command line:
# --set config."output\.file".enabled=false
output.file:
# enabled: false
path: "/usr/share/apm-server/data"
filename: apm-server
rotate_every_kb: 10000
number_of_files: 5

## Set output.file.enabled to false to enable elasticsearch
# output.elasticsearch:
# hosts: ["elasticsearch:9200"]
# protocol: "https"
Expand Down Expand Up @@ -110,6 +149,10 @@ resources: {}
## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
nodeSelector: {}

# Tolerations for pod assignment
# Ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
tolerations: []

## Affinity configuration for pod assignment
## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
affinity: {}
Expand Down