kind: Deployment
apiVersion: apps/v1

metadata:
  name: juno-ui-components
  namespace: juno

spec:
  selector:
    matchLabels:
      app: juno-ui-components
  revisionHistoryLimit: 3
  replicas: 1
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 0
      maxSurge: 2
  template:
    metadata:
      labels:
        app: juno-ui-components
    spec:
      # The preStop hook below sleeps 30 seconds, extend the gracePeriod accordingly
      terminationGracePeriodSeconds: 60
      containers:
        - name: juno-ui-components
          image: "{{ .Values.global.registry }}/juno-ui-components:{{ .Values.image_tag }}"
          imagePullPolicy: IfNotPresent
          ports:
            - name: http
              containerPort: 3000

          livenessProbe:
            httpGet:
              path: /
              port: 3000
            timeoutSeconds: 10
            periodSeconds: 60
            initialDelaySeconds: 60
          readinessProbe:
            httpGet:
              path: /
              port: 3000
            timeoutSeconds: 5
            periodSeconds: 5
          resources:
            limits:
              cpu: "1000m"
              memory: "256Mi"
            requests:
              cpu: "1000m"
              memory: "256Mi"
          lifecycle:
            preStop:
              exec:
                #Give the ingress some time to reload its config
                command: ["/bin/sh", "-c", "sleep 30"]
