PodAffinity

pydantic model controller.models.domain.kubernetes.PodAffinity

Pod affinity rules.

Parameters:

data (Any)

Show JSON schema
{
   "title": "PodAffinity",
   "description": "Pod affinity rules.",
   "type": "object",
   "properties": {
      "preferredDuringSchedulingIgnoredDuringExecution": {
         "default": [],
         "description": "Preference rules used for scheduling and ignored afterwards",
         "items": {
            "$ref": "#/$defs/WeightedPodAffinityTerm"
         },
         "title": "Scheduling terms",
         "type": "array"
      },
      "requiredDuringSchedulingIgnoredDuringExecution": {
         "default": [],
         "description": "Required node selection rules",
         "items": {
            "$ref": "#/$defs/PodAffinityTerm"
         },
         "title": "Node selectors",
         "type": "array"
      }
   },
   "$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": {
               "$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"
      },
      "PodAffinityTerm": {
         "additionalProperties": false,
         "description": "Pod matching term for pod affinity.",
         "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"
            }
         },
         "required": [
            "topologyKey"
         ],
         "title": "PodAffinityTerm",
         "type": "object"
      },
      "WeightedPodAffinityTerm": {
         "additionalProperties": false,
         "description": "Pod matching term for pod affinity with an associated weight.",
         "properties": {
            "podAffinityTerm": {
               "$ref": "#/$defs/PodAffinityTerm",
               "description": "Pod affinity matching term",
               "title": "Matching term"
            },
            "weight": {
               "description": "Weight to associate with pods matching this term",
               "maximum": 100,
               "minimum": 1,
               "title": "Associated weight",
               "type": "integer"
            }
         },
         "required": [
            "podAffinityTerm",
            "weight"
         ],
         "title": "WeightedPodAffinityTerm",
         "type": "object"
      }
   },
   "additionalProperties": false
}

Fields:
field preferredDuringSchedulingIgnoredDuringExecution: list[WeightedPodAffinityTerm] = [] (name 'preferred')

Preference rules used for scheduling and ignored afterwards

field requiredDuringSchedulingIgnoredDuringExecution: list[PodAffinityTerm] = [] (name 'required')

Required node selection rules

to_kubernetes()

Convert to the corresponding Kubernetes model.

Return type:

V1PodAffinity