apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: gosty-worker
  name: gosty-worker
  namespace: gosty
spec:
  replicas: 1
  revisionHistoryLimit: 1
  selector:
    matchLabels:
      app: gosty-worker
  template:
    metadata:
      annotations:
        linkerd.io/inject: enabled
      labels:
        app: gosty-worker
    spec:
      affinity:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
            - weight: 100
              podAffinityTerm:
                topologyKey: topology.kubernetes.io/hostname
      containers:
        - name: gosty-worker
          image: luqmansen/gosty-worker:latest
          imagePullPolicy: Always

          env:
            - name: POD_IP
              valueFrom:
                fieldRef:
                  fieldPath: status.podIP

          livenessProbe:
            httpGet:
              path: /live
              port: 8087
            initialDelaySeconds: 5
            periodSeconds: 3
          readinessProbe:
            httpGet:
              path: /ready
              port: 8087
            initialDelaySeconds: 5
            periodSeconds: 3
          #
          envFrom:
            - configMapRef:
                name: gosty-config
