apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    description: LogAggreggator
  labels:
    app: log-aggregator
    environment: Development
    tier: Service
  name: log-aggregator
  namespace: tools
spec:
  revisionHistoryLimit: 1
  minReadySeconds: 10
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 1
      maxSurge: 1
  replicas: 3
  selector:
    matchLabels:
      app: log-aggregator
  template:
    metadata:
      labels:
        app: log-aggregator
      name: log-aggregator
    spec:
      containers:
      - name: log-aggregator
        image: docker.io/swisschains/tools-log-aggregator:1.0.0
        imagePullPolicy: Always
        lifecycle:
          postStart:
            exec:
             command:
             - /bin/sh
             - -c 
             - "/bin/echo 'options single-request-reopen' >> /etc/resolv.conf"
        ports:
        - containerPort: 5000
        - containerPort: 5001
        readinessProbe:
          httpGet:
            path: /api/isalive
            port: 5000
          initialDelaySeconds: 40
          periodSeconds: 10
        livenessProbe:
          httpGet:
            path: /api/isalive
            port: 5000
          initialDelaySeconds: 40
          periodSeconds: 20
        resources:
          requests:
            memory: 256Mi 
            cpu: 200m 
          limits:
            memory: 1024Mi 
            cpu: 1 
        env:
        - name: ElasticSearchSettings__Url
          value: "http://elasticsearch.elk-logs.svc.cluster.local:9200"
