#
# These worker nodes will be prempted, use with care
#
apiVersion: apps/v1
kind: Deployment
metadata:
  name: osg-wn-cpu-suncave4
  namespace: osggpus
  labels: 
    k8s-app: osg-wn-cpu-suncave4
spec:
  replicas: 100
  selector:
    matchLabels:
      k8s-app: osg-wn-cpu-suncave4
  template:
    metadata: 
      labels:
        k8s-app: osg-wn-cpu-suncave4
    spec:
      priorityClassName: opportunistic
      tolerations:
      - effect: NoSchedule
        key: nautilus.io/suncave
        operator: Exists
      nodeSelector:
        kubernetes.io/osg-gpu: good
        nautilus.io/latency: suncave-b
      containers:
      - name: osg-wn-cpu
        image: sfiligoi/prp-osg-pool:wn-cpu
        imagePullPolicy: Always
        #command: ["sh", "-c", "sleep infinity"]
        resources:
           limits:
             memory: 13Gi
             cpu: 6
           requests:
             memory: 10Gi
             cpu: 3
             # qill schedule 4 jobs but expect only 75% efficiency
        volumeMounts:
        - name: configpasswd
          mountPath: /var/lock/condor/pool_password
          subPath: pool_password
          readOnly: true
        - name: confighost
          mountPath: /etc/condor/config.d/50_condor_host.config
          subPath: 50_condor_host.config
        - name: configmem
          mountPath: /etc/condor/config.d/02_memory_limits_10g.config
          subPath: 02_memory_limits_10g.config
        - name: configic
          mountPath: /etc/condor/config.d/09_icecube.config
          subPath: 09_icecube.config
        - name: configusers
          mountPath: /usr/local/sbin/add_image_users.sh
          subPath: add_image_users.sh
        - name: cvmfs-config-osg
          mountPath: /cvmfs/config-osg.opensciencegrid.org
          readOnly: true
        - name: cvmfs-oasis
          mountPath: /cvmfs/oasis.opensciencegrid.org
          readOnly: true
        - name: cvmfs-connect
          mountPath: /cvmfs/connect.opensciencegrid.org
          readOnly: true
        - name: cvmfs-icecube
          mountPath: /cvmfs/icecube.opensciencegrid.org
          readOnly: true
        - name: cvmfs-xenon
          mountPath: /cvmfs/xenon.opensciencegrid.org
          readOnly: true
        - name: cvmfs-stash
          mountPath: /cvmfs/stash.osgstorage.org
          readOnly: true
        - name: cvmfs-sing
          mountPath: /cvmfs/singularity.opensciencegrid.org
          readOnly: true
      volumes:
      - name: configpasswd
        secret:
          secretName: osg-pool-sdsc-config
          items:
             - key: pool_password
               path: pool_password
          defaultMode: 256
      - name: confighost
        configMap:
          name: osg-wn-prp-config
          items:
             - key: 50_condor_host.config
               path: 50_condor_host.config
      - name: configmem
        configMap:
          name: osg-wn-prp-cpu-config
          items:
             - key: 02_memory_limits_10g.config
               path: 02_memory_limits_10g.config
      - name: configic
        configMap:
          name: osg-wn-prp-cpu-config
          items:
             - key: 09_icecube.config
               path: 09_icecube.config
      - name: configusers
        configMap:
          name: osg-wn-prp-config
          items:
             - key: add_image_users.sh
               path: add_image_users.sh
      - name: cvmfs-config-osg
        persistentVolumeClaim:
          claimName: csi-cvmfs-pvc-config-osg
          readOnly: true
      - name: cvmfs-oasis
        persistentVolumeClaim:
          claimName: csi-cvmfs-pvc-oasis
          readOnly: true
      - name: cvmfs-connect
        persistentVolumeClaim:
          claimName: csi-cvmfs-pvc-connect
          readOnly: true
      - name: cvmfs-icecube
        persistentVolumeClaim:
          claimName: csi-cvmfs-pvc-icecube
          readOnly: true
      - name: cvmfs-xenon
        persistentVolumeClaim:
          claimName: csi-cvmfs-pvc-xenon
          readOnly: true
      - name: cvmfs-stash
        persistentVolumeClaim:
          claimName: csi-cvmfs-pvc-stash
          readOnly: true
      - name: cvmfs-sing
        persistentVolumeClaim:
          claimName: csi-cvmfs-pvc-osg-singularity
          readOnly: true

