saidsef/k8s-spot-termination-notice

View on GitHub
deployment/daemonset.yml

Summary

Maintainability
Test Coverage
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: spot-termination-notice
spec:
  revisionHistoryLimit: 1
  selector:
    matchLabels:
      app: spot-termination-notice
  template:
    metadata:
      labels:
        app: spot-termination-notice
    spec:
      serviceAccountName: spot-termination-notice
      enableServiceLinks: false
      affinity:
        nodeAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
            - preference:
                matchExpressions:
                  - key: "kubernetes.io/arch"
                    operator: "In"
                    values:
                      - "amd64"
              weight: 1
      restartPolicy: Always
      terminationGracePeriodSeconds: 60
      securityContext:
        seccompProfile:
          type: RuntimeDefault
      containers:
      - name: spot-termination-notice
        image: docker.io/saidsef/k8s-spot-termination-notice:v2022.12
        imagePullPolicy: Always
        env:
        - name: POD_NAME
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
        - name: NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        - name: SPOT_POD_IP
          valueFrom:
            fieldRef:
              fieldPath: status.podIP
        - name: NODE_NAME
          valueFrom:
            fieldRef:
              fieldPath: spec.nodeName
        - name: SLACK_API_TOKEN
          valueFrom:
            secretKeyRef:
              name: slack
              key: SLACK_API_TOKEN
        - name: SLACK_CHANNEL
          valueFrom:
            secretKeyRef:
              name: slack
              key: SLACK_CHANNEL
        resources:
          requests:
            cpu: 30m
            memory: 50Mi
          limits:
            cpu: 50m
            memory: 100Mi
        livenessProbe:
          exec:
            command:
              - pgrep
              - python
          initialDelaySeconds: 5
          periodSeconds: 5
          failureThreshold: 3
          successThreshold: 1
          timeoutSeconds: 3
        securityContext:
          allowPrivilegeEscalation: false
          privileged: false
          readOnlyRootFilesystem: true
          runAsGroup: 65534
          runAsNonRoot: true
          runAsUser: 65534
          capabilities:
            drop:
              - ALL