PodAffinityTerm#

pydantic model controller.models.domain.kubernetes.PodAffinityTerm#

Pod matching term for pod affinity.

Parameters:

data (Any) –

Show JSON schema
{
   "title": "PodAffinityTerm",
   "description": "Pod matching term for pod affinity.",
   "type": "object",
   "properties": {
      "labelSelector": {
         "anyOf": [
            {
               "$ref": "#/$defs/LabelSelector"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Match rules for pod labels",
         "title": "Pod label match"
      },
      "namespaceSelector": {
         "anyOf": [
            {
               "$ref": "#/$defs/LabelSelector"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Match rules for namespace labels",
         "title": "Namespace label match"
      },
      "namespaces": {
         "default": [],
         "description": "List of namespaces to which this term applies. The term will apply to the union of this list of namespaces and any namespaces that match ``namespaceSelector``, if given. If both are empty, only the pod's namespace is matched.",
         "items": {
            "type": "string"
         },
         "title": "Matching namespaces",
         "type": "array"
      },
      "topologyKey": {
         "description": "Name of the node label that should match between nodes to consider two pods to be scheduled on adjacent nodes, which in turn is the definition of an affinity (and the opposite of an anti-affinity).",
         "title": "Node topology label",
         "type": "string"
      }
   },
   "$defs": {
      "LabelSelector": {
         "additionalProperties": false,
         "description": "Rule for matching labels of pods or namespaces.\n\nAll provided expressions must match. (In other words, they are combined\nwith and.)",
         "properties": {
            "matchExpressions": {
               "default": [],
               "description": "Rules for matching labels",
               "items": {
                  "$ref": "#/$defs/LabelSelectorRequirement"
               },
               "title": "Label match expressions",
               "type": "array"
            },
            "matchLabels": {
               "additionalProperties": {
                  "type": "string"
               },
               "default": {},
               "description": "Label keys and values that must be set",
               "title": "Exact label matches",
               "type": "object"
            }
         },
         "title": "LabelSelector",
         "type": "object"
      },
      "LabelSelectorOperator": {
         "description": "Match operations for label selectors.",
         "enum": [
            "In",
            "NotIn",
            "Exists",
            "DoesNotExist"
         ],
         "title": "LabelSelectorOperator",
         "type": "string"
      },
      "LabelSelectorRequirement": {
         "additionalProperties": false,
         "description": "Single rule for label matching.",
         "properties": {
            "key": {
               "description": "Label key to match",
               "title": "Key",
               "type": "string"
            },
            "operator": {
               "allOf": [
                  {
                     "$ref": "#/$defs/LabelSelectorOperator"
                  }
               ],
               "description": "Label match operator",
               "title": "Operator"
            },
            "values": {
               "default": [],
               "description": "For ``In`` and ``NotIn``, matches any value in this list. For ``Exists`` or ``DoesNotExist``, must be empty.",
               "items": {
                  "type": "string"
               },
               "title": "Matching values",
               "type": "array"
            }
         },
         "required": [
            "key",
            "operator"
         ],
         "title": "LabelSelectorRequirement",
         "type": "object"
      }
   },
   "additionalProperties": false,
   "required": [
      "topologyKey"
   ]
}

Fields:
field labelSelector: LabelSelector | None = None (name 'label_selector')#

Match rules for pod labels

field namespaceSelector: LabelSelector | None = None (name 'namespace_selector')#

Match rules for namespace labels

field namespaces: list[str] = []#

List of namespaces to which this term applies. The term will apply to the union of this list of namespaces and any namespaces that match namespaceSelector, if given. If both are empty, only the pod’s namespace is matched.

field topologyKey: str [Required] (name 'topology_key')#

Name of the node label that should match between nodes to consider two pods to be scheduled on adjacent nodes, which in turn is the definition of an affinity (and the opposite of an anti-affinity).

to_kubernetes()#

Convert to the corresponding Kubernetes model. :rtype: V1PodAffinityTerm