# https://cloud.google.com/kubernetes-engine/docs/concepts/deployment
# - Deployments represent a set of multiple, identical Pods with no unique identities. A Deployment runs multiple replicas of your application and automatically replaces any instances that fail or become unresponsive. In this way, Deployments help ensure that one or more instances of your application are available to serve user requests. Deployments are managed by the Kubernetes Deployment controller.
# - Deployments use a Pod template, which contains a specification for its Pods. The Pod specification determines how each Pod should look like: what applications should run inside its containers, which volumes the Pods should mount, its labels, and more.
# - When a Deployment's Pod template is changed, new Pods are automatically created one at a time.
apiVersion: apps/v1
kind: Deployment
metadata:
  name:  fantasy-world
  namespace: default
  labels:
    app:  fantasy-world
spec:
  selector:
    matchLabels:
      app: fantasy-world
  replicas: 1
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      labels:
        app:  fantasy-world
    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:  fantasy-map
        image:  "kinddndmap:latest"
        resources:
          requests:
            cpu: 100m
            memory: 100Mi
          limits:
            cpu: 100m
            memory: 100Mi
        ports:
        - containerPort:  9000
          name:  fantasy-map
        volumeMounts:
        - name: localtime
          mountPath: /etc/localtime
      - name:  fantasy-towns
        image:  "kinddnd:latest"
        resources:
          requests:
            cpu: 100m
            memory: 100Mi
          limits:
            cpu: 100m
            memory: 100Mi
        ports:
        - containerPort:  8090
          name:  fantasy-towns
        volumeMounts:
        - name: localtime
          mountPath: /etc/localtime
      volumes:
        - name: localtime
          hostPath:
            path: /usr/share/zoneinfo/Asia/Shanghai
      restartPolicy: Always
    