apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: http-server
    name: http-server
  name: http-server
  namespace: default
spec:
  progressDeadlineSeconds: 600
  revisionHistoryLimit: 3
  selector:
    matchLabels:
      name: http-server
  template:
    metadata:
      labels:
        app: http-server
        name: http-server
    spec:
      containers:
        - args:
            - /home/app/http_server.rb
          command:
            - ruby
          env:
            - name: WEB_PORT
              value: "8080"
          image: http-server:0.0.2
          imagePullPolicy: IfNotPresent
          lifecycle: {}
          name: http-server
          resources:
            limits:
              cpu: "1"
              memory: 1Gi
            requests:
              cpu: "0.25"
              memory: 100Mi
          securityContext:
            runAsUser: 1001
            allowPrivilegeEscalation: false
          ports:
            - name: http
              containerPort: 8080
              protocol: TCP
          livenessProbe:
            httpGet:
              path: /healthcheck
              port: http
            initialDelaySeconds: 3
            periodSeconds: 3
          startupProbe:
            httpGet:
              path: /
              port: http
            failureThreshold: 5
            periodSeconds: 10
          readinessProbe:
            failureThreshold: 5
            httpGet:
              path: /
              port: http
            initialDelaySeconds: 5
            periodSeconds: 3
            successThreshold: 1
            timeoutSeconds: 5
      securityContext:
        fsGroup: 1001
        runAsGroup: 1001
        runAsUser: 1001
      terminationGracePeriodSeconds: 60
