---
apiVersion: apm.k8s.elastic.co/v1
kind: ApmServer
metadata:
  name: {{ include "apm-server.fullname" . }}
  labels:
    {{- include "apm-server.labels" . | nindent 4 }}
  annotations:
    eck.k8s.elastic.co/license: basic
    {{- with .Values.annotations }}
    {{- toYaml . | nindent 4 }}
    {{- end }}
spec:
  version: {{ required "An APM Server version is required" .Values.version }}
  count: {{ required "A pod count is required" .Values.count }}
  {{- with .Values.image }}
  image: {{ . }}
  {{- end }}
  {{- with .Values.serviceAccountName }}
  serviceAccountName: {{ . }}
  {{- end }}
  {{- with .Values.revisionHistoryLimit }}
  revisionHistoryLimit: {{ . }}
  {{- end }}

  {{- with .Values.config }}
  config:
    {{- toYaml . | nindent 4 }}
  {{- end }}
  {{- with .Values.http }}
  http:
    {{- toYaml . | nindent 4 }}
  {{- end }}

  {{- with .Values.elasticsearchRef }}
  elasticsearchRef:
    {{- toYaml . | nindent 4 }}
  {{- end }}

  {{- with .Values.kibanaRef }}
  kibanaRef:
    {{- toYaml . | nindent 4 }}
  {{- end }}

  {{- with .Values.podTemplate }}
  podTemplate:
    {{- toYaml . | nindent 4 }}
  {{- end }}

  {{- with .Values.secureSettings }}
  secureSettings:
    {{- toYaml . | nindent 2 }}
  {{- end }}
