apiVersion: apps/v1
kind: Deployment
metadata:
  name: uclhc-frontend
  namespace: osg-frontends
spec:
  replicas: 1
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 1
    type: RollingUpdate
  selector:
    matchLabels:
      k8s-app: uclhc-frontend
  template:
    metadata:
      labels:
        k8s-app: uclhc-frontend
    spec:
      affinity:
        nodeAffinity:
         requiredDuringSchedulingIgnoredDuringExecution:
           nodeSelectorTerms:
           - matchExpressions:
             - key: kubernetes.io/hostname
               operator: NotIn
               values:
               - nrp-c14.nysernet.org
      containers:
      - env:
        - name: VO_POOL
          value: "uclhc-fe-1.t2.ucsd.edu" 
        - name: GWMS_FE_VS_REPO_1
          value: https://github.com/opensciencegrid/osg-flock.git
        name: uclhc-frontend
        image: glideinwms/gwms-frontend:dev
        ports:
        - containerPort: 80 
        volumeMounts:
        - mountPath: /var/lib/gwms-frontend/web-area
          name: web-storage
        - mountPath: /etc/grid-security/gwms-frontend
          name: proxycerts-secret
          readOnly: true
        - mountPath: /etc/gwms-frontend/proxies.ini
          subPath: proxies.ini
          name: proxies-config
        - mountPath: /etc/gwms-frontend/frontend.xml.base
          subPath: frontend.xml.base
          name: fexml-config
        resources:
          limits:
            cpu: 1
            memory: 4Gi
          requests:
            cpu: 1
            memory: 3Gi
      restartPolicy: Always
      volumes:
        - name: web-storage
          persistentVolumeClaim:
            claimName: uclhc-storage
        - name: proxycerts-secret
          secret:
            secretName: uclhcproxycerts
            defaultMode: 0600
        - name: fexml-config
          configMap:
             name: uclhc-fexml
             items:
             - key: frontend.xml.k8s
               path: frontend.xml.base
        - name : proxies-config
          configMap:
             defaultMode: 420
             items:
             - key: proxies.ini
               path: proxies.ini
             name: uclhc-proxies-config
