LabelSelector#

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

Rule for matching labels of pods or namespaces.

All provided expressions must match. (In other words, they are combined with and.)

Parameters:

data (Any) –

Show JSON schema
{
   "title": "LabelSelector",
   "description": "Rule for matching labels of pods or namespaces.\n\nAll provided expressions must match. (In other words, they are combined\nwith and.)",
   "type": "object",
   "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"
      }
   },
   "$defs": {
      "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
}

Fields:
field matchExpressions: list[LabelSelectorRequirement] = [] (name 'match_expressions')#

Rules for matching labels

field matchLabels: dict[str, str] = {} (name 'match_labels')#

Label keys and values that must be set

to_kubernetes()#

Convert to the corresponding Kubernetes model. :rtype: V1LabelSelector