---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: elastic-operator
  namespace: elastic-system
  labels:
    control-plane: elastic-operator
spec:
  selector:
    matchLabels:
      control-plane: elastic-operator
  serviceName: elastic-operator
  template:
    metadata:
      labels:
        control-plane: elastic-operator
    spec:
      serviceAccountName: elastic-operator
      containers:
      - image: docker.elastic.co/eck/eck-operator:1.0.1
        name: manager
        args: ["manager", "--operator-roles", "all", "--log-verbosity=0"]
        env:
          - name: OPERATOR_NAMESPACE
            valueFrom:
              fieldRef:
                fieldPath: metadata.namespace
          - name: WEBHOOK_SECRET
            value: elastic-webhook-server-cert
          - name: WEBHOOK_PODS_LABEL
            value: elastic-operator
          - name: OPERATOR_IMAGE
            value: docker.elastic.co/eck/eck-operator:1.0.1
        resources:
          limits:
            cpu: 1
            memory: 150Mi
          requests:
            cpu: 100m
            memory: 50Mi
        ports:
        - containerPort: 9443
          name: webhook-server
          protocol: TCP
        volumeMounts:
          - mountPath: /tmp/k8s-webhook-server/serving-certs
            name: cert
            readOnly: true
      terminationGracePeriodSeconds: 10
      volumes:
        - name: cert
          secret:
            defaultMode: 420
            secretName: elastic-webhook-server-cert
      nodeSelector:
        "beta.kubernetes.io/instance-type": "t2.medium"
