# This pod template is used in the Jenkins pipeline by the Kubernetes plugin. It
# defines the actual coreos-assembler container that will do the work.

apiVersion: v1
metadata:
  name: coreos-assembler
  labels:
    app: fedora-coreos
kind: Pod
spec:
  # run as `jenkins` so we can do `oc start-build`
  serviceAccountName: jenkins
  containers:
   - name: jnlp
     image: jenkins-slave-base-centos7:latest
     args: ['$(JENKINS_SECRET)', '$(JENKINS_NAME)']
   - name: coreos-assembler
     image: COREOS_ASSEMBLER_IMAGE
     imagePullPolicy: Always
     command: ['/usr/bin/dumb-init']
     args: ['sleep', 'infinity']
     env:
       - name: AWS_FCOS_BUILDS_BOT_CONFIG
         value: /.aws-fcos-builds-bot-config/config
       - name: AWS_FCOS_KOLA_BOT_CONFIG
         value: /.aws-fcos-kola-bot-config/config
       - name: GCP_IMAGE_UPLOAD_CONFIG
         value: /.gcp-image-upload-config/config
       - name: GCP_KOLA_TESTS_CONFIG
         value: /.gcp-kola-tests-config/config
     volumeMounts:
     - name: cache
       mountPath: /srv/
     - name: aws-fcos-builds-bot-config
       mountPath: /.aws-fcos-builds-bot-config/
       readOnly: true
     - name: aws-fcos-kola-bot-config
       mountPath: /.aws-fcos-kola-bot-config/
       readOnly: true
     - name: gcp-image-upload-config
       mountPath: /.gcp-image-upload-config/
       readOnly: true
     - name: gcp-kola-tests-config
       mountPath: /.gcp-kola-tests-config/
       readOnly: true
     - name: github-token
       mountPath: /.github
       readOnly: true
     - name: fedora-messaging-cfg
       mountPath: /etc/fedora-messaging-cfg
       readOnly: true
     - name: fedora-messaging-coreos-key
       mountPath: /run/fedora-messaging-coreos-key
       readOnly: true
     securityContext:
       privileged: false
     resources:
       requests:
         memory: COREOS_ASSEMBLER_MEMORY_REQUEST
         devices.kubevirt.io/kvm: '1'
       limits:
         devices.kubevirt.io/kvm: '1'
  volumes:
  - name: cache
    # XXX Disabled for now; we're seeing odd I/O issues possibly related to NFS:
    # https://github.com/coreos/fedora-coreos-pipeline/issues/212
    #persistentVolumeClaim:
    #  claimName: coreos-assembler-claim2
    emptyDir: {}
  # This secret is used for uploading to AWS
  - name: aws-fcos-builds-bot-config
    secret:
      secretName: aws-fcos-builds-bot-config
      optional: true
  # This secret is used for running aws kola tests
  - name: aws-fcos-kola-bot-config
    secret:
      secretName: aws-fcos-kola-bot-config
      optional: true
  # This secret is used for uploading to GCP
  - name: gcp-image-upload-config
    secret:
      secretName: gcp-image-upload-config
      optional: true
  # This secret is used for running GCP kola tests
  - name: gcp-kola-tests-config
    secret:
      secretName: gcp-kola-tests-config
      optional: true
  - name: github-token
    secret:
      secretName: coreosbot-github-token
      optional: true
  # These two here are used for signing with RoboSignatory
  - name: fedora-messaging-cfg
    configMap:
      name: fedora-messaging-cfg
      optional: true
  - name: fedora-messaging-coreos-key
    secret:
      secretName: fedora-messaging-coreos-key
      optional: true
