# Default values for Jenkins.
# This is a YAML-formatted file.
# Declare name/value pairs to be passed into your templates.
# name: value

master:
  componentName: jenkins-controller
  image: "jenkins/jenkins"
  tag: "lts"
  imagePullPolicy: "Always"
  # imagePullSecret: jenkins
  useSecurity: true
  adminUser: admin
  #  adminPassword: "<defaults to random>"
  ownSshKey: false
  # If CasC auto-reload is enabled, an SSH (RSA) keypair is needed.  Can either provide your own, or leave unconfigured\false to allow a random key to be auto-generated.
  # If you choose to use your own, you must upload your decrypted RSA private key (not the public key above) to a Kubernetes secret using the following command:
  # kubectl -n <namespace> create secret generic <helm_release_name> --dry-run --from-file=jenkins-admin-private-key=~/.ssh/id_rsa -o YAML |kubectl -n <namespace> apply -f -
  # Replace ~/.ssh/id_rsa in the above command with the path to your private key file and the <helm_release_name> and <namespace> placeholders to suit.
  resources:
    requests:
      cpu: "50m"
      memory: "256Mi"
    limits:
      cpu: "2000m"
      memory: "4096Mi"

  # Below is the implementation of Jenkins Configuration as Code.  Add a key under ConfigScripts for each configuration area,
  # where each corresponds to a plugin or section of the UI.  Each key (prior to | character) is just a label, and can be any value.
  # Keys are only used to give the section a meaningful name.  The only restriction is they may only contain RFC 1123 \ DNS label
  # characters: lowercase letters, numbers, and hyphens.  The keys become the name of a configuration YAML file on the controller in
  # /var/jenkins_home/casc_configs (by default) and will be processed by the Configuration as Code plugin.  The lines after each |
  # become the content of the configuration YAML file.  The first line after this is a JCasC root element, eg jenkins, credentials,
  # etc.  Best reference is https://<jenkins_url>/configuration-as-code/reference.  The example below creates a welcome message:
  JCasC:
    enabled: true
    pluginVersion: 1.35
    configScripts:
      welcome-message: |
        jenkins:
          systemMessage: Welcome to our CI\CD server.  This Jenkins is configured and managed 'as code'.

  sidecars:
    configAutoReload:
      # If enabled: true, Jenkins Configuration as Code will be reloaded on-the-fly without a reboot.  If false or not-specified,
      # JCasC changes will cause a reboot and will only be applied at the subsequent start-up.  Auto-reload uses the Jenkins CLI
      # over SSH to reapply config when changes to the ConfigScripts are detected.  The admin user (or account you specify in
      # Master.AdminUser) will have a random SSH private key (RSA 4096) assigned unless you specify OwnSshKey: true.  This will be saved to a k8s secret.
      enabled: true
      image: shadwell/k8s-sidecar:0.0.7
      imagePullPolicy: IfNotPresent
      resources:
      #   limits:
      #     cpu: 100m
      #     memory: 100Mi
      #   requests:
      #     cpu: 50m
      #     memory: 50Mi
      # SSH port value can be set to any unused TCP port.  The default, 1044, is a non-standard SSH port that has been chosen at random.
      # Is only used to reload JCasC config from the sidecar container running in the Jenkins controller pod.
      # This TCP port will not be open in the pod (unless you specifically configure this), so Jenkins will not be
      # accessible via SSH from outside of the pod.  Note if you use non-root pod privileges (RunAsUser & FsGroup),
      # this must be > 1024:
      sshTcpPort: 1044
      # label that the configmaps with Configuration as Code config are marked with:
      label: jenkins_config
      # folder in the pod that should hold the collected Configuration as Code config:
      folder: /var/jenkins_home/casc_configs
      # If specified, the sidecar will search for config-maps inside this namespace.
      # Otherwise the namespace in which the sidecar is running will be used.
      # It's also possible to specify ALL to search in all namespaces:
      # searchNamespace:

  containerEnv:
  initContainerEnv:

  # Set min/max heap here if needed with:
  # JavaOpts: "-Xms512m -Xmx512m"
  # Optionally configure a JMX port
  # requires additional JavaOpts, ie
  # JavaOpts: >
  #   -Dcom.sun.management.jmxremote.port=4000
  #   -Dcom.sun.management.jmxremote.authenticate=false
  #   -Dcom.sun.management.jmxremote.ssl=false
  # JMXPort: 4000
  # List of plugins to be install during Jenkins controller start
  installPlugins:
    - kubernetes:latest
    - kubernetes-credentials:latest
    - workflow-aggregator:latest
    - workflow-job:latest
    - credentials-binding:latest
    - git:latest

    # - saml:1.0.5
    # - docker-custom-build-environment:latest
  # Used to approve a list of groovy functions in pipelines used the script-security plugin. Can be viewed under /scriptApproval
  # ScriptApproval:
  #   - "method groovy.json.JsonSlurperClassic parseText java.lang.String"
  #   - "new groovy.json.JsonSlurperClassic"
  # List of groovy init scripts to be executed during Jenkins controller start
  initScripts:
  #  - |
  #    print 'adding global pipeline libraries, register properties, bootstrap jobs...'
  customConfigMap: false

  servicePort: 8080
  # For minikube, set this to NodePort, elsewhere use LoadBalancer
  # Use ClusterIP if your setup includes ingress controller
  serviceType: ClusterIP
  serviceAnnotations: {}
  slaveListenerPort: 50000
  loadBalancerSourceRanges:
    - 0.0.0.0/0
  # HostName: jenkins.cicd.your.cloud
  ingress:
    enabled: false
    # annotations:
    #   kubernetes.io/ingress.class: nginx
    #   kubernetes.io/tls-acme: "false"
    # tls:
    #  - secretName: jenkins.cicd.your.cloud
    #    hosts:
    #      - jenkins.cicd.your.cloud

persistence:
  enabled: false
  ## A manually managed Persistent Volume and Claim
  ## Requires Persistence.Enabled: true
  ## If defined, PVC must be created manually before volume will be bound
  # ExistingClaim: jenkins

  ## If defined, volume.beta.kubernetes.io/storage-class: <StorageClass>
  ## Default: volume.alpha.kubernetes.io/storage-class: default
  ##
  # StorageClass:
  #AccessMode: ReadWriteOnce
  #Size: 500Gi
  volumes:
  # - name: nothing
  #   emptyDir: {}
  mounts:
  # - mountPath: /var/nothing
  #  name: nothing
  #  readOnly: true

networkPolicy:
  # Enable creation of NetworkPolicy resources.
  enabled: true
  # For Kubernetes v1.4, v1.5 and v1.6, use 'extensions/v1beta1'
  # For Kubernetes v1.7, use 'networking.k8s.io/v1'
  apiVersion: extensions/v1beta1
