---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: fastapi-project-template
  namespace: default
spec:
  replicas: 2 
  selector:
    matchLabels:
      app: fastapi-project-template
  template:
    metadata:
      labels:
        app: fastapi-project-template 
    spec:
      affinity:
        podAntiAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
          - labelSelector:
              matchLabels:
                app: fastapi-project-template
            topologyKey: kubernetes.io/hostname
      containers:
        - name: fastapi-project-template 
          image: leo-python:3.8-buster
          volumeMounts:
            - mountPath: /test1
              name: my-volume
            - mountPath: /etc/test/conf
              name: leocm
      tolerations:
        - key: CriticalAddonsOnly
          operator: Exists
        - effect: NoSchedule
          key: node-role.kubernetes.io/master
      volumes:
        - name: my-volume
          persistentVolumeClaim:
            claimName: leo-test-pvc
        - name: leocm
          configMap:
            name: leoconfigmap
