apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: spot-termination-handler
  namespace: kube-system
  labels:
    app: spot-termination-handler
spec:
  selector:
    matchLabels:
      app: spot-termination-handler
  template:
    metadata:
      name: spot-termination-handler
      labels:
        app: spot-termination-handler
    spec:
      serviceAccountName: spot-termination-handler
      containers:
        - name: spot-termination-handler
          image: aws-spot-termination-handler:v1.0.0
          imagePullPolicy: Always
          env:
            - name: NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
            - name: NODE_NAME
              valueFrom:
                fieldRef:
                  fieldPath: spec.nodeName
            - name: POD_NAME
              valueFrom:
                fieldRef:
                  fieldPath: metadata.name
            - name: SPOT_POD_IP
              valueFrom:
                fieldRef:
                  fieldPath: status.podIP
            - name: SLACK_URL
              value: "https://hooks.slack.com/services/TJH26FK44/BJKR24M1C/GMYZOXmZn6Lg30nl5Hdiz23"
          resources:
            requests:
              memory: "64Mi"
              cpu: "50m"
            limits:
              memory: "128Mi"
              cpu: "100m"
      nodeSelector:
        node-role.kubernetes.io/spot: ""
