Create the namespace-scoped PodPlacementConfig object

After creating the ClusterPodPlacementConfig object, you can configure pod placement at the namespace level by creating namespace-scoped PodPlacementConfig objects.

PodPlacementConfig objects modify the pod placement controller’s behavior at the namespace level, and take precedence over the ClusterPodPlacementConfig object.

Prerequisites
  • You have created a ClusterPodPlacementConfig object.

Procedure
  1. Using a text editor, create a YAML file based on the following example and modify the example with your namespace values:

    Example PodPlacementConfig object configuration
    apiVersion: multiarch.openshift.io/v1beta1
    kind: PodPlacementConfig
    metadata:
      name: my-namespace-config
      namespace: my-namespace
    spec:
      labelSelector:
          matchExpressions:
            - key: app
              operator: In
              values:
                - my-label-for-apps-performing-better-on-arm64
      priority: 100
      plugins:
        nodeAffinityScoring:
          enabled: true
          platforms:
            - architecture: amd64
              weight: 25
            - architecture: arm64
              weight: 75

    where:

    metadata

    Specifies the object name, and namespace name. This parameter is required.

    spec.labelSelector

    Optionally specifies a label so that the PodPlacementConfig only applies to a subset of pods in the namespace. If you do not specify this parameter, the PodPlacementConfig applies to all pods in the namespace.

    spec.priority

    Optionally specifies a priority in case multiple PodPlacementConfig objects exist in one namespace. Higher priorities take precedence. Valid values are 0-255, and the default value is 0. If you specify multiple PodPlacementConfig objects in one namespace, they must have different priority values.

    spec.plugins.nodeAffinityScoring

    Specifies architecture preferences for pod placement. The controller prioritizes nodes based on the architecture scores, with higher weights taking precedence. If you enable this plugin by setting spec.plugins.nodeAffinityScoring.enabled to true, you must specify at least one platform with an architecture and weight value.

    spec.plugins.nodeAffinityScoring.platforms[]

    Specifies one or more platform configurations, each with a required architecture and weight pair. This parameter is required if spec.plugins.nodeAffinityScoring is present. Valid architecture values are arm64, amd64, ppc64le, and s390x. Valid weight values are 0-100. Each architecture can only be specified once.

  2. Apply the configuration file by running the following command:

    $ oc create -f <filename>

    Replace <filename> with the name of the PodPlacementConfig configuration file.