apiVersion: apps/v1
kind: Deployment
metadata:
  name: jenkins-deployment
  labels:
    app: jenkins-master
  namespace: dev
spec:
  replicas: 1
  selector:
    matchLabels:
      app: jenkins-master
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0
  minReadySeconds: 30
  template:
    metadata:
      labels:
        app: jenkins-master
    spec:
      securityContext:
        fsGroup: 1000
        runAsUser: 1000
      serviceAccountName: jenkins
      hostname: jenkins
      terminationGracePeriodSeconds: 60
      containers:
      - name: jenkins-master
#        image: phanikumary1995/jenkins-oracle-jdk8
        image: phanikumary1995/jenkins-eks
        ports:
        - name: http-port
          containerPort: 8080
        - name: jnlp-port
          containerPort: 5000
        volumeMounts:
        - name: persistent-storage
          mountPath: /var/jenkins_home
        - name: docker-sock-volume
          mountPath: /var/run/docker.sock
#        resources:
#          requests:
#            memory: "2048Mi"
#            cpu: "1000m"
#          limits:
#            memory: "3072Mi"
#            cpu: "1500m"
        readinessProbe:
#          tcpSocket:
          httpGet:
            path: /login
            port: 8080
          initialDelaySeconds: 30
          timeoutSeconds: 2
          periodSeconds: 5
          successThreshold: 1
        livenessProbe:
#          tcpSocket:
          httpGet:
            path: /login
            port: 8080
          initialDelaySeconds: 30
          timeoutSeconds: 2
          periodSeconds: 5
          failureThreshold: 3
      volumes:
      - name: docker-sock-volume
        hostPath:
          path: /var/run/docker.sock
      - name: persistent-storage
        persistentVolumeClaim:
          claimName: jenkins-claim
#      nodeSelector:
#        server: node1
