apiVersion: apps/v1
kind: Deployment
metadata:
  name: shib
  annotations:
    pullSecrets: pullSecrets
spec:
  replicas: 1
  selector:
    matchLabels:
      app: shib
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 2
      maxUnavailable: 0
  template:
    metadata:
      labels:
        app: shib
    spec:
      volumes:
        - name: sp-keys-volume
          secret:
            secretName: sp-keys-secrets
      containers:
        - image: docker-ifs.devops.innovateuk.org/releases/sp-service:1.1.149
          name: shib
          volumeMounts:
            - name: sp-keys-volume
              mountPath: /var/certs
          livenessProbe:
            httpGet:
              path: /Shibboleth.sso/Metadata
              port: 9443
              scheme: HTTPS
            periodSeconds: 30
            timeoutSeconds: 5
            failureThreshold: 3
          readinessProbe:
            exec:
              command:
                - readiness-probe
            initialDelaySeconds: 30
            periodSeconds: 5
            timeoutSeconds: 5
            failureThreshold: 1
          imagePullPolicy: IfNotPresent
          env:
            - name: SP_DOMAIN
              valueFrom:
                configMapKeyRef:
                  name: shibboleth-config
                  key: SP_DOMAIN
            - name: IDP_DOMAIN
              valueFrom:
                configMapKeyRef:
                  name: shibboleth-config
                  key: IDP_DOMAIN
            - name: MPM_STARTSERVERS
              valueFrom:
                configMapKeyRef:
                  name: shibboleth-config
                  key: MPM_STARTSERVERS
            - name: MPM_MINSPARETHREADS
              valueFrom:
                configMapKeyRef:
                  name: shibboleth-config
                  key: MPM_MINSPARETHREADS
            - name: MPM_MAXSPARETHREADS
              valueFrom:
                configMapKeyRef:
                  name: shibboleth-config
                  key: MPM_MAXSPARETHREADS
            - name: MPM_THREADLIMIT
              valueFrom:
                configMapKeyRef:
                  name: shibboleth-config
                  key: MPM_THREADLIMIT
            - name: MPM_THREADSPERCHILD
              valueFrom:
                configMapKeyRef:
                  name: shibboleth-config
                  key: MPM_THREADSPERCHILD
            - name: MPM_MAXREQUESTWORKERS
              valueFrom:
                configMapKeyRef:
                  name: shibboleth-config
                  key: MPM_MAXREQUESTWORKERS
            - name: MPM_MAXCONNECTIONSPERCHILD
              valueFrom:
                configMapKeyRef:
                  name: shibboleth-config
                  key: MPM_MAXCONNECTIONSPERCHILD
            - name: MEMCACHE_ENDPOINT
              valueFrom:
                configMapKeyRef:
                  name: shibboleth-config
                  key: MEMCACHE_ENDPOINT
            - name: HTTPS_PORT
              value: "9443"
            - name: HTTP_PORT
              value: "9080"
          ports:
            - containerPort: 9443
            - containerPort: 9080
          resources:
            limits:
              memory: 600Mi
            requests:
              memory: 300Mi