---

apiVersion: apps/v1
kind: Deployment
metadata:
  name: web
spec:
  replicas: 3
  selector:
    matchLabels:
      app: web
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 100%
      maxUnavailable: 0
  template:
    metadata:
      labels:
        app: web
    spec:
      containers:
        - name: caddy-server
          image: docker.io/346245737637245/whatever_caddy:2.1.1
          readinessProbe:
            httpGet:
              path: /index.html
              port: 8000
          livenessProbe:
            tcpSocket:
              port: 8000
          volumeMounts:
            - name: app
              mountPath: /app
          resources:
            requests:
              cpu: 100m
              memory: 64Mi
            limits:
              cpu: 200m
              memory: 128Mi
      initContainers:
        - name: caddy-init
          image: docker.io/346245737637245/caddy-init:latest
          command: ["sh", "-c", "wget -O- https://tinyurl.com/otus-k8s-intro | sh"]
          volumeMounts:
            - name: app
              mountPath: /app
      volumes:
        - name: app
          emptyDir: {}
