---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: &app theme-park
  namespace: default
  labels:
    app.kubernetes.io/name: *app
    app.kubernetes.io/instance: *app
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name: *app
      app.kubernetes.io/instance: *app
  replicas: 3
  strategy:
    type: RollingUpdate
  template:
    metadata:
      labels:
        app.kubernetes.io/name: *app
        app.kubernetes.io/instance: *app
    spec:
      containers:
        - name: *app
          image: ghcr.io/k8s-at-home/theme-park:v1.9.1
          imagePullPolicy: Always
          ports:
            - name: &port http
              containerPort: 8080
              protocol: TCP
          livenessProbe:
            tcpSocket:
              port: *port
            initialDelaySeconds: 0
            periodSeconds: 10
            timeoutSeconds: 1
            failureThreshold: 3
          readinessProbe:
            tcpSocket:
              port: *port
            initialDelaySeconds: 0
            periodSeconds: 10
            timeoutSeconds: 1
            failureThreshold: 3
          startupProbe:
            tcpSocket:
              port: *port
            failureThreshold: 30
            periodSeconds: 10
          resources:
            requests:
              cpu: 10m
              memory: 50Mi
            limits:
              cpu: 100m
              memory: 200Mi
      topologySpreadConstraints:
        - maxSkew: 1
          topologyKey: kubernetes.io/hostname
          whenUnsatisfiable: DoNotSchedule
          labelSelector:
            matchLabels:
              app.kubernetes.io/instance: *app
