apiVersion: apps/v1
kind: Deployment
metadata:
  namespace: etm-demo
  labels:
    app: "etm"
    component: "client"
    release: "${etm-version}"
  name: "etm-client"
spec:
  replicas: 2
  selector:
    matchLabels:
      app: "etm"
      component: "client"
      release: "${etm-version}"
  template:
    metadata:
      labels:
        app: "etm"
        component: "client"
        release: "${etm-version}"
    spec:
      securityContext:
        fsGroup: 1000
      affinity:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - weight: 1
            podAffinityTerm:
              topologyKey: kubernetes.io/hostname
              labelSelector:
                matchLabels:
                  app: "etm"
                  component: "client"
      containers:
      - name: "etm"
        env:
        - name: elasticsearch_connectAddresses
          value: "elasticsearch-client:9200"
        - name: elasticsearch_clusterName
          value: etm-demo-01
        - name: instanceName
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
        readinessProbe:
          httpGet:
            path: /status
            port: 8080
          initialDelaySeconds: 5
        livenessProbe:
          httpGet:
            path: /status
            port: 8080
          initialDelaySeconds: 90
        image: "docker.jecstar.com/etm:${etm-version}"
        imagePullPolicy: "IfNotPresent"
        ports:
        - containerPort: 8080
          name: http
