apiVersion: apps/v1
kind: Deployment
metadata:
  name: jenkins
  namespace: default
spec:
  replicas: 1
  selector:
    matchLabels:
      run: jenkins
  template:
    metadata:
      labels:
        run: jenkins
    spec:
      securityContext:
            fsGroup: 1000 
            runAsUser: 1000
      serviceAccountName: jenkins-admin
      containers:
        - name: jenkins
          image: jenkins/jenkins:lts-jdk11
          resources:
            limits:
              memory: "4Gi"
              cpu: "2500m"
            requests:
              memory: "1000Mi"
              cpu: "1500m"
          ports:
            - name: http
              containerPort: 8080
            - name: jnlpport
              containerPort: 50000
# 2023-01-31 can't get these to work. By default, host and scheme are blank
#          livenessProbe:
#            httpGet:
#              host: "jenkins.monkeybox.org"
#              scheme: HTTPS
#              path: "/login"
#              #port: 8080
#              port: 443
#            initialDelaySeconds: 90
#            periodSeconds: 10
#            timeoutSeconds: 5
#            failureThreshold: 5
#          readinessProbe:
#            httpGet:
#              host: "jenkins.monkeybox.org"
#              scheme: HTTPS
#              path: "/login"
#              #port: 8080
#              port: 443
#            initialDelaySeconds: 60
#            periodSeconds: 10
#            timeoutSeconds: 5
#            failureThreshold: 3
          volumeMounts:
            - name: jenkins-data
              mountPath: /var/jenkins_home         
# Initially installed without dnsConfig. We'll see if it's needed.
#          dnsConfig:
#           nameservers:
#             - 10.42.42.239
#             - 10.42.42.1
#            searches:
#              - default.svc.cluster.local
#              - svc.cluster.local
#              - cluster.local
#           options:
#             - name: ndots
#               value: "2"
#             - name: edns0
#             - name: trust-ad
      volumes:
        - name: jenkins-data
          persistentVolumeClaim:
              claimName: jenkins-pv-claim
