apiVersion: apps/v1
kind: Deployment
metadata:
  name: jenkins
  namespace: devops-tools
spec:
  replicas: 1
  selector:
    matchLabels:
      app: jenkins-server
  template:
    metadata:
      labels:
        app: jenkins-server
    spec:
      securityContext:
            fsGroup: 0
            runAsUser: 0
      serviceAccountName: jenkins-admin
      containers:
        - name: jenkins
          #image: jenkins/jenkins:2.426.3-lts
          image: private-repo:5000/jenkins-custom:2.426.3-lts
          #resources:
          #  limits:
          #    memory: "2Gi"
          #    cpu: "1500m"
          #  requests:
          #    memory: "1Gi"
          #    cpu: "1000m"
          ports:
            - name: httpport
              containerPort: 8080
            - name: jnlpport
              containerPort: 50000
            - name: addhttpport
              containerPort: 9080
          livenessProbe:
            httpGet:
              path: "/login"
              port: 8080
            initialDelaySeconds: 90
            periodSeconds: 10
            timeoutSeconds: 5
            failureThreshold: 5
          readinessProbe:
            httpGet:
              path: "/login"
              port: 8080
            initialDelaySeconds: 60
            periodSeconds: 10
            timeoutSeconds: 5
            failureThreshold: 3
          volumeMounts:
            - name: jenkins-data
              mountPath: /var/jenkins_home
      nodeSelector: 
        name: node-1
      volumes:
        - name: jenkins-data
          persistentVolumeClaim:
              claimName: jenkins-pv-claim
