---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: bump-api
  labels:
    name: bump-api
    app: bump-api
spec:
  revisionHistoryLimit: 2
  replicas: 1
  selector:
    matchLabels:
      app: bump-api
  template:
    metadata:
      labels:
        app: bump-api
      annotations:
        prometheus.io/scrape: "true"
        prometheus.io/port: "7070"
    spec:
      restartPolicy: Always
      securityContext:
        runAsGroup: 65534
        runAsUser: 65534
      containers:
        - name: bump-api
          image: saidsef/bump-api:latest
          imagePullPolicy: Always
          ports:
            - containerPort: 7070
              protocol: TCP
              name: http
          livenessProbe:
            exec:
              command:
                - pgrep
                - python
            initialDelaySeconds: 3
            periodSeconds: 5
            failureThreshold: 2
            successThreshold: 1
            timeoutSeconds: 3
          readinessProbe:
            tcpSocket:
              port: 7070
            initialDelaySeconds: 3
            periodSeconds: 5
            failureThreshold: 2
            successThreshold: 1
            timeoutSeconds: 3
          resources:
            requests:
              cpu: "50m"
              memory: "128Mi"
            limits:
              cpu: "100m"
              memory: "512Mi"
          securityContext:
            allowPrivilegeEscalation: false
            # user/group: nobody
            runAsGroup: 65534
            runAsUser: 65534
            runAsNonRoot: true
            readOnlyRootFilesystem: true
            privileged: false
            capabilities:
              drop:
                - ALL
              add:
                - NET_BIND_SERVICE
