# https://kubernetes.io/docs/concepts/workloads/controllers/deployment/
apiVersion: apps/v1
kind: Deployment
metadata:
  name: portfolio
  namespace: portfolio
  labels:
    app: portfolio
spec:
  # serviceAccountName: jenkins
  selector:
    matchLabels:
      app: portfolio
  replicas: 2
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: portfolio
    spec:
      # initContainers:
      # Init containers are exactly like regular containers, except:
      # - Init containers always run to completion.
      # - Each init container must complete successfully before the next one starts.
      containers:
        - name: portfolio
          image: keresifon/kubernetes:latest
          imagePullPolicy: Always
          resources:
            requests:
              cpu: 100m
              memory: 500Mi
            limits:
              cpu: 100m
              memory: 500Mi
          ports:
            - containerPort: 80
              name: portfolio

      restartPolicy: Always
