{{- if .Values.enabled }}
apiVersion: agent.k8s.elastic.co/v1alpha1
kind: Agent
metadata:
  name: fleet-server-{{ .Values.env }}
  namespace: {{ .Release.Namespace }}
spec:
  version: 8.12.0
  mode: fleet
  elasticsearchRefs:
    - name: elasticsearch-{{ .Values.env }}
  kibanaRef:
    name: kibana-{{ .Values.env }}
  fleetServerEnabled: true
  fleetServer:
    host: 0.0.0.0
    port: 8220
  deployment:
    replicas: 1
    podTemplate:
      spec:
        securityContext:
          runAsUser: 0
          runAsGroup: 0
          fsGroup: 0
        containers:
          - name: agent
            resources:
              requests:
                cpu: 100m
                memory: 512Mi
{{- end }}
