How to disable the default Node Affinity rule added to Kubernetes agents of CloudBees CI ?

Issue

  • I want to disable the node affinity rule that is automatically added to CloudBees CI (CloudBees Core) kubernetes agents:
kind: "Pod"
spec:
  affinity:
    podAntiAffinity:
      preferredDuringSchedulingIgnoredDuringExecution:
        - weight: 1
          podAffinityTerm:
            topologyKey: kubernetes.io/hostname
            labelSelector:
              matchExpressions:
                - key: com.cloudbees.cje.type
                  operator: In
                  values:
                    - master
                    - cjoc

Environment

Explanation

Since version 1.11.17 of the CloudBees Kube Agent Management plugin, a node affinity rule is automatically added to the agents spun up. This rule gives a scheduling preference to nodes where there are no Masters or Operations Center running.

Resolution

The default affinity rule can be disabled via a System Property. Depending on the version of the CloudBees Kube Agent Management plugin, the system property differs. See How to add Java arguments to Jenkins on CloudBees CI Modern ? to understand how to do this.

Version 1.1.32 and later

Add the system property com.cloudbees.jenkins.plugins.kube.Config.enableAffinity=false and restart the Master from Operations Center.

Note: The rule can also be disabled live by executing the Groovy script com.cloudbees.jenkins.plugins.kube.Config.ENABLE_AFFINITY=false under Manage Jenkins > Script Console. This does not survive a restart however.

Version prior to 1.1.32

Add the system property com.cloudbees.jenkins.plugins.kube.AffinityPodTemplateFilter.disabled=true and restart the Master from Operations Center.

Have more questions?

0 Comments

Please sign in to leave a comment.