apiVersion: batch/v1
kind: Job
metadata:
  name: funksjonelle-tester
spec:
  backoffLimit: 2
  template:
    spec:
      imagePullSecrets:
        - name: gpr-credentials
      serviceAccountName: default
      restartPolicy: Never
      initContainers:
        - name: vks-init
          image: navikt/vault-sidekick:v0.3.10-d122b16
          resources:
            limits:
              cpu: "1"
              memory: "1024Mi"
            requests:
              cpu: "0.5"
              memory: "512Mi"
          args:
          - -v=10
          - -logtostderr
          - -vault=https://vault.adeo.no
          - -one-shot
          - -cn=secret:kv/preprod/fss/dp-regel-api-arena-adapter/default:dir=/var/run/secrets/nais.io/vault,fmt=flatten
          env:
          - name: VAULT_AUTH_METHOD
            value: kubernetes
          - name: VAULT_SIDEKICK_ROLE
            value: dp-funksjonelle-tester
          - name: VAULT_K8S_LOGIN_PATH
            value: auth/kubernetes/preprod/fss/login
          volumeMounts:
          - mountPath: /var/run/secrets/nais.io/vault
            name: vault-volume
            subPath: subpath/var/run/secrets/nais.io/vault
      containers:
        - name: dp-funksjonelle-tester
          resources:
            limits:
              cpu: "1"
              memory: "1024Mi"
            requests:
              cpu: "0.5"
              memory: "512Mi"
          env:
          - name: CUCUMBER_ENV
            value: dev
          - name: NAV_TRUSTSTORE_PATH
            value: /etc/ssl/certs/java/cacerts
          - name: NAV_TRUSTSTORE_PASSWORD
            value: changeme
          image:  docker.pkg.github.com/navikt/dagpenger-funksjonelle-tester/dagpenger-funksjonelle-tester:latest
          imagePullPolicy: Always
          volumeMounts:
            - mountPath: /etc/ssl/certs/ca-certificates.crt
              name: ca-bundle-pem
              readOnly: true
              subPath: ca-bundle.pem
            - mountPath: /etc/pki/tls/certs/ca-bundle.crt
              name: ca-bundle-pem
              readOnly: true
              subPath: ca-bundle.pem
            - mountPath: /etc/ssl/ca-bundle.pem
              name: ca-bundle-pem
              readOnly: true
              subPath: ca-bundle.pem
            - mountPath: /etc/pki/tls/cacert.pem
              name: ca-bundle-pem
              readOnly: true
              subPath: ca-bundle.pem
            - mountPath: /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem
              name: ca-bundle-pem
              readOnly: true
              subPath: ca-bundle.pem
            - mountPath: /etc/ssl/certs/java/cacerts
              name: ca-bundle-jks
              readOnly: true
              subPath: ca-bundle.jks
            - mountPath: /var/run/secrets/nais.io/vault/
              name: vault-volume
              subPath: subpath/var/run/secrets/nais.io/vault
      volumes:
      - name: vault-volume
        emptyDir:
          medium: Memory
      - name: ca-bundle-pem
        configMap:
          defaultMode: 420
          name: ca-bundle-pem
      - name: ca-bundle-jks
        configMap:
          defaultMode: 420
          name: ca-bundle-jks
