Maximo Application Suite
Customer-managed

Customizing workload affinity

As an administrator, you can customize and improve control of the pod scheduling process. You can constrain a pod so that it is restricted or preferred to run on particular nodes.

About this task

You can restrict or prefer the pods to run on specific nodes by using nodeAffinity, podAffinity, or podAntiAffinity methods. For more information, see Assigning Pods to Nodes.

Procedure

  1. In the Red Hat® OpenShift® web console, from the side navigation menu, click Administration > CustomResourceDefinitions and locate the custom resource that you want to customize.
  2. Click Instances and open the instance of the custom resource that you want to work on.
  3. Click the YAML tab to open the editor.
  4. If the podTemplates field does not exist, add the podTemplates field inside the spec property.
    Note:
    • For IBM® Maximo® Health, inside the spec property, add the components, health, and then the podTemplates field.
    • For the IoT tool, inside the spec property, add the components section. In the components section, add all the component names, and then the podTemplates field. For example,
      spec:
       components:
        actions: # actions is the IoT component name
         podTemplates: {} # templates for the actions component operator
  5. Add or change the pod entry according to your requirement.
    For example in the following sample code, admin-dashboard is the pod entry that is edited.
  6. Add the field affinity inside of which you can add nodeAffinity, podAffnitiy, and podAntiAffinity according to your requirements.
    kind: Suite
    apiVersion: core.mas.ibm.com/v1
    metadata:
      name: inst1
      namespace: mas-inst1-core
      labels:
        mas.ibm.com/instanceId: inst1
    spec:
      podTemplates:
        - name: admin-dashboard
          affinity:
            nodeAffinity:
              preferredDuringSchedulingIgnoredDuringExecution:
                - weight: 1
                  preference:
                    matchExpressions:
                      - key: runtimeType
                        operator: In
                        values:
                          - frontend
            podAffinity:
              requiredDuringSchedulingIgnoredDuringExecution:
                - labelSelector:
                    matchExpressions:
                      - key: security
                        operator: In
                        values:
                          - S1
                  topologyKey: topology.kubernetes.io/zone
            podAntiAffinity:
              preferredDuringSchedulingIgnoredDuringExecution:
                - weight: 100
                  podAffinityTerm:
                    labelSelector:
                      matchExpressions:
                        - key: security
                          operator: In
                          values:
                            - S2
                      topologyKey: topology.kubernetes.io/zone
    
  7. Click Save. Wait for the operator to reconcile and apply your changes.