apiVersion: apps/v1
kind: Deployment
metadata:
  name: jenkins-deployment
  namespace: marvel2-dev
spec:
  selector:
    matchLabels:
      app: jenkins-app
  replicas: 1
  template:
    metadata:
      labels:
        app: jenkins-app
    spec:
      securityContext:
        fsGroup: 1000
      volumes:
        - name: jenkins-vol
          persistentVolumeClaim:
            claimName: jenkins-pvc
      containers:
        - name: master
          image: jenkins/jenkins:lts
          imagePullPolicy: Always
          ports:
            - containerPort: 8080
              name: http
            - containerPort: 50000
              name: jnlp
          volumeMounts:
            - mountPath: "/var/jenkins_home"
              name: jenkins-vol
          resources:
              limits:
                cpu: 1
                memory: 1Gi
        - name: agent1
          image: sim.docker.zooxlabs.com/marvel2-jenkins-agent:3  # Our docker registry doesn't allow to overwrite 'latest', thus changing the tag everytime
          imagePullPolicy: Always
          command: ["/bin/sh"]
          args: ["-c", "sudo service docker start;java -jar /usr/share/jenkins/agent.jar -jnlpUrl http://localhost:8080/computer/agent1/slave-agent.jnlp -secret 713123ab8b0e466a17210c2c37d6700435696f54833668f461ee13dc829c6bf9 -workDir /home/jenkins"]
          securityContext:
            privileged: true
          ports:
            - containerPort: 50000
              name: jnlp
          resources:
              limits:
                cpu: 4
                memory: 4Gi
