apiVersion: batch/v1
kind: Job
metadata:
  labels:
    team: tbd
  name: helse-sparker
  namespace: tbd
spec:
  ttlSecondsAfterFinished: 86400
  completions: 1
  parallelism: 1
  backoffLimit: 0
  template:
    spec:
      containers:
        - name: helse-sparker
          image: docker.pkg.github.com/navikt/helse-sparker/sparker:<lim inn SHA her>
          resources:
            requests:
              memory: 256Mi
              cpu: 100m
            limits:
              memory: 4096Mi
              cpu: 2000m
          volumeMounts:
            - mountPath: /var/run/secrets/nais.io/vault
              name: vault-secrets
              subPath: subpath/var/run/secrets/nais.io/vault
            - mountPath: /var/run/secrets/nais.io/service_user
              name: vault-secrets
              subPath: subpath/var/run/secrets/nais.io/service_user
            - mountPath: /etc/ssl/certs/java/cacerts
              name: ca-bundle
              subPath: ca-bundle.jks
          env:
            - name: VAULT_TOKEN_PATH
              value: /var/run/secrets/nais.io/vault/vault_token
            - name: KAFKA_BOOTSTRAP_SERVERS
              value: b27apvl00045.preprod.local:8443,b27apvl00046.preprod.local:8443,b27apvl00047.preprod.local:8443
            - name: KAFKA_RAPID_TOPIC
              value: helse-rapid-v1
            - name: DATABASE_HOST
              value: b27dbvl022.preprod.local
            - name: DATABASE_PORT
              value: "5432"
            - name: DATABASE_NAME
              value: helse-sparker
            - name: VAULT_MOUNTPATH
              value: postgresql/preprod-fss/
            - name: NAV_TRUSTSTORE_PATH
              value: /etc/ssl/certs/java/cacerts
            - name: NAV_TRUSTSTORE_PASSWORD
              value: changeme
      imagePullSecrets:
        - name: gpr-credentials
      initContainers:
        - name: vks-init
          image: navikt/vault-sidekick:v0.3.10-d122b16
          resources:
            requests:
              memory: "64Mi"
              cpu: "100m"
            limits:
              memory: "128Mi"
              cpu: "1000m"
          volumeMounts:
            - mountPath: /var/run/secrets/nais.io/vault
              name: vault-secrets
              subPath: subpath/var/run/secrets/nais.io/vault
            - mountPath: /var/run/secrets/nais.io/service_user
              name: vault-secrets
              subPath: subpath/var/run/secrets/nais.io/service_user
          args:
            - -v=10
            - -logtostderr
            - -vault=https://vault.adeo.no
            - -one-shot
            - -save-token=/var/run/secrets/nais.io/vault/vault_token
            - -cn=secret:serviceuser/data/dev/srvhelsesparker:dir=/var/run/secrets/nais.io/service_user,fmt=flatten,retries=1
          env:
            - name: VAULT_AUTH_METHOD
              value: kubernetes
            - name: VAULT_SIDEKICK_ROLE
              value: helse-sparker
            - name: VAULT_K8S_LOGIN_PATH
              value: auth/kubernetes/preprod/fss/login
      serviceAccount: podcreator
      serviceAccountName: podcreator
      volumes:
        - name: vault-secrets
          emptyDir:
            medium: Memory
        - name: ca-bundle
          configMap:
            defaultMode: 420
            name: ca-bundle-jks
      restartPolicy: Never

