---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: martian-imperial-year-table
spec:
  replicas: 2
  revisionHistoryLimit: 3
  selector:
    matchLabels:
      app: martian-imperial-year-table
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 50%
      maxUnavailable: 50%
  template:
    metadata:
      labels:
        role: web
    spec:
      volumes:
        - name: mackerel-agent-config
          configMap:
            name: mackerel-agent-config
      containers:
        - name: web
          image: gcr.io/c4se-197915/martian_imperial_year_table:latest
          imagePullPolicy: Always
          ports:
            - containerPort: 5000
              protocol: TCP
          readinessProbe:
            httpGet:
              path: /ops/heartbeat
              port: 5000
          resources:
            requests:
              cpu: 100m
              memory: 128Mi
            limits:
              cpu: 200m
              memory: 256Mi
        - name: mackerel-container-agent
          image: mackerel/mackerel-container-agent:plugins
          imagePullPolicy: Always
          resources:
            requests:
              cpu: 50m
              memory: 54Mi
            limits:
              cpu: 100m
              memory: 128Mi
          env:
            - name: MACKEREL_AGENT_CONFIG
              value: /etc/mackerel/mackerel.yaml
            - name: MACKEREL_CONTAINER_PLATFORM
              value: kubernetes
            - name: MACKEREL_KUBERNETES_KUBELET_HOST
              valueFrom:
                fieldRef:
                  fieldPath: status.hostIP
            - name: MACKEREL_KUBERNETES_NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
            - name: MACKEREL_KUBERNETES_POD_NAME
              valueFrom:
                fieldRef:
                  fieldPath: metadata.name
          envFrom:
            - secretRef:
                name: martian-imperial-year-table
          volumeMounts:
            - name: mackerel-agent-config
              mountPath: /etc/mackerel
              readOnly: true
