diff --git a/.gitignore b/.gitignore index 68bc17f..8818538 100644 --- a/.gitignore +++ b/.gitignore @@ -158,3 +158,5 @@ cython_debug/ # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. #.idea/ + +/swagger.json diff --git a/fetch_swagger.py b/fetch_swagger.py new file mode 100644 index 0000000..f1b5bcf --- /dev/null +++ b/fetch_swagger.py @@ -0,0 +1,125 @@ +#!/usr/bin/env python3 +"""Fetch and mutate Kubernetes Python client swagger specs. + +This script downloads the upstream swagger.json file for a supplied git ref, +applies the custom mutations that are checked into this repository, and writes +the result to stdout. +""" + +from __future__ import annotations + +import argparse +import json +import sys +from typing import Any +from urllib.error import HTTPError, URLError +from urllib.request import Request, urlopen + + +RAW_BASE_URL = ( + "https://raw.githubusercontent.com/kubernetes-client/python/refs/heads/{ref}/scripts/swagger.json" +) + +INT_OR_STRING_DEFINITION = { + "description": "It's an int or a string.", + "oneOf": [ + {"type": "integer"}, + {"type": "string"}, + ], +} + +HTTP_GET_ACTION_PORT_PATH: tuple[str | int, ...] = ( + "definitions", + "v1.HTTPGetAction", + "properties", + "port", +) + + +def parse_args() -> argparse.Namespace: + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument( + "ref", + help="Git reference to fetch from (e.g. release-29.0).", + ) + return parser.parse_args() + + +def fetch_swagger(ref: str) -> dict[str, Any]: + url = RAW_BASE_URL.format(ref=ref) + request = Request(url, headers={"User-Agent": "k8-swagger-fetcher"}) + try: + with urlopen(request) as response: + content = response.read() + except HTTPError as exc: + raise SystemExit(f"Failed to fetch {url} (HTTP {exc.code}): {exc.reason}") from exc + except URLError as exc: + raise SystemExit(f"Failed to fetch {url}: {exc.reason}") from exc + + try: + return json.loads(content.decode("utf-8")) + except json.JSONDecodeError as exc: + raise SystemExit(f"Unable to parse swagger.json from {url}: {exc}") from exc + + +def ensure_int_or_string_definition(spec: dict[str, Any]) -> None: + definitions = spec.setdefault("definitions", {}) + + existing = definitions.get("v1.IntOrString") + if existing == INT_OR_STRING_DEFINITION: + return + + if "v1.IntOrString" in definitions: + definitions["v1.IntOrString"] = INT_OR_STRING_DEFINITION + return + + new_definitions = {"v1.IntOrString": INT_OR_STRING_DEFINITION} + new_definitions.update(definitions) + spec["definitions"] = new_definitions + + +def mutate_int_or_string_nodes(spec: dict[str, Any]) -> None: + def walk(node: Any, path: tuple[str | int, ...]) -> None: + if isinstance(node, dict): + if node.get("format") == "int-or-string": + if path == HTTP_GET_ACTION_PORT_PATH: + description = node.get("description") + node.clear() + node["$ref"] = "#/definitions/v1.IntOrString" + if description is not None: + node["description"] = description + else: + if node.get("type") != "string": + node["type"] = "string" + for key, value in list(node.items()): + walk(value, (*path, key)) + elif isinstance(node, list): + for index, item in enumerate(node): + walk(item, (*path, index)) + + walk(spec, ()) + + +def mutate_spec(spec: dict[str, Any]) -> dict[str, Any]: + ensure_int_or_string_definition(spec) + mutate_int_or_string_nodes(spec) + return spec + + +def encode_spec(spec: dict[str, Any]) -> str: + return json.dumps(spec, indent=2) + + +def main() -> None: + args = parse_args() + spec = fetch_swagger(args.ref) + mutated = mutate_spec(spec) + encoded = encode_spec(mutated) + try: + sys.stdout.write(encoded) + except BrokenPipeError: + pass + + +if __name__ == "__main__": + main() diff --git a/refresh.sh b/refresh.sh index 6c8ae38..b2d7f74 100755 --- a/refresh.sh +++ b/refresh.sh @@ -1,6 +1,19 @@ #!/bin/bash +set -euo pipefail + SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) + +if [ "$#" -ne 1 ]; then + echo "Usage: $0 " >&2 + exit 1 +fi + +REF="$1" + +echo "Fetching swagger.json for ${REF}..." +python3 "$SCRIPT_DIR/fetch_swagger.py" "$REF" > "$SCRIPT_DIR/swagger.json" + GEN_DIR=$(mktemp -d 2>/dev/null || mktemp -d -t 'k8') echo "Generating full client from OpenAPI spec..." diff --git a/src/k8/admissionregistration_v1_service_reference.py b/src/k8/admissionregistration_v1_service_reference.py index b944752..01d8d5b 100644 --- a/src/k8/admissionregistration_v1_service_reference.py +++ b/src/k8/admissionregistration_v1_service_reference.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/admissionregistration_v1_webhook_client_config.py b/src/k8/admissionregistration_v1_webhook_client_config.py index ad82082..462a143 100644 --- a/src/k8/admissionregistration_v1_webhook_client_config.py +++ b/src/k8/admissionregistration_v1_webhook_client_config.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/apiextensions_v1_service_reference.py b/src/k8/apiextensions_v1_service_reference.py index 6555777..b7d4684 100644 --- a/src/k8/apiextensions_v1_service_reference.py +++ b/src/k8/apiextensions_v1_service_reference.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/apiextensions_v1_webhook_client_config.py b/src/k8/apiextensions_v1_webhook_client_config.py index c75982e..90d9501 100644 --- a/src/k8/apiextensions_v1_webhook_client_config.py +++ b/src/k8/apiextensions_v1_webhook_client_config.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/apiregistration_v1_service_reference.py b/src/k8/apiregistration_v1_service_reference.py index 26f3a8e..9313348 100644 --- a/src/k8/apiregistration_v1_service_reference.py +++ b/src/k8/apiregistration_v1_service_reference.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/authentication_v1_token_request.py b/src/k8/authentication_v1_token_request.py index cf2fb6c..6bae0a6 100644 --- a/src/k8/authentication_v1_token_request.py +++ b/src/k8/authentication_v1_token_request.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/core_v1_endpoint_port.py b/src/k8/core_v1_endpoint_port.py index 9acf423..93f04c3 100644 --- a/src/k8/core_v1_endpoint_port.py +++ b/src/k8/core_v1_endpoint_port.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -24,7 +24,7 @@ class CoreV1EndpointPort(BaseModel): """ - EndpointPort is a tuple that describes a single port. + EndpointPort is a tuple that describes a single port. Deprecated: This API is deprecated in v1.33+. """ # noqa: E501 app_protocol: Optional[StrictStr] = Field(default=None, description="The application protocol for this port. This is used as a hint for implementations to offer richer behavior for protocols that they understand. This field follows standard Kubernetes label syntax. Valid values are either: * Un-prefixed protocol names - reserved for IANA standard service names (as per RFC-6335 and https://www.iana.org/assignments/service-names). * Kubernetes-defined prefixed names: * 'kubernetes.io/h2c' - HTTP/2 prior knowledge over cleartext as described in https://www.rfc-editor.org/rfc/rfc9113.html#name-starting-http-2-with-prior- * 'kubernetes.io/ws' - WebSocket over cleartext as described in https://www.rfc-editor.org/rfc/rfc6455 * 'kubernetes.io/wss' - WebSocket over TLS as described in https://www.rfc-editor.org/rfc/rfc6455 * Other protocols should use implementation-defined prefixed names such as mycompany.com/my-custom-protocol.", alias="appProtocol") name: Optional[StrictStr] = Field(default=None, description="The name of this port. This must match the 'name' field in the corresponding ServicePort. Must be a DNS_LABEL. Optional only if one port is defined.") diff --git a/src/k8/core_v1_event.py b/src/k8/core_v1_event.py index d8eff61..d4a952b 100644 --- a/src/k8/core_v1_event.py +++ b/src/k8/core_v1_event.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/core_v1_event_list.py b/src/k8/core_v1_event_list.py index 4cb6b92..e2d1867 100644 --- a/src/k8/core_v1_event_list.py +++ b/src/k8/core_v1_event_list.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/core_v1_event_series.py b/src/k8/core_v1_event_series.py index 2955973..5c3f3a5 100644 --- a/src/k8/core_v1_event_series.py +++ b/src/k8/core_v1_event_series.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/core_v1_resource_claim.py b/src/k8/core_v1_resource_claim.py new file mode 100644 index 0000000..e675a6d --- /dev/null +++ b/src/k8/core_v1_resource_claim.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + Kubernetes + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: release-1.34 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class CoreV1ResourceClaim(BaseModel): + """ + ResourceClaim references one entry in PodSpec.ResourceClaims. + """ # noqa: E501 + name: StrictStr = Field(description="Name must match the name of one entry in pod.spec.resourceClaims of the Pod where this field is used. It makes that resource available inside a container.") + request: Optional[StrictStr] = Field(default=None, description="Request is the name chosen for a request in the referenced claim. If empty, everything from the claim is made available, otherwise only the result of this request.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["name", "request"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CoreV1ResourceClaim from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CoreV1ResourceClaim from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "name": obj.get("name"), + "request": obj.get("request") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/src/k8/discovery_v1_endpoint_port.py b/src/k8/discovery_v1_endpoint_port.py index b75eca8..293ac55 100644 --- a/src/k8/discovery_v1_endpoint_port.py +++ b/src/k8/discovery_v1_endpoint_port.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -28,7 +28,7 @@ class DiscoveryV1EndpointPort(BaseModel): """ # noqa: E501 app_protocol: Optional[StrictStr] = Field(default=None, description="The application protocol for this port. This is used as a hint for implementations to offer richer behavior for protocols that they understand. This field follows standard Kubernetes label syntax. Valid values are either: * Un-prefixed protocol names - reserved for IANA standard service names (as per RFC-6335 and https://www.iana.org/assignments/service-names). * Kubernetes-defined prefixed names: * 'kubernetes.io/h2c' - HTTP/2 prior knowledge over cleartext as described in https://www.rfc-editor.org/rfc/rfc9113.html#name-starting-http-2-with-prior- * 'kubernetes.io/ws' - WebSocket over cleartext as described in https://www.rfc-editor.org/rfc/rfc6455 * 'kubernetes.io/wss' - WebSocket over TLS as described in https://www.rfc-editor.org/rfc/rfc6455 * Other protocols should use implementation-defined prefixed names such as mycompany.com/my-custom-protocol.", alias="appProtocol") name: Optional[StrictStr] = Field(default=None, description="name represents the name of this port. All ports in an EndpointSlice must have a unique name. If the EndpointSlice is derived from a Kubernetes service, this corresponds to the Service.ports[].name. Name must either be an empty string or pass DNS_LABEL validation: * must be no more than 63 characters long. * must consist of lower case alphanumeric characters or '-'. * must start and end with an alphanumeric character. Default is empty string.") - port: Optional[StrictInt] = Field(default=None, description="port represents the port number of the endpoint. If this is not specified, ports are not restricted and must be interpreted in the context of the specific consumer.") + port: Optional[StrictInt] = Field(default=None, description="port represents the port number of the endpoint. If the EndpointSlice is derived from a Kubernetes service, this must be set to the service's target port. EndpointSlices used for other purposes may have a nil port.") protocol: Optional[StrictStr] = Field(default=None, description="protocol represents the IP protocol for this port. Must be UDP, TCP, or SCTP. Default is TCP.") additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["appProtocol", "name", "port", "protocol"] diff --git a/src/k8/events_v1_event.py b/src/k8/events_v1_event.py index 8270c41..0a91b00 100644 --- a/src/k8/events_v1_event.py +++ b/src/k8/events_v1_event.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/events_v1_event_list.py b/src/k8/events_v1_event_list.py index f938ed9..34b932d 100644 --- a/src/k8/events_v1_event_list.py +++ b/src/k8/events_v1_event_list.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/events_v1_event_series.py b/src/k8/events_v1_event_series.py index 7389dd3..2c7751c 100644 --- a/src/k8/events_v1_event_series.py +++ b/src/k8/events_v1_event_series.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/flowcontrol_v1_subject.py b/src/k8/flowcontrol_v1_subject.py index bf3cbc9..8b25a39 100644 --- a/src/k8/flowcontrol_v1_subject.py +++ b/src/k8/flowcontrol_v1_subject.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/rbac_v1_subject.py b/src/k8/rbac_v1_subject.py index 6f3265f..10ed069 100644 --- a/src/k8/rbac_v1_subject.py +++ b/src/k8/rbac_v1_subject.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1alpha2_pod_scheduling_context.py b/src/k8/resource_v1_resource_claim.py similarity index 80% rename from src/k8/v1alpha2_pod_scheduling_context.py rename to src/k8/resource_v1_resource_claim.py index 62b82e9..5260379 100644 --- a/src/k8/v1alpha2_pod_scheduling_context.py +++ b/src/k8/resource_v1_resource_claim.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -20,20 +20,20 @@ from pydantic import BaseModel, ConfigDict, Field, StrictStr from typing import Any, ClassVar, Dict, List, Optional from .v1_object_meta import V1ObjectMeta -from .v1alpha2_pod_scheduling_context_spec import V1alpha2PodSchedulingContextSpec -from .v1alpha2_pod_scheduling_context_status import V1alpha2PodSchedulingContextStatus +from .v1_resource_claim_spec import V1ResourceClaimSpec +from .v1_resource_claim_status import V1ResourceClaimStatus from typing import Optional, Set from typing_extensions import Self -class V1alpha2PodSchedulingContext(BaseModel): +class ResourceV1ResourceClaim(BaseModel): """ - PodSchedulingContext objects hold information that is needed to schedule a Pod with ResourceClaims that use \"WaitForFirstConsumer\" allocation mode. This is an alpha type and requires enabling the DynamicResourceAllocation feature gate. + ResourceClaim describes a request for access to resources in the cluster, for use by workloads. For example, if a workload needs an accelerator device with specific properties, this is how that request is expressed. The status stanza tracks whether this claim has been satisfied and what specific resources have been allocated. This is an alpha type and requires enabling the DynamicResourceAllocation feature gate. """ # noqa: E501 api_version: Optional[StrictStr] = Field(default=None, description="APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", alias="apiVersion") kind: Optional[StrictStr] = Field(default=None, description="Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds") metadata: Optional[V1ObjectMeta] = None - spec: V1alpha2PodSchedulingContextSpec - status: Optional[V1alpha2PodSchedulingContextStatus] = None + spec: V1ResourceClaimSpec + status: Optional[V1ResourceClaimStatus] = None additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["apiVersion", "kind", "metadata", "spec", "status"] @@ -55,7 +55,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of V1alpha2PodSchedulingContext from a JSON string""" + """Create an instance of ResourceV1ResourceClaim from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -96,7 +96,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of V1alpha2PodSchedulingContext from a dict""" + """Create an instance of ResourceV1ResourceClaim from a dict""" if obj is None: return None @@ -107,8 +107,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "apiVersion": obj.get("apiVersion"), "kind": obj.get("kind"), "metadata": V1ObjectMeta.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None, - "spec": V1alpha2PodSchedulingContextSpec.from_dict(obj["spec"]) if obj.get("spec") is not None else None, - "status": V1alpha2PodSchedulingContextStatus.from_dict(obj["status"]) if obj.get("status") is not None else None + "spec": V1ResourceClaimSpec.from_dict(obj["spec"]) if obj.get("spec") is not None else None, + "status": V1ResourceClaimStatus.from_dict(obj["status"]) if obj.get("status") is not None else None }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/src/k8/storage_v1_token_request.py b/src/k8/storage_v1_token_request.py index 7a20def..68879ca 100644 --- a/src/k8/storage_v1_token_request.py +++ b/src/k8/storage_v1_token_request.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_affinity.py b/src/k8/v1_affinity.py index df633e2..aa4f56a 100644 --- a/src/k8/v1_affinity.py +++ b/src/k8/v1_affinity.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_aggregation_rule.py b/src/k8/v1_aggregation_rule.py index 9986493..ac16584 100644 --- a/src/k8/v1_aggregation_rule.py +++ b/src/k8/v1_aggregation_rule.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_allocated_device_status.py b/src/k8/v1_allocated_device_status.py new file mode 100644 index 0000000..1118b0c --- /dev/null +++ b/src/k8/v1_allocated_device_status.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Kubernetes + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: release-1.34 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from .v1_condition import V1Condition +from .v1_network_device_data import V1NetworkDeviceData +from typing import Optional, Set +from typing_extensions import Self + +class V1AllocatedDeviceStatus(BaseModel): + """ + AllocatedDeviceStatus contains the status of an allocated device, if the driver chooses to report it. This may include driver-specific information. The combination of Driver, Pool, Device, and ShareID must match the corresponding key in Status.Allocation.Devices. + """ # noqa: E501 + conditions: Optional[List[V1Condition]] = Field(default=None, description="Conditions contains the latest observation of the device's state. If the device has been configured according to the class and claim config references, the `Ready` condition should be True. Must not contain more than 8 entries.") + data: Optional[Dict[str, Any]] = Field(default=None, description="Data contains arbitrary driver-specific data. The length of the raw data must be smaller or equal to 10 Ki.") + device: StrictStr = Field(description="Device references one device instance via its name in the driver's resource pool. It must be a DNS label.") + driver: StrictStr = Field(description="Driver specifies the name of the DRA driver whose kubelet plugin should be invoked to process the allocation once the claim is needed on a node. Must be a DNS subdomain and should end with a DNS domain owned by the vendor of the driver.") + network_data: Optional[V1NetworkDeviceData] = Field(default=None, alias="networkData") + pool: StrictStr = Field(description="This name together with the driver name and the device name field identify which device was allocated (`//`). Must not be longer than 253 characters and may contain one or more DNS sub-domains separated by slashes.") + share_id: Optional[StrictStr] = Field(default=None, description="ShareID uniquely identifies an individual allocation share of the device.", alias="shareID") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["conditions", "data", "device", "driver", "networkData", "pool", "shareID"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V1AllocatedDeviceStatus from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in conditions (list) + _items = [] + if self.conditions: + for _item in self.conditions: + if _item: + _items.append(_item.to_dict()) + _dict['conditions'] = _items + # override the default output from pydantic by calling `to_dict()` of network_data + if self.network_data: + _dict['networkData'] = self.network_data.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V1AllocatedDeviceStatus from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "conditions": [V1Condition.from_dict(_item) for _item in obj["conditions"]] if obj.get("conditions") is not None else None, + "data": obj.get("data"), + "device": obj.get("device"), + "driver": obj.get("driver"), + "networkData": V1NetworkDeviceData.from_dict(obj["networkData"]) if obj.get("networkData") is not None else None, + "pool": obj.get("pool"), + "shareID": obj.get("shareID") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/src/k8/v1_allocation_result.py b/src/k8/v1_allocation_result.py new file mode 100644 index 0000000..d49135b --- /dev/null +++ b/src/k8/v1_allocation_result.py @@ -0,0 +1,113 @@ +# coding: utf-8 + +""" + Kubernetes + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: release-1.34 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from .v1_device_allocation_result import V1DeviceAllocationResult +from .v1_node_selector import V1NodeSelector +from typing import Optional, Set +from typing_extensions import Self + +class V1AllocationResult(BaseModel): + """ + AllocationResult contains attributes of an allocated resource. + """ # noqa: E501 + allocation_timestamp: Optional[datetime] = Field(default=None, description="AllocationTimestamp stores the time when the resources were allocated. This field is not guaranteed to be set, in which case that time is unknown. This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gate.", alias="allocationTimestamp") + devices: Optional[V1DeviceAllocationResult] = None + node_selector: Optional[V1NodeSelector] = Field(default=None, alias="nodeSelector") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["allocationTimestamp", "devices", "nodeSelector"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V1AllocationResult from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of devices + if self.devices: + _dict['devices'] = self.devices.to_dict() + # override the default output from pydantic by calling `to_dict()` of node_selector + if self.node_selector: + _dict['nodeSelector'] = self.node_selector.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V1AllocationResult from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "allocationTimestamp": obj.get("allocationTimestamp"), + "devices": V1DeviceAllocationResult.from_dict(obj["devices"]) if obj.get("devices") is not None else None, + "nodeSelector": V1NodeSelector.from_dict(obj["nodeSelector"]) if obj.get("nodeSelector") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/src/k8/v1_api_group.py b/src/k8/v1_api_group.py index a1cf71f..d7f03f4 100644 --- a/src/k8/v1_api_group.py +++ b/src/k8/v1_api_group.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_api_group_list.py b/src/k8/v1_api_group_list.py index e9eb4a4..f3d556a 100644 --- a/src/k8/v1_api_group_list.py +++ b/src/k8/v1_api_group_list.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_api_resource.py b/src/k8/v1_api_resource.py index 87f35b0..146d9b4 100644 --- a/src/k8/v1_api_resource.py +++ b/src/k8/v1_api_resource.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_api_resource_list.py b/src/k8/v1_api_resource_list.py index 6fb618c..cf9493a 100644 --- a/src/k8/v1_api_resource_list.py +++ b/src/k8/v1_api_resource_list.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_api_service.py b/src/k8/v1_api_service.py index a841762..5f75e95 100644 --- a/src/k8/v1_api_service.py +++ b/src/k8/v1_api_service.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_api_service_condition.py b/src/k8/v1_api_service_condition.py index 195212c..eacbc4e 100644 --- a/src/k8/v1_api_service_condition.py +++ b/src/k8/v1_api_service_condition.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_api_service_list.py b/src/k8/v1_api_service_list.py index b09890c..aa08d86 100644 --- a/src/k8/v1_api_service_list.py +++ b/src/k8/v1_api_service_list.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_api_service_spec.py b/src/k8/v1_api_service_spec.py index 499af76..9e88dd1 100644 --- a/src/k8/v1_api_service_spec.py +++ b/src/k8/v1_api_service_spec.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_api_service_status.py b/src/k8/v1_api_service_status.py index 5f2caab..3a53e1b 100644 --- a/src/k8/v1_api_service_status.py +++ b/src/k8/v1_api_service_status.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_api_versions.py b/src/k8/v1_api_versions.py index fc0b651..630a903 100644 --- a/src/k8/v1_api_versions.py +++ b/src/k8/v1_api_versions.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_app_armor_profile.py b/src/k8/v1_app_armor_profile.py new file mode 100644 index 0000000..ef456ee --- /dev/null +++ b/src/k8/v1_app_armor_profile.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + Kubernetes + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: release-1.34 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class V1AppArmorProfile(BaseModel): + """ + AppArmorProfile defines a pod or container's AppArmor settings. + """ # noqa: E501 + localhost_profile: Optional[StrictStr] = Field(default=None, description="localhostProfile indicates a profile loaded on the node that should be used. The profile must be preconfigured on the node to work. Must match the loaded name of the profile. Must be set if and only if type is \"Localhost\".", alias="localhostProfile") + type: StrictStr = Field(description="type indicates which kind of AppArmor profile will be applied. Valid options are: Localhost - a profile pre-loaded on the node. RuntimeDefault - the container runtime's default profile. Unconfined - no AppArmor enforcement.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["localhostProfile", "type"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V1AppArmorProfile from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V1AppArmorProfile from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "localhostProfile": obj.get("localhostProfile"), + "type": obj.get("type") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/src/k8/v1_attached_volume.py b/src/k8/v1_attached_volume.py index 55f0fca..451a2e7 100644 --- a/src/k8/v1_attached_volume.py +++ b/src/k8/v1_attached_volume.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1beta1_audit_annotation.py b/src/k8/v1_audit_annotation.py similarity index 94% rename from src/k8/v1beta1_audit_annotation.py rename to src/k8/v1_audit_annotation.py index 547ca33..5609905 100644 --- a/src/k8/v1beta1_audit_annotation.py +++ b/src/k8/v1_audit_annotation.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,7 +22,7 @@ from typing import Optional, Set from typing_extensions import Self -class V1beta1AuditAnnotation(BaseModel): +class V1AuditAnnotation(BaseModel): """ AuditAnnotation describes how to produce an audit annotation for an API request. """ # noqa: E501 @@ -49,7 +49,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of V1beta1AuditAnnotation from a JSON string""" + """Create an instance of V1AuditAnnotation from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -81,7 +81,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of V1beta1AuditAnnotation from a dict""" + """Create an instance of V1AuditAnnotation from a dict""" if obj is None: return None diff --git a/src/k8/v1_aws_elastic_block_store_volume_source.py b/src/k8/v1_aws_elastic_block_store_volume_source.py index 61f70fc..a699e0d 100644 --- a/src/k8/v1_aws_elastic_block_store_volume_source.py +++ b/src/k8/v1_aws_elastic_block_store_volume_source.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_azure_disk_volume_source.py b/src/k8/v1_azure_disk_volume_source.py index f91a2e8..9f8d71c 100644 --- a/src/k8/v1_azure_disk_volume_source.py +++ b/src/k8/v1_azure_disk_volume_source.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_azure_file_persistent_volume_source.py b/src/k8/v1_azure_file_persistent_volume_source.py index d22301f..551101c 100644 --- a/src/k8/v1_azure_file_persistent_volume_source.py +++ b/src/k8/v1_azure_file_persistent_volume_source.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_azure_file_volume_source.py b/src/k8/v1_azure_file_volume_source.py index 46ca723..271d0f8 100644 --- a/src/k8/v1_azure_file_volume_source.py +++ b/src/k8/v1_azure_file_volume_source.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_binding.py b/src/k8/v1_binding.py index 8ef4408..f177552 100644 --- a/src/k8/v1_binding.py +++ b/src/k8/v1_binding.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -26,7 +26,7 @@ class V1Binding(BaseModel): """ - Binding ties one object to another; for example, a pod is bound to a node by a scheduler. Deprecated in 1.7, please use the bindings subresource of pods instead. + Binding ties one object to another; for example, a pod is bound to a node by a scheduler. """ # noqa: E501 api_version: Optional[StrictStr] = Field(default=None, description="APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", alias="apiVersion") kind: Optional[StrictStr] = Field(default=None, description="Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds") diff --git a/src/k8/v1_bound_object_reference.py b/src/k8/v1_bound_object_reference.py index f7e3104..387dce4 100644 --- a/src/k8/v1_bound_object_reference.py +++ b/src/k8/v1_bound_object_reference.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_capabilities.py b/src/k8/v1_capabilities.py index 0e3186f..fa81f81 100644 --- a/src/k8/v1_capabilities.py +++ b/src/k8/v1_capabilities.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1beta3_priority_level_configuration_spec.py b/src/k8/v1_capacity_request_policy.py similarity index 59% rename from src/k8/v1beta3_priority_level_configuration_spec.py rename to src/k8/v1_capacity_request_policy.py index 35b6ecc..be81557 100644 --- a/src/k8/v1beta3_priority_level_configuration_spec.py +++ b/src/k8/v1_capacity_request_policy.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -19,20 +19,19 @@ from pydantic import BaseModel, ConfigDict, Field, StrictStr from typing import Any, ClassVar, Dict, List, Optional -from .v1beta3_exempt_priority_level_configuration import V1beta3ExemptPriorityLevelConfiguration -from .v1beta3_limited_priority_level_configuration import V1beta3LimitedPriorityLevelConfiguration +from .v1_capacity_request_policy_range import V1CapacityRequestPolicyRange from typing import Optional, Set from typing_extensions import Self -class V1beta3PriorityLevelConfigurationSpec(BaseModel): +class V1CapacityRequestPolicy(BaseModel): """ - PriorityLevelConfigurationSpec specifies the configuration of a priority level. + CapacityRequestPolicy defines how requests consume device capacity. Must not set more than one ValidRequestValues. """ # noqa: E501 - exempt: Optional[V1beta3ExemptPriorityLevelConfiguration] = None - limited: Optional[V1beta3LimitedPriorityLevelConfiguration] = None - type: StrictStr = Field(description="`type` indicates whether this priority level is subject to limitation on request execution. A value of `\"Exempt\"` means that requests of this priority level are not subject to a limit (and thus are never queued) and do not detract from the capacity made available to other priority levels. A value of `\"Limited\"` means that (a) requests of this priority level _are_ subject to limits and (b) some of the server's limited capacity is made available exclusively to this priority level. Required.") + default: Optional[StrictStr] = Field(default=None, description="Default specifies how much of this capacity is consumed by a request that does not contain an entry for it in DeviceRequest's Capacity.") + valid_range: Optional[V1CapacityRequestPolicyRange] = Field(default=None, alias="validRange") + valid_values: Optional[List[StrictStr]] = Field(default=None, description="ValidValues defines a set of acceptable quantity values in consuming requests. Must not contain more than 10 entries. Must be sorted in ascending order. If this field is set, Default must be defined and it must be included in ValidValues list. If the requested amount does not match any valid value but smaller than some valid values, the scheduler calculates the smallest valid value that is greater than or equal to the request. That is: min(ceil(requestedValue) ∈ validValues), where requestedValue ≤ max(validValues). If the requested amount exceeds all valid values, the request violates the policy, and this device cannot be allocated.", alias="validValues") additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["exempt", "limited", "type"] + __properties: ClassVar[List[str]] = ["default", "validRange", "validValues"] model_config = ConfigDict( populate_by_name=True, @@ -52,7 +51,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of V1beta3PriorityLevelConfigurationSpec from a JSON string""" + """Create an instance of V1CapacityRequestPolicy from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -75,12 +74,9 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # override the default output from pydantic by calling `to_dict()` of exempt - if self.exempt: - _dict['exempt'] = self.exempt.to_dict() - # override the default output from pydantic by calling `to_dict()` of limited - if self.limited: - _dict['limited'] = self.limited.to_dict() + # override the default output from pydantic by calling `to_dict()` of valid_range + if self.valid_range: + _dict['validRange'] = self.valid_range.to_dict() # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: for _key, _value in self.additional_properties.items(): @@ -90,7 +86,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of V1beta3PriorityLevelConfigurationSpec from a dict""" + """Create an instance of V1CapacityRequestPolicy from a dict""" if obj is None: return None @@ -98,9 +94,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "exempt": V1beta3ExemptPriorityLevelConfiguration.from_dict(obj["exempt"]) if obj.get("exempt") is not None else None, - "limited": V1beta3LimitedPriorityLevelConfiguration.from_dict(obj["limited"]) if obj.get("limited") is not None else None, - "type": obj.get("type") + "default": obj.get("default"), + "validRange": V1CapacityRequestPolicyRange.from_dict(obj["validRange"]) if obj.get("validRange") is not None else None, + "validValues": obj.get("validValues") }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/src/k8/v1_capacity_request_policy_range.py b/src/k8/v1_capacity_request_policy_range.py new file mode 100644 index 0000000..8b06d59 --- /dev/null +++ b/src/k8/v1_capacity_request_policy_range.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Kubernetes + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: release-1.34 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class V1CapacityRequestPolicyRange(BaseModel): + """ + CapacityRequestPolicyRange defines a valid range for consumable capacity values. - If the requested amount is less than Min, it is rounded up to the Min value. - If Step is set and the requested amount is between Min and Max but not aligned with Step, it will be rounded up to the next value equal to Min + (n * Step). - If Step is not set, the requested amount is used as-is if it falls within the range Min to Max (if set). - If the requested or rounded amount exceeds Max (if set), the request does not satisfy the policy, and the device cannot be allocated. + """ # noqa: E501 + max: Optional[StrictStr] = Field(default=None, description="Max defines the upper limit for capacity that can be requested. Max must be less than or equal to the capacity value. Min and requestPolicy.default must be less than or equal to the maximum.") + min: StrictStr = Field(description="Min specifies the minimum capacity allowed for a consumption request. Min must be greater than or equal to zero, and less than or equal to the capacity value. requestPolicy.default must be more than or equal to the minimum.") + step: Optional[StrictStr] = Field(default=None, description="Step defines the step size between valid capacity amounts within the range. Max (if set) and requestPolicy.default must be a multiple of Step. Min + Step must be less than or equal to the capacity value.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["max", "min", "step"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V1CapacityRequestPolicyRange from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V1CapacityRequestPolicyRange from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "max": obj.get("max"), + "min": obj.get("min"), + "step": obj.get("step") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/src/k8/v1alpha2_resource_handle.py b/src/k8/v1_capacity_requirements.py similarity index 60% rename from src/k8/v1alpha2_resource_handle.py rename to src/k8/v1_capacity_requirements.py index 0c975cf..1a0f502 100644 --- a/src/k8/v1alpha2_resource_handle.py +++ b/src/k8/v1_capacity_requirements.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,14 +22,13 @@ from typing import Optional, Set from typing_extensions import Self -class V1alpha2ResourceHandle(BaseModel): +class V1CapacityRequirements(BaseModel): """ - ResourceHandle holds opaque resource data for processing by a specific kubelet plugin. + CapacityRequirements defines the capacity requirements for a specific device request. """ # noqa: E501 - data: Optional[StrictStr] = Field(default=None, description="Data contains the opaque data associated with this ResourceHandle. It is set by the controller component of the resource driver whose name matches the DriverName set in the ResourceClaimStatus this ResourceHandle is embedded in. It is set at allocation time and is intended for processing by the kubelet plugin whose name matches the DriverName set in this ResourceHandle. The maximum size of this field is 16KiB. This may get increased in the future, but not reduced.") - driver_name: Optional[StrictStr] = Field(default=None, description="DriverName specifies the name of the resource driver whose kubelet plugin should be invoked to process this ResourceHandle's data once it lands on a node. This may differ from the DriverName set in ResourceClaimStatus this ResourceHandle is embedded in.", alias="driverName") + requests: Optional[Dict[str, StrictStr]] = Field(default=None, description="Requests represent individual device resource requests for distinct resources, all of which must be provided by the device. This value is used as an additional filtering condition against the available capacity on the device. This is semantically equivalent to a CEL selector with `device.capacity[]..compareTo(quantity()) >= 0`. For example, device.capacity['test-driver.cdi.k8s.io'].counters.compareTo(quantity('2')) >= 0. When a requestPolicy is defined, the requested amount is adjusted upward to the nearest valid value based on the policy. If the requested amount cannot be adjusted to a valid value—because it exceeds what the requestPolicy allows— the device is considered ineligible for allocation. For any capacity that is not explicitly requested: - If no requestPolicy is set, the default consumed capacity is equal to the full device capacity (i.e., the whole device is claimed). - If a requestPolicy is set, the default consumed capacity is determined according to that policy. If the device allows multiple allocation, the aggregated amount across all requests must not exceed the capacity value. The consumed capacity, which may be adjusted based on the requestPolicy if defined, is recorded in the resource claim’s status.devices[*].consumedCapacity field.") additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["data", "driverName"] + __properties: ClassVar[List[str]] = ["requests"] model_config = ConfigDict( populate_by_name=True, @@ -49,7 +48,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of V1alpha2ResourceHandle from a JSON string""" + """Create an instance of V1CapacityRequirements from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -81,7 +80,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of V1alpha2ResourceHandle from a dict""" + """Create an instance of V1CapacityRequirements from a dict""" if obj is None: return None @@ -89,8 +88,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "data": obj.get("data"), - "driverName": obj.get("driverName") + "requests": obj.get("requests") }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/src/k8/v1_cel_device_selector.py b/src/k8/v1_cel_device_selector.py new file mode 100644 index 0000000..3cea1b6 --- /dev/null +++ b/src/k8/v1_cel_device_selector.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Kubernetes + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: release-1.34 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class V1CELDeviceSelector(BaseModel): + """ + CELDeviceSelector contains a CEL expression for selecting a device. + """ # noqa: E501 + expression: StrictStr = Field(description="Expression is a CEL expression which evaluates a single device. It must evaluate to true when the device under consideration satisfies the desired criteria, and false when it does not. Any other result is an error and causes allocation of devices to abort. The expression's input is an object named \"device\", which carries the following properties: - driver (string): the name of the driver which defines this device. - attributes (map[string]object): the device's attributes, grouped by prefix (e.g. device.attributes[\"dra.example.com\"] evaluates to an object with all of the attributes which were prefixed by \"dra.example.com\". - capacity (map[string]object): the device's capacities, grouped by prefix. - allowMultipleAllocations (bool): the allowMultipleAllocations property of the device (v1.34+ with the DRAConsumableCapacity feature enabled). Example: Consider a device with driver=\"dra.example.com\", which exposes two attributes named \"model\" and \"ext.example.com/family\" and which exposes one capacity named \"modules\". This input to this expression would have the following fields: device.driver device.attributes[\"dra.example.com\"].model device.attributes[\"ext.example.com\"].family device.capacity[\"dra.example.com\"].modules The device.driver field can be used to check for a specific driver, either as a high-level precondition (i.e. you only want to consider devices from this driver) or as part of a multi-clause expression that is meant to consider devices from different drivers. The value type of each attribute is defined by the device definition, and users who write these expressions must consult the documentation for their specific drivers. The value type of each capacity is Quantity. If an unknown prefix is used as a lookup in either device.attributes or device.capacity, an empty map will be returned. Any reference to an unknown field will cause an evaluation error and allocation to abort. A robust expression should check for the existence of attributes before referencing them. For ease of use, the cel.bind() function is enabled, and can be used to simplify expressions that access multiple attributes with the same domain. For example: cel.bind(dra, device.attributes[\"dra.example.com\"], dra.someBool && dra.anotherBool) The length of the expression must be smaller or equal to 10 Ki. The cost of evaluating it is also limited based on the estimated number of logical steps.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["expression"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V1CELDeviceSelector from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V1CELDeviceSelector from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "expression": obj.get("expression") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/src/k8/v1_ceph_fs_persistent_volume_source.py b/src/k8/v1_ceph_fs_persistent_volume_source.py index 6cc4a4d..eef3301 100644 --- a/src/k8/v1_ceph_fs_persistent_volume_source.py +++ b/src/k8/v1_ceph_fs_persistent_volume_source.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_ceph_fs_volume_source.py b/src/k8/v1_ceph_fs_volume_source.py index 81f46f3..96cec27 100644 --- a/src/k8/v1_ceph_fs_volume_source.py +++ b/src/k8/v1_ceph_fs_volume_source.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_certificate_signing_request.py b/src/k8/v1_certificate_signing_request.py index 9e23afd..a1bf864 100644 --- a/src/k8/v1_certificate_signing_request.py +++ b/src/k8/v1_certificate_signing_request.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_certificate_signing_request_condition.py b/src/k8/v1_certificate_signing_request_condition.py index 4a14ddb..ca3ce1c 100644 --- a/src/k8/v1_certificate_signing_request_condition.py +++ b/src/k8/v1_certificate_signing_request_condition.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_certificate_signing_request_list.py b/src/k8/v1_certificate_signing_request_list.py index ed002ee..0065f8b 100644 --- a/src/k8/v1_certificate_signing_request_list.py +++ b/src/k8/v1_certificate_signing_request_list.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_certificate_signing_request_spec.py b/src/k8/v1_certificate_signing_request_spec.py index 0ee4513..c195e91 100644 --- a/src/k8/v1_certificate_signing_request_spec.py +++ b/src/k8/v1_certificate_signing_request_spec.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_certificate_signing_request_status.py b/src/k8/v1_certificate_signing_request_status.py index 5d8455b..b1bcaf6 100644 --- a/src/k8/v1_certificate_signing_request_status.py +++ b/src/k8/v1_certificate_signing_request_status.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_cinder_persistent_volume_source.py b/src/k8/v1_cinder_persistent_volume_source.py index c4101d1..9578cd7 100644 --- a/src/k8/v1_cinder_persistent_volume_source.py +++ b/src/k8/v1_cinder_persistent_volume_source.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_cinder_volume_source.py b/src/k8/v1_cinder_volume_source.py index 364bafa..751ee4f 100644 --- a/src/k8/v1_cinder_volume_source.py +++ b/src/k8/v1_cinder_volume_source.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_client_ip_config.py b/src/k8/v1_client_ip_config.py index 4102292..8672b01 100644 --- a/src/k8/v1_client_ip_config.py +++ b/src/k8/v1_client_ip_config.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_cluster_role.py b/src/k8/v1_cluster_role.py index f11b1b0..c9733a0 100644 --- a/src/k8/v1_cluster_role.py +++ b/src/k8/v1_cluster_role.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_cluster_role_binding.py b/src/k8/v1_cluster_role_binding.py index b2d3e6a..2f9308d 100644 --- a/src/k8/v1_cluster_role_binding.py +++ b/src/k8/v1_cluster_role_binding.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_cluster_role_binding_list.py b/src/k8/v1_cluster_role_binding_list.py index 97c771c..af338d7 100644 --- a/src/k8/v1_cluster_role_binding_list.py +++ b/src/k8/v1_cluster_role_binding_list.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_cluster_role_list.py b/src/k8/v1_cluster_role_list.py index 342dda9..318d344 100644 --- a/src/k8/v1_cluster_role_list.py +++ b/src/k8/v1_cluster_role_list.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_cluster_trust_bundle_projection.py b/src/k8/v1_cluster_trust_bundle_projection.py index aa67796..5a8ed9e 100644 --- a/src/k8/v1_cluster_trust_bundle_projection.py +++ b/src/k8/v1_cluster_trust_bundle_projection.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_component_condition.py b/src/k8/v1_component_condition.py index b1505fb..676494d 100644 --- a/src/k8/v1_component_condition.py +++ b/src/k8/v1_component_condition.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_component_status.py b/src/k8/v1_component_status.py index 3279e5b..5f13f35 100644 --- a/src/k8/v1_component_status.py +++ b/src/k8/v1_component_status.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_component_status_list.py b/src/k8/v1_component_status_list.py index bd5fefe..90cc5f2 100644 --- a/src/k8/v1_component_status_list.py +++ b/src/k8/v1_component_status_list.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_condition.py b/src/k8/v1_condition.py index 16af4a8..42a9955 100644 --- a/src/k8/v1_condition.py +++ b/src/k8/v1_condition.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_config_map.py b/src/k8/v1_config_map.py index 8470b6f..c25c623 100644 --- a/src/k8/v1_config_map.py +++ b/src/k8/v1_config_map.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_config_map_env_source.py b/src/k8/v1_config_map_env_source.py index 6873ec2..40017e2 100644 --- a/src/k8/v1_config_map_env_source.py +++ b/src/k8/v1_config_map_env_source.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -26,7 +26,7 @@ class V1ConfigMapEnvSource(BaseModel): """ ConfigMapEnvSource selects a ConfigMap to populate the environment variables with. The contents of the target ConfigMap's Data field will represent the key-value pairs as environment variables. """ # noqa: E501 - name: Optional[StrictStr] = Field(default=None, description="Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names") + name: Optional[StrictStr] = Field(default=None, description="Name of the referent. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names") optional: Optional[StrictBool] = Field(default=None, description="Specify whether the ConfigMap must be defined") additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["name", "optional"] diff --git a/src/k8/v1_config_map_key_selector.py b/src/k8/v1_config_map_key_selector.py index 05d03b5..44db7f4 100644 --- a/src/k8/v1_config_map_key_selector.py +++ b/src/k8/v1_config_map_key_selector.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -27,7 +27,7 @@ class V1ConfigMapKeySelector(BaseModel): Selects a key from a ConfigMap. """ # noqa: E501 key: StrictStr = Field(description="The key to select.") - name: Optional[StrictStr] = Field(default=None, description="Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names") + name: Optional[StrictStr] = Field(default=None, description="Name of the referent. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names") optional: Optional[StrictBool] = Field(default=None, description="Specify whether the ConfigMap or its key must be defined") additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["key", "name", "optional"] diff --git a/src/k8/v1_config_map_list.py b/src/k8/v1_config_map_list.py index 2d80f9f..1718c3a 100644 --- a/src/k8/v1_config_map_list.py +++ b/src/k8/v1_config_map_list.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_config_map_node_config_source.py b/src/k8/v1_config_map_node_config_source.py index c081324..de57a5a 100644 --- a/src/k8/v1_config_map_node_config_source.py +++ b/src/k8/v1_config_map_node_config_source.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_config_map_projection.py b/src/k8/v1_config_map_projection.py index e43a07f..2cfa67a 100644 --- a/src/k8/v1_config_map_projection.py +++ b/src/k8/v1_config_map_projection.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -28,7 +28,7 @@ class V1ConfigMapProjection(BaseModel): Adapts a ConfigMap into a projected volume. The contents of the target ConfigMap's Data field will be presented in a projected volume as files using the keys in the Data field as the file names, unless the items element is populated with specific mappings of keys to paths. Note that this is identical to a configmap volume source without the default mode. """ # noqa: E501 items: Optional[List[V1KeyToPath]] = Field(default=None, description="items if unspecified, each key-value pair in the Data field of the referenced ConfigMap will be projected into the volume as a file whose name is the key and content is the value. If specified, the listed keys will be projected into the specified paths, and unlisted keys will not be present. If a key is specified which is not present in the ConfigMap, the volume setup will error unless it is marked optional. Paths must be relative and may not contain the '..' path or start with '..'.") - name: Optional[StrictStr] = Field(default=None, description="Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names") + name: Optional[StrictStr] = Field(default=None, description="Name of the referent. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names") optional: Optional[StrictBool] = Field(default=None, description="optional specify whether the ConfigMap or its keys must be defined") additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["items", "name", "optional"] diff --git a/src/k8/v1_config_map_volume_source.py b/src/k8/v1_config_map_volume_source.py index 091747f..95057d5 100644 --- a/src/k8/v1_config_map_volume_source.py +++ b/src/k8/v1_config_map_volume_source.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -29,7 +29,7 @@ class V1ConfigMapVolumeSource(BaseModel): """ # noqa: E501 default_mode: Optional[StrictInt] = Field(default=None, description="defaultMode is optional: mode bits used to set permissions on created files by default. Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. Defaults to 0644. Directories within the path are not affected by this setting. This might be in conflict with other options that affect the file mode, like fsGroup, and the result can be other mode bits set.", alias="defaultMode") items: Optional[List[V1KeyToPath]] = Field(default=None, description="items if unspecified, each key-value pair in the Data field of the referenced ConfigMap will be projected into the volume as a file whose name is the key and content is the value. If specified, the listed keys will be projected into the specified paths, and unlisted keys will not be present. If a key is specified which is not present in the ConfigMap, the volume setup will error unless it is marked optional. Paths must be relative and may not contain the '..' path or start with '..'.") - name: Optional[StrictStr] = Field(default=None, description="Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names") + name: Optional[StrictStr] = Field(default=None, description="Name of the referent. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names") optional: Optional[StrictBool] = Field(default=None, description="optional specify whether the ConfigMap or its keys must be defined") additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["defaultMode", "items", "name", "optional"] diff --git a/src/k8/v1_container.py b/src/k8/v1_container.py index 879db42..d738854 100644 --- a/src/k8/v1_container.py +++ b/src/k8/v1_container.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Optional from .v1_container_port import V1ContainerPort from .v1_container_resize_policy import V1ContainerResizePolicy +from .v1_container_restart_rule import V1ContainerRestartRule from .v1_env_from_source import V1EnvFromSource from .v1_env_var import V1EnvVar from .v1_lifecycle import V1Lifecycle @@ -39,7 +40,7 @@ class V1Container(BaseModel): args: Optional[List[StrictStr]] = Field(default=None, description="Arguments to the entrypoint. The container image's CMD is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. \"$$(VAR_NAME)\" will produce the string literal \"$(VAR_NAME)\". Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell") command: Optional[List[StrictStr]] = Field(default=None, description="Entrypoint array. Not executed within a shell. The container image's ENTRYPOINT is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. \"$$(VAR_NAME)\" will produce the string literal \"$(VAR_NAME)\". Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell") env: Optional[List[V1EnvVar]] = Field(default=None, description="List of environment variables to set in the container. Cannot be updated.") - env_from: Optional[List[V1EnvFromSource]] = Field(default=None, description="List of sources to populate environment variables in the container. The keys defined within a source must be a C_IDENTIFIER. All invalid keys will be reported as an event when the container is starting. When a key exists in multiple sources, the value associated with the last source will take precedence. Values defined by an Env with a duplicate key will take precedence. Cannot be updated.", alias="envFrom") + env_from: Optional[List[V1EnvFromSource]] = Field(default=None, description="List of sources to populate environment variables in the container. The keys defined within a source may consist of any printable ASCII characters except '='. When a key exists in multiple sources, the value associated with the last source will take precedence. Values defined by an Env with a duplicate key will take precedence. Cannot be updated.", alias="envFrom") image: Optional[StrictStr] = Field(default=None, description="Container image name. More info: https://kubernetes.io/docs/concepts/containers/images This field is optional to allow higher level config management to default or override container images in workload controllers like Deployments and StatefulSets.") image_pull_policy: Optional[StrictStr] = Field(default=None, description="Image pull policy. One of Always, Never, IfNotPresent. Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. Cannot be updated. More info: https://kubernetes.io/docs/concepts/containers/images#updating-images", alias="imagePullPolicy") lifecycle: Optional[V1Lifecycle] = None @@ -49,7 +50,8 @@ class V1Container(BaseModel): readiness_probe: Optional[V1Probe] = Field(default=None, alias="readinessProbe") resize_policy: Optional[List[V1ContainerResizePolicy]] = Field(default=None, description="Resources resize policy for the container.", alias="resizePolicy") resources: Optional[V1ResourceRequirements] = None - restart_policy: Optional[StrictStr] = Field(default=None, description="RestartPolicy defines the restart behavior of individual containers in a pod. This field may only be set for init containers, and the only allowed value is \"Always\". For non-init containers or when this field is not specified, the restart behavior is defined by the Pod's restart policy and the container type. Setting the RestartPolicy as \"Always\" for the init container will have the following effect: this init container will be continually restarted on exit until all regular containers have terminated. Once all regular containers have completed, all init containers with restartPolicy \"Always\" will be shut down. This lifecycle differs from normal init containers and is often referred to as a \"sidecar\" container. Although this init container still starts in the init container sequence, it does not wait for the container to complete before proceeding to the next init container. Instead, the next init container starts immediately after this init container is started, or after any startupProbe has successfully completed.", alias="restartPolicy") + restart_policy: Optional[StrictStr] = Field(default=None, description="RestartPolicy defines the restart behavior of individual containers in a pod. This overrides the pod-level restart policy. When this field is not specified, the restart behavior is defined by the Pod's restart policy and the container type. Additionally, setting the RestartPolicy as \"Always\" for the init container will have the following effect: this init container will be continually restarted on exit until all regular containers have terminated. Once all regular containers have completed, all init containers with restartPolicy \"Always\" will be shut down. This lifecycle differs from normal init containers and is often referred to as a \"sidecar\" container. Although this init container still starts in the init container sequence, it does not wait for the container to complete before proceeding to the next init container. Instead, the next init container starts immediately after this init container is started, or after any startupProbe has successfully completed.", alias="restartPolicy") + restart_policy_rules: Optional[List[V1ContainerRestartRule]] = Field(default=None, description="Represents a list of rules to be checked to determine if the container should be restarted on exit. The rules are evaluated in order. Once a rule matches a container exit condition, the remaining rules are ignored. If no rule matches the container exit condition, the Container-level restart policy determines the whether the container is restarted or not. Constraints on the rules: - At most 20 rules are allowed. - Rules can have the same action. - Identical rules are not forbidden in validations. When rules are specified, container MUST set RestartPolicy explicitly even it if matches the Pod's RestartPolicy.", alias="restartPolicyRules") security_context: Optional[V1SecurityContext] = Field(default=None, alias="securityContext") startup_probe: Optional[V1Probe] = Field(default=None, alias="startupProbe") stdin: Optional[StrictBool] = Field(default=None, description="Whether this container should allocate a buffer for stdin in the container runtime. If this is not set, reads from stdin in the container will always result in EOF. Default is false.") @@ -61,7 +63,7 @@ class V1Container(BaseModel): volume_mounts: Optional[List[V1VolumeMount]] = Field(default=None, description="Pod volumes to mount into the container's filesystem. Cannot be updated.", alias="volumeMounts") working_dir: Optional[StrictStr] = Field(default=None, description="Container's working directory. If not specified, the container runtime's default will be used, which might be configured in the container image. Cannot be updated.", alias="workingDir") additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["args", "command", "env", "envFrom", "image", "imagePullPolicy", "lifecycle", "livenessProbe", "name", "ports", "readinessProbe", "resizePolicy", "resources", "restartPolicy", "securityContext", "startupProbe", "stdin", "stdinOnce", "terminationMessagePath", "terminationMessagePolicy", "tty", "volumeDevices", "volumeMounts", "workingDir"] + __properties: ClassVar[List[str]] = ["args", "command", "env", "envFrom", "image", "imagePullPolicy", "lifecycle", "livenessProbe", "name", "ports", "readinessProbe", "resizePolicy", "resources", "restartPolicy", "restartPolicyRules", "securityContext", "startupProbe", "stdin", "stdinOnce", "terminationMessagePath", "terminationMessagePolicy", "tty", "volumeDevices", "volumeMounts", "workingDir"] model_config = ConfigDict( populate_by_name=True, @@ -144,6 +146,13 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of resources if self.resources: _dict['resources'] = self.resources.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in restart_policy_rules (list) + _items = [] + if self.restart_policy_rules: + for _item in self.restart_policy_rules: + if _item: + _items.append(_item.to_dict()) + _dict['restartPolicyRules'] = _items # override the default output from pydantic by calling `to_dict()` of security_context if self.security_context: _dict['securityContext'] = self.security_context.to_dict() @@ -195,6 +204,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "resizePolicy": [V1ContainerResizePolicy.from_dict(_item) for _item in obj["resizePolicy"]] if obj.get("resizePolicy") is not None else None, "resources": V1ResourceRequirements.from_dict(obj["resources"]) if obj.get("resources") is not None else None, "restartPolicy": obj.get("restartPolicy"), + "restartPolicyRules": [V1ContainerRestartRule.from_dict(_item) for _item in obj["restartPolicyRules"]] if obj.get("restartPolicyRules") is not None else None, "securityContext": V1SecurityContext.from_dict(obj["securityContext"]) if obj.get("securityContext") is not None else None, "startupProbe": V1Probe.from_dict(obj["startupProbe"]) if obj.get("startupProbe") is not None else None, "stdin": obj.get("stdin"), diff --git a/src/k8/v1alpha1_expression_warning.py b/src/k8/v1_container_extended_resource_request.py similarity index 71% rename from src/k8/v1alpha1_expression_warning.py rename to src/k8/v1_container_extended_resource_request.py index d895ace..db9d1a5 100644 --- a/src/k8/v1alpha1_expression_warning.py +++ b/src/k8/v1_container_extended_resource_request.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,14 +22,15 @@ from typing import Optional, Set from typing_extensions import Self -class V1alpha1ExpressionWarning(BaseModel): +class V1ContainerExtendedResourceRequest(BaseModel): """ - ExpressionWarning is a warning information that targets a specific expression. + ContainerExtendedResourceRequest has the mapping of container name, extended resource name to the device request name. """ # noqa: E501 - field_ref: StrictStr = Field(description="The path to the field that refers the expression. For example, the reference to the expression of the first item of validations is \"spec.validations[0].expression\"", alias="fieldRef") - warning: StrictStr = Field(description="The content of type checking information in a human-readable form. Each line of the warning contains the type that the expression is checked against, followed by the type check error from the compiler.") + container_name: StrictStr = Field(description="The name of the container requesting resources.", alias="containerName") + request_name: StrictStr = Field(description="The name of the request in the special ResourceClaim which corresponds to the extended resource.", alias="requestName") + resource_name: StrictStr = Field(description="The name of the extended resource in that container which gets backed by DRA.", alias="resourceName") additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["fieldRef", "warning"] + __properties: ClassVar[List[str]] = ["containerName", "requestName", "resourceName"] model_config = ConfigDict( populate_by_name=True, @@ -49,7 +50,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of V1alpha1ExpressionWarning from a JSON string""" + """Create an instance of V1ContainerExtendedResourceRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -81,7 +82,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of V1alpha1ExpressionWarning from a dict""" + """Create an instance of V1ContainerExtendedResourceRequest from a dict""" if obj is None: return None @@ -89,8 +90,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "fieldRef": obj.get("fieldRef"), - "warning": obj.get("warning") + "containerName": obj.get("containerName"), + "requestName": obj.get("requestName"), + "resourceName": obj.get("resourceName") }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/src/k8/v1_container_image.py b/src/k8/v1_container_image.py index 09fab60..9c284a4 100644 --- a/src/k8/v1_container_image.py +++ b/src/k8/v1_container_image.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_container_port.py b/src/k8/v1_container_port.py index 6d21238..12d4cab 100644 --- a/src/k8/v1_container_port.py +++ b/src/k8/v1_container_port.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_container_resize_policy.py b/src/k8/v1_container_resize_policy.py index 47a8ddd..a00be83 100644 --- a/src/k8/v1_container_resize_policy.py +++ b/src/k8/v1_container_resize_policy.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1beta3_limit_response.py b/src/k8/v1_container_restart_rule.py similarity index 72% rename from src/k8/v1beta3_limit_response.py rename to src/k8/v1_container_restart_rule.py index d0f32fb..ccee67d 100644 --- a/src/k8/v1beta3_limit_response.py +++ b/src/k8/v1_container_restart_rule.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -19,18 +19,18 @@ from pydantic import BaseModel, ConfigDict, Field, StrictStr from typing import Any, ClassVar, Dict, List, Optional -from .v1beta3_queuing_configuration import V1beta3QueuingConfiguration +from .v1_container_restart_rule_on_exit_codes import V1ContainerRestartRuleOnExitCodes from typing import Optional, Set from typing_extensions import Self -class V1beta3LimitResponse(BaseModel): +class V1ContainerRestartRule(BaseModel): """ - LimitResponse defines how to handle requests that can not be executed right now. + ContainerRestartRule describes how a container exit is handled. """ # noqa: E501 - queuing: Optional[V1beta3QueuingConfiguration] = None - type: StrictStr = Field(description="`type` is \"Queue\" or \"Reject\". \"Queue\" means that requests that can not be executed upon arrival are held in a queue until they can be executed or a queuing limit is reached. \"Reject\" means that requests that can not be executed upon arrival are rejected. Required.") + action: StrictStr = Field(description="Specifies the action taken on a container exit if the requirements are satisfied. The only possible value is \"Restart\" to restart the container.") + exit_codes: Optional[V1ContainerRestartRuleOnExitCodes] = Field(default=None, alias="exitCodes") additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["queuing", "type"] + __properties: ClassVar[List[str]] = ["action", "exitCodes"] model_config = ConfigDict( populate_by_name=True, @@ -50,7 +50,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of V1beta3LimitResponse from a JSON string""" + """Create an instance of V1ContainerRestartRule from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -73,9 +73,9 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # override the default output from pydantic by calling `to_dict()` of queuing - if self.queuing: - _dict['queuing'] = self.queuing.to_dict() + # override the default output from pydantic by calling `to_dict()` of exit_codes + if self.exit_codes: + _dict['exitCodes'] = self.exit_codes.to_dict() # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: for _key, _value in self.additional_properties.items(): @@ -85,7 +85,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of V1beta3LimitResponse from a dict""" + """Create an instance of V1ContainerRestartRule from a dict""" if obj is None: return None @@ -93,8 +93,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "queuing": V1beta3QueuingConfiguration.from_dict(obj["queuing"]) if obj.get("queuing") is not None else None, - "type": obj.get("type") + "action": obj.get("action"), + "exitCodes": V1ContainerRestartRuleOnExitCodes.from_dict(obj["exitCodes"]) if obj.get("exitCodes") is not None else None }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/src/k8/v1_container_restart_rule_on_exit_codes.py b/src/k8/v1_container_restart_rule_on_exit_codes.py new file mode 100644 index 0000000..76a5668 --- /dev/null +++ b/src/k8/v1_container_restart_rule_on_exit_codes.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + Kubernetes + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: release-1.34 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class V1ContainerRestartRuleOnExitCodes(BaseModel): + """ + ContainerRestartRuleOnExitCodes describes the condition for handling an exited container based on its exit codes. + """ # noqa: E501 + operator: StrictStr = Field(description="Represents the relationship between the container exit code(s) and the specified values. Possible values are: - In: the requirement is satisfied if the container exit code is in the set of specified values. - NotIn: the requirement is satisfied if the container exit code is not in the set of specified values.") + values: Optional[List[StrictInt]] = Field(default=None, description="Specifies the set of values to check for container exit codes. At most 255 elements are allowed.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["operator", "values"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V1ContainerRestartRuleOnExitCodes from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V1ContainerRestartRuleOnExitCodes from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "operator": obj.get("operator"), + "values": obj.get("values") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/src/k8/v1_container_state.py b/src/k8/v1_container_state.py index 3f26875..1bc3fb2 100644 --- a/src/k8/v1_container_state.py +++ b/src/k8/v1_container_state.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_container_state_running.py b/src/k8/v1_container_state_running.py index 0824137..1299f8f 100644 --- a/src/k8/v1_container_state_running.py +++ b/src/k8/v1_container_state_running.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_container_state_terminated.py b/src/k8/v1_container_state_terminated.py index 5539544..14535e2 100644 --- a/src/k8/v1_container_state_terminated.py +++ b/src/k8/v1_container_state_terminated.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_container_state_waiting.py b/src/k8/v1_container_state_waiting.py index f8396b5..b8daaf7 100644 --- a/src/k8/v1_container_state_waiting.py +++ b/src/k8/v1_container_state_waiting.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_container_status.py b/src/k8/v1_container_status.py index 0fa5349..89a4632 100644 --- a/src/k8/v1_container_status.py +++ b/src/k8/v1_container_status.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -20,7 +20,10 @@ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr from typing import Any, ClassVar, Dict, List, Optional from .v1_container_state import V1ContainerState +from .v1_container_user import V1ContainerUser from .v1_resource_requirements import V1ResourceRequirements +from .v1_resource_status import V1ResourceStatus +from .v1_volume_mount_status import V1VolumeMountStatus from typing import Optional, Set from typing_extensions import Self @@ -29,6 +32,7 @@ class V1ContainerStatus(BaseModel): ContainerStatus contains details for the current status of this container. """ # noqa: E501 allocated_resources: Optional[Dict[str, StrictStr]] = Field(default=None, description="AllocatedResources represents the compute resources allocated for this container by the node. Kubelet sets this value to Container.Resources.Requests upon successful pod admission and after successfully admitting desired pod resize.", alias="allocatedResources") + allocated_resources_status: Optional[List[V1ResourceStatus]] = Field(default=None, description="AllocatedResourcesStatus represents the status of various resources allocated for this Pod.", alias="allocatedResourcesStatus") container_id: Optional[StrictStr] = Field(default=None, description="ContainerID is the ID of the container in the format '://'. Where type is a container runtime identifier, returned from Version call of CRI API (for example \"containerd\").", alias="containerID") image: StrictStr = Field(description="Image is the name of container image that the container is running. The container image may not match the image used in the PodSpec, as it may have been resolved by the runtime. More info: https://kubernetes.io/docs/concepts/containers/images.") image_id: StrictStr = Field(description="ImageID is the image ID of the container's image. The image ID may not match the image ID of the image used in the PodSpec, as it may have been resolved by the runtime.", alias="imageID") @@ -39,8 +43,11 @@ class V1ContainerStatus(BaseModel): restart_count: StrictInt = Field(description="RestartCount holds the number of times the container has been restarted. Kubelet makes an effort to always increment the value, but there are cases when the state may be lost due to node restarts and then the value may be reset to 0. The value is never negative.", alias="restartCount") started: Optional[StrictBool] = Field(default=None, description="Started indicates whether the container has finished its postStart lifecycle hook and passed its startup probe. Initialized as false, becomes true after startupProbe is considered successful. Resets to false when the container is restarted, or if kubelet loses state temporarily. In both cases, startup probes will run again. Is always true when no startupProbe is defined and container is running and has passed the postStart lifecycle hook. The null value must be treated the same as false.") state: Optional[V1ContainerState] = None + stop_signal: Optional[StrictStr] = Field(default=None, description="StopSignal reports the effective stop signal for this container", alias="stopSignal") + user: Optional[V1ContainerUser] = None + volume_mounts: Optional[List[V1VolumeMountStatus]] = Field(default=None, description="Status of volume mounts.", alias="volumeMounts") additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["allocatedResources", "containerID", "image", "imageID", "lastState", "name", "ready", "resources", "restartCount", "started", "state"] + __properties: ClassVar[List[str]] = ["allocatedResources", "allocatedResourcesStatus", "containerID", "image", "imageID", "lastState", "name", "ready", "resources", "restartCount", "started", "state", "stopSignal", "user", "volumeMounts"] model_config = ConfigDict( populate_by_name=True, @@ -83,6 +90,13 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # override the default output from pydantic by calling `to_dict()` of each item in allocated_resources_status (list) + _items = [] + if self.allocated_resources_status: + for _item in self.allocated_resources_status: + if _item: + _items.append(_item.to_dict()) + _dict['allocatedResourcesStatus'] = _items # override the default output from pydantic by calling `to_dict()` of last_state if self.last_state: _dict['lastState'] = self.last_state.to_dict() @@ -92,6 +106,16 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of state if self.state: _dict['state'] = self.state.to_dict() + # override the default output from pydantic by calling `to_dict()` of user + if self.user: + _dict['user'] = self.user.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in volume_mounts (list) + _items = [] + if self.volume_mounts: + for _item in self.volume_mounts: + if _item: + _items.append(_item.to_dict()) + _dict['volumeMounts'] = _items # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: for _key, _value in self.additional_properties.items(): @@ -110,6 +134,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "allocatedResources": obj.get("allocatedResources"), + "allocatedResourcesStatus": [V1ResourceStatus.from_dict(_item) for _item in obj["allocatedResourcesStatus"]] if obj.get("allocatedResourcesStatus") is not None else None, "containerID": obj.get("containerID"), "image": obj.get("image"), "imageID": obj.get("imageID"), @@ -119,7 +144,10 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "resources": V1ResourceRequirements.from_dict(obj["resources"]) if obj.get("resources") is not None else None, "restartCount": obj.get("restartCount"), "started": obj.get("started"), - "state": V1ContainerState.from_dict(obj["state"]) if obj.get("state") is not None else None + "state": V1ContainerState.from_dict(obj["state"]) if obj.get("state") is not None else None, + "stopSignal": obj.get("stopSignal"), + "user": V1ContainerUser.from_dict(obj["user"]) if obj.get("user") is not None else None, + "volumeMounts": [V1VolumeMountStatus.from_dict(_item) for _item in obj["volumeMounts"]] if obj.get("volumeMounts") is not None else None }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/src/k8/v1beta1_self_subject_review_status.py b/src/k8/v1_container_user.py similarity index 77% rename from src/k8/v1beta1_self_subject_review_status.py rename to src/k8/v1_container_user.py index 3ce9a4e..e79ea82 100644 --- a/src/k8/v1beta1_self_subject_review_status.py +++ b/src/k8/v1_container_user.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -17,19 +17,19 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, Field +from pydantic import BaseModel, ConfigDict from typing import Any, ClassVar, Dict, List, Optional -from .v1_user_info import V1UserInfo +from .v1_linux_container_user import V1LinuxContainerUser from typing import Optional, Set from typing_extensions import Self -class V1beta1SelfSubjectReviewStatus(BaseModel): +class V1ContainerUser(BaseModel): """ - SelfSubjectReviewStatus is filled by the kube-apiserver and sent back to a user. + ContainerUser represents user identity information """ # noqa: E501 - user_info: Optional[V1UserInfo] = Field(default=None, alias="userInfo") + linux: Optional[V1LinuxContainerUser] = None additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["userInfo"] + __properties: ClassVar[List[str]] = ["linux"] model_config = ConfigDict( populate_by_name=True, @@ -49,7 +49,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of V1beta1SelfSubjectReviewStatus from a JSON string""" + """Create an instance of V1ContainerUser from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -72,9 +72,9 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # override the default output from pydantic by calling `to_dict()` of user_info - if self.user_info: - _dict['userInfo'] = self.user_info.to_dict() + # override the default output from pydantic by calling `to_dict()` of linux + if self.linux: + _dict['linux'] = self.linux.to_dict() # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: for _key, _value in self.additional_properties.items(): @@ -84,7 +84,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of V1beta1SelfSubjectReviewStatus from a dict""" + """Create an instance of V1ContainerUser from a dict""" if obj is None: return None @@ -92,7 +92,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "userInfo": V1UserInfo.from_dict(obj["userInfo"]) if obj.get("userInfo") is not None else None + "linux": V1LinuxContainerUser.from_dict(obj["linux"]) if obj.get("linux") is not None else None }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/src/k8/v1_controller_revision.py b/src/k8/v1_controller_revision.py index 683e75e..fd17c9f 100644 --- a/src/k8/v1_controller_revision.py +++ b/src/k8/v1_controller_revision.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_controller_revision_list.py b/src/k8/v1_controller_revision_list.py index 5e278cf..5b9c6e6 100644 --- a/src/k8/v1_controller_revision_list.py +++ b/src/k8/v1_controller_revision_list.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_resource_claim.py b/src/k8/v1_counter.py similarity index 82% rename from src/k8/v1_resource_claim.py rename to src/k8/v1_counter.py index 959a5c0..ed0c24e 100644 --- a/src/k8/v1_resource_claim.py +++ b/src/k8/v1_counter.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,13 +22,13 @@ from typing import Optional, Set from typing_extensions import Self -class V1ResourceClaim(BaseModel): +class V1Counter(BaseModel): """ - ResourceClaim references one entry in PodSpec.ResourceClaims. + Counter describes a quantity associated with a device. """ # noqa: E501 - name: StrictStr = Field(description="Name must match the name of one entry in pod.spec.resourceClaims of the Pod where this field is used. It makes that resource available inside a container.") + value: StrictStr = Field(description="Value defines how much of a certain device counter is available.") additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["name"] + __properties: ClassVar[List[str]] = ["value"] model_config = ConfigDict( populate_by_name=True, @@ -48,7 +48,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of V1ResourceClaim from a JSON string""" + """Create an instance of V1Counter from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -80,7 +80,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of V1ResourceClaim from a dict""" + """Create an instance of V1Counter from a dict""" if obj is None: return None @@ -88,7 +88,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "name": obj.get("name") + "value": obj.get("value") }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/src/k8/v1_counter_set.py b/src/k8/v1_counter_set.py new file mode 100644 index 0000000..db1e32a --- /dev/null +++ b/src/k8/v1_counter_set.py @@ -0,0 +1,115 @@ +# coding: utf-8 + +""" + Kubernetes + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: release-1.34 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from .v1_counter import V1Counter +from typing import Optional, Set +from typing_extensions import Self + +class V1CounterSet(BaseModel): + """ + CounterSet defines a named set of counters that are available to be used by devices defined in the ResourceSlice. The counters are not allocatable by themselves, but can be referenced by devices. When a device is allocated, the portion of counters it uses will no longer be available for use by other devices. + """ # noqa: E501 + counters: Dict[str, V1Counter] = Field(description="Counters defines the set of counters for this CounterSet The name of each counter must be unique in that set and must be a DNS label. The maximum number of counters in all sets is 32.") + name: StrictStr = Field(description="Name defines the name of the counter set. It must be a DNS label.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["counters", "name"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V1CounterSet from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each value in counters (dict) + _field_dict = {} + if self.counters: + for _key in self.counters: + if self.counters[_key]: + _field_dict[_key] = self.counters[_key].to_dict() + _dict['counters'] = _field_dict + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V1CounterSet from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "counters": dict( + (_k, V1Counter.from_dict(_v)) + for _k, _v in obj["counters"].items() + ) + if obj.get("counters") is not None + else None, + "name": obj.get("name") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/src/k8/v1_cron_job.py b/src/k8/v1_cron_job.py index 61cd660..9182fb7 100644 --- a/src/k8/v1_cron_job.py +++ b/src/k8/v1_cron_job.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_cron_job_list.py b/src/k8/v1_cron_job_list.py index b617ae4..f290d37 100644 --- a/src/k8/v1_cron_job_list.py +++ b/src/k8/v1_cron_job_list.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_cron_job_spec.py b/src/k8/v1_cron_job_spec.py index 3be2cc4..7a6ed5a 100644 --- a/src/k8/v1_cron_job_spec.py +++ b/src/k8/v1_cron_job_spec.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_cron_job_status.py b/src/k8/v1_cron_job_status.py index 61afddb..8781f8a 100644 --- a/src/k8/v1_cron_job_status.py +++ b/src/k8/v1_cron_job_status.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_cross_version_object_reference.py b/src/k8/v1_cross_version_object_reference.py index 3102da8..d9210a0 100644 --- a/src/k8/v1_cross_version_object_reference.py +++ b/src/k8/v1_cross_version_object_reference.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_csi_driver.py b/src/k8/v1_csi_driver.py index 93964f5..36f9175 100644 --- a/src/k8/v1_csi_driver.py +++ b/src/k8/v1_csi_driver.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_csi_driver_list.py b/src/k8/v1_csi_driver_list.py index 287b501..2ccd03d 100644 --- a/src/k8/v1_csi_driver_list.py +++ b/src/k8/v1_csi_driver_list.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_csi_driver_spec.py b/src/k8/v1_csi_driver_spec.py index 90fda3b..fd80da7 100644 --- a/src/k8/v1_csi_driver_spec.py +++ b/src/k8/v1_csi_driver_spec.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -17,7 +17,7 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr from typing import Any, ClassVar, Dict, List, Optional from .storage_v1_token_request import StorageV1TokenRequest from typing import Optional, Set @@ -27,16 +27,17 @@ class V1CSIDriverSpec(BaseModel): """ CSIDriverSpec is the specification of a CSIDriver. """ # noqa: E501 - attach_required: Optional[StrictBool] = Field(default=None, description="attachRequired indicates this CSI volume driver requires an attach operation (because it implements the CSI ControllerPublishVolume() method), and that the Kubernetes attach detach controller should call the attach volume interface which checks the volumeattachment status and waits until the volume is attached before proceeding to mounting. The CSI external-attacher coordinates with CSI volume driver and updates the volumeattachment status when the attach operation is complete. If the CSIDriverRegistry feature gate is enabled and the value is specified to false, the attach operation will be skipped. Otherwise the attach operation will be called. This field is immutable.", alias="attachRequired") - fs_group_policy: Optional[StrictStr] = Field(default=None, description="fsGroupPolicy defines if the underlying volume supports changing ownership and permission of the volume before being mounted. Refer to the specific FSGroupPolicy values for additional details. This field is immutable. Defaults to ReadWriteOnceWithFSType, which will examine each volume to determine if Kubernetes should modify ownership and permissions of the volume. With the default policy the defined fsGroup will only be applied if a fstype is defined and the volume's access mode contains ReadWriteOnce.", alias="fsGroupPolicy") - pod_info_on_mount: Optional[StrictBool] = Field(default=None, description="podInfoOnMount indicates this CSI volume driver requires additional pod information (like podName, podUID, etc.) during mount operations, if set to true. If set to false, pod information will not be passed on mount. Default is false. The CSI driver specifies podInfoOnMount as part of driver deployment. If true, Kubelet will pass pod information as VolumeContext in the CSI NodePublishVolume() calls. The CSI driver is responsible for parsing and validating the information passed in as VolumeContext. The following VolumeContext will be passed if podInfoOnMount is set to true. This list might grow, but the prefix will be used. \"csi.storage.k8s.io/pod.name\": pod.Name \"csi.storage.k8s.io/pod.namespace\": pod.Namespace \"csi.storage.k8s.io/pod.uid\": string(pod.UID) \"csi.storage.k8s.io/ephemeral\": \"true\" if the volume is an ephemeral inline volume defined by a CSIVolumeSource, otherwise \"false\" \"csi.storage.k8s.io/ephemeral\" is a new feature in Kubernetes 1.16. It is only required for drivers which support both the \"Persistent\" and \"Ephemeral\" VolumeLifecycleMode. Other drivers can leave pod info disabled and/or ignore this field. As Kubernetes 1.15 doesn't support this field, drivers can only support one mode when deployed on such a cluster and the deployment determines which mode that is, for example via a command line parameter of the driver. This field is immutable.", alias="podInfoOnMount") + attach_required: Optional[StrictBool] = Field(default=None, description="attachRequired indicates this CSI volume driver requires an attach operation (because it implements the CSI ControllerPublishVolume() method), and that the Kubernetes attach detach controller should call the attach volume interface which checks the volumeattachment status and waits until the volume is attached before proceeding to mounting. The CSI external-attacher coordinates with CSI volume driver and updates the volumeattachment status when the attach operation is complete. If the value is specified to false, the attach operation will be skipped. Otherwise the attach operation will be called. This field is immutable.", alias="attachRequired") + fs_group_policy: Optional[StrictStr] = Field(default=None, description="fsGroupPolicy defines if the underlying volume supports changing ownership and permission of the volume before being mounted. Refer to the specific FSGroupPolicy values for additional details. This field was immutable in Kubernetes < 1.29 and now is mutable. Defaults to ReadWriteOnceWithFSType, which will examine each volume to determine if Kubernetes should modify ownership and permissions of the volume. With the default policy the defined fsGroup will only be applied if a fstype is defined and the volume's access mode contains ReadWriteOnce.", alias="fsGroupPolicy") + node_allocatable_update_period_seconds: Optional[StrictInt] = Field(default=None, description="nodeAllocatableUpdatePeriodSeconds specifies the interval between periodic updates of the CSINode allocatable capacity for this driver. When set, both periodic updates and updates triggered by capacity-related failures are enabled. If not set, no updates occur (neither periodic nor upon detecting capacity-related failures), and the allocatable.count remains static. The minimum allowed value for this field is 10 seconds. This is a beta feature and requires the MutableCSINodeAllocatableCount feature gate to be enabled. This field is mutable.", alias="nodeAllocatableUpdatePeriodSeconds") + pod_info_on_mount: Optional[StrictBool] = Field(default=None, description="podInfoOnMount indicates this CSI volume driver requires additional pod information (like podName, podUID, etc.) during mount operations, if set to true. If set to false, pod information will not be passed on mount. Default is false. The CSI driver specifies podInfoOnMount as part of driver deployment. If true, Kubelet will pass pod information as VolumeContext in the CSI NodePublishVolume() calls. The CSI driver is responsible for parsing and validating the information passed in as VolumeContext. The following VolumeContext will be passed if podInfoOnMount is set to true. This list might grow, but the prefix will be used. \"csi.storage.k8s.io/pod.name\": pod.Name \"csi.storage.k8s.io/pod.namespace\": pod.Namespace \"csi.storage.k8s.io/pod.uid\": string(pod.UID) \"csi.storage.k8s.io/ephemeral\": \"true\" if the volume is an ephemeral inline volume defined by a CSIVolumeSource, otherwise \"false\" \"csi.storage.k8s.io/ephemeral\" is a new feature in Kubernetes 1.16. It is only required for drivers which support both the \"Persistent\" and \"Ephemeral\" VolumeLifecycleMode. Other drivers can leave pod info disabled and/or ignore this field. As Kubernetes 1.15 doesn't support this field, drivers can only support one mode when deployed on such a cluster and the deployment determines which mode that is, for example via a command line parameter of the driver. This field was immutable in Kubernetes < 1.29 and now is mutable.", alias="podInfoOnMount") requires_republish: Optional[StrictBool] = Field(default=None, description="requiresRepublish indicates the CSI driver wants `NodePublishVolume` being periodically called to reflect any possible change in the mounted volume. This field defaults to false. Note: After a successful initial NodePublishVolume call, subsequent calls to NodePublishVolume should only update the contents of the volume. New mount points will not be seen by a running container.", alias="requiresRepublish") se_linux_mount: Optional[StrictBool] = Field(default=None, description="seLinuxMount specifies if the CSI driver supports \"-o context\" mount option. When \"true\", the CSI driver must ensure that all volumes provided by this CSI driver can be mounted separately with different `-o context` options. This is typical for storage backends that provide volumes as filesystems on block devices or as independent shared volumes. Kubernetes will call NodeStage / NodePublish with \"-o context=xyz\" mount option when mounting a ReadWriteOncePod volume used in Pod that has explicitly set SELinux context. In the future, it may be expanded to other volume AccessModes. In any case, Kubernetes will ensure that the volume is mounted only with a single SELinux context. When \"false\", Kubernetes won't pass any special SELinux mount options to the driver. This is typical for volumes that represent subdirectories of a bigger shared filesystem. Default is \"false\".", alias="seLinuxMount") storage_capacity: Optional[StrictBool] = Field(default=None, description="storageCapacity indicates that the CSI volume driver wants pod scheduling to consider the storage capacity that the driver deployment will report by creating CSIStorageCapacity objects with capacity information, if set to true. The check can be enabled immediately when deploying a driver. In that case, provisioning new volumes with late binding will pause until the driver deployment has published some suitable CSIStorageCapacity object. Alternatively, the driver can be deployed with the field unset or false and it can be flipped later when storage capacity information has been published. This field was immutable in Kubernetes <= 1.22 and now is mutable.", alias="storageCapacity") token_requests: Optional[List[StorageV1TokenRequest]] = Field(default=None, description="tokenRequests indicates the CSI driver needs pods' service account tokens it is mounting volume for to do necessary authentication. Kubelet will pass the tokens in VolumeContext in the CSI NodePublishVolume calls. The CSI driver should parse and validate the following VolumeContext: \"csi.storage.k8s.io/serviceAccount.tokens\": { \"\": { \"token\": , \"expirationTimestamp\": , }, ... } Note: Audience in each TokenRequest should be different and at most one token is empty string. To receive a new token after expiry, RequiresRepublish can be used to trigger NodePublishVolume periodically.", alias="tokenRequests") volume_lifecycle_modes: Optional[List[StrictStr]] = Field(default=None, description="volumeLifecycleModes defines what kind of volumes this CSI volume driver supports. The default if the list is empty is \"Persistent\", which is the usage defined by the CSI specification and implemented in Kubernetes via the usual PV/PVC mechanism. The other mode is \"Ephemeral\". In this mode, volumes are defined inline inside the pod spec with CSIVolumeSource and their lifecycle is tied to the lifecycle of that pod. A driver has to be aware of this because it is only going to get a NodePublishVolume call for such a volume. For more information about implementing this mode, see https://kubernetes-csi.github.io/docs/ephemeral-local-volumes.html A driver can support one or more of these modes and more modes may be added in the future. This field is beta. This field is immutable.", alias="volumeLifecycleModes") additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["attachRequired", "fsGroupPolicy", "podInfoOnMount", "requiresRepublish", "seLinuxMount", "storageCapacity", "tokenRequests", "volumeLifecycleModes"] + __properties: ClassVar[List[str]] = ["attachRequired", "fsGroupPolicy", "nodeAllocatableUpdatePeriodSeconds", "podInfoOnMount", "requiresRepublish", "seLinuxMount", "storageCapacity", "tokenRequests", "volumeLifecycleModes"] model_config = ConfigDict( populate_by_name=True, @@ -105,6 +106,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "attachRequired": obj.get("attachRequired"), "fsGroupPolicy": obj.get("fsGroupPolicy"), + "nodeAllocatableUpdatePeriodSeconds": obj.get("nodeAllocatableUpdatePeriodSeconds"), "podInfoOnMount": obj.get("podInfoOnMount"), "requiresRepublish": obj.get("requiresRepublish"), "seLinuxMount": obj.get("seLinuxMount"), diff --git a/src/k8/v1_csi_node.py b/src/k8/v1_csi_node.py index 0c4dc81..5a20840 100644 --- a/src/k8/v1_csi_node.py +++ b/src/k8/v1_csi_node.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_csi_node_driver.py b/src/k8/v1_csi_node_driver.py index 2ce0a77..8461acb 100644 --- a/src/k8/v1_csi_node_driver.py +++ b/src/k8/v1_csi_node_driver.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_csi_node_list.py b/src/k8/v1_csi_node_list.py index 8b32cb7..e1428e2 100644 --- a/src/k8/v1_csi_node_list.py +++ b/src/k8/v1_csi_node_list.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_csi_node_spec.py b/src/k8/v1_csi_node_spec.py index dea6309..14627b3 100644 --- a/src/k8/v1_csi_node_spec.py +++ b/src/k8/v1_csi_node_spec.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_csi_persistent_volume_source.py b/src/k8/v1_csi_persistent_volume_source.py index ff27f3b..a44b7dd 100644 --- a/src/k8/v1_csi_persistent_volume_source.py +++ b/src/k8/v1_csi_persistent_volume_source.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -25,7 +25,7 @@ class V1CSIPersistentVolumeSource(BaseModel): """ - Represents storage that is managed by an external CSI volume driver (Beta feature) + Represents storage that is managed by an external CSI volume driver """ # noqa: E501 controller_expand_secret_ref: Optional[V1SecretReference] = Field(default=None, alias="controllerExpandSecretRef") controller_publish_secret_ref: Optional[V1SecretReference] = Field(default=None, alias="controllerPublishSecretRef") diff --git a/src/k8/v1_csi_storage_capacity.py b/src/k8/v1_csi_storage_capacity.py index c2614fb..174ba8f 100644 --- a/src/k8/v1_csi_storage_capacity.py +++ b/src/k8/v1_csi_storage_capacity.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_csi_storage_capacity_list.py b/src/k8/v1_csi_storage_capacity_list.py index 9f39711..44b926c 100644 --- a/src/k8/v1_csi_storage_capacity_list.py +++ b/src/k8/v1_csi_storage_capacity_list.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_csi_volume_source.py b/src/k8/v1_csi_volume_source.py index 3149c53..559138b 100644 --- a/src/k8/v1_csi_volume_source.py +++ b/src/k8/v1_csi_volume_source.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_custom_resource_column_definition.py b/src/k8/v1_custom_resource_column_definition.py index 077b098..08c8c02 100644 --- a/src/k8/v1_custom_resource_column_definition.py +++ b/src/k8/v1_custom_resource_column_definition.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_custom_resource_conversion.py b/src/k8/v1_custom_resource_conversion.py index d43e88d..b39438a 100644 --- a/src/k8/v1_custom_resource_conversion.py +++ b/src/k8/v1_custom_resource_conversion.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_custom_resource_definition.py b/src/k8/v1_custom_resource_definition.py index 89c97c0..70e0fd6 100644 --- a/src/k8/v1_custom_resource_definition.py +++ b/src/k8/v1_custom_resource_definition.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_custom_resource_definition_condition.py b/src/k8/v1_custom_resource_definition_condition.py index 4a09a07..69bd4f4 100644 --- a/src/k8/v1_custom_resource_definition_condition.py +++ b/src/k8/v1_custom_resource_definition_condition.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_custom_resource_definition_list.py b/src/k8/v1_custom_resource_definition_list.py index 17148f0..59588f3 100644 --- a/src/k8/v1_custom_resource_definition_list.py +++ b/src/k8/v1_custom_resource_definition_list.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_custom_resource_definition_names.py b/src/k8/v1_custom_resource_definition_names.py index be348f0..0d8aa8d 100644 --- a/src/k8/v1_custom_resource_definition_names.py +++ b/src/k8/v1_custom_resource_definition_names.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_custom_resource_definition_spec.py b/src/k8/v1_custom_resource_definition_spec.py index 111233d..0f1b42e 100644 --- a/src/k8/v1_custom_resource_definition_spec.py +++ b/src/k8/v1_custom_resource_definition_spec.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_custom_resource_definition_status.py b/src/k8/v1_custom_resource_definition_status.py index 7838acb..e4badcc 100644 --- a/src/k8/v1_custom_resource_definition_status.py +++ b/src/k8/v1_custom_resource_definition_status.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_custom_resource_definition_version.py b/src/k8/v1_custom_resource_definition_version.py index 6a9e3a4..ef5d094 100644 --- a/src/k8/v1_custom_resource_definition_version.py +++ b/src/k8/v1_custom_resource_definition_version.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from .v1_custom_resource_column_definition import V1CustomResourceColumnDefinition from .v1_custom_resource_subresources import V1CustomResourceSubresources from .v1_custom_resource_validation import V1CustomResourceValidation +from .v1_selectable_field import V1SelectableField from typing import Optional, Set from typing_extensions import Self @@ -34,11 +35,12 @@ class V1CustomResourceDefinitionVersion(BaseModel): deprecation_warning: Optional[StrictStr] = Field(default=None, description="deprecationWarning overrides the default warning returned to API clients. May only be set when `deprecated` is true. The default warning indicates this version is deprecated and recommends use of the newest served version of equal or greater stability, if one exists.", alias="deprecationWarning") name: StrictStr = Field(description="name is the version name, e.g. “v1”, “v2beta1”, etc. The custom resources are served under this version at `/apis///...` if `served` is true.") var_schema: Optional[V1CustomResourceValidation] = Field(default=None, alias="schema") + selectable_fields: Optional[List[V1SelectableField]] = Field(default=None, description="selectableFields specifies paths to fields that may be used as field selectors. A maximum of 8 selectable fields are allowed. See https://kubernetes.io/docs/concepts/overview/working-with-objects/field-selectors", alias="selectableFields") served: StrictBool = Field(description="served is a flag enabling/disabling this version from being served via REST APIs") storage: StrictBool = Field(description="storage indicates this version should be used when persisting custom resources to storage. There must be exactly one version with storage=true.") subresources: Optional[V1CustomResourceSubresources] = None additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["additionalPrinterColumns", "deprecated", "deprecationWarning", "name", "schema", "served", "storage", "subresources"] + __properties: ClassVar[List[str]] = ["additionalPrinterColumns", "deprecated", "deprecationWarning", "name", "schema", "selectableFields", "served", "storage", "subresources"] model_config = ConfigDict( populate_by_name=True, @@ -91,6 +93,13 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of var_schema if self.var_schema: _dict['schema'] = self.var_schema.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in selectable_fields (list) + _items = [] + if self.selectable_fields: + for _item in self.selectable_fields: + if _item: + _items.append(_item.to_dict()) + _dict['selectableFields'] = _items # override the default output from pydantic by calling `to_dict()` of subresources if self.subresources: _dict['subresources'] = self.subresources.to_dict() @@ -116,6 +125,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "deprecationWarning": obj.get("deprecationWarning"), "name": obj.get("name"), "schema": V1CustomResourceValidation.from_dict(obj["schema"]) if obj.get("schema") is not None else None, + "selectableFields": [V1SelectableField.from_dict(_item) for _item in obj["selectableFields"]] if obj.get("selectableFields") is not None else None, "served": obj.get("served"), "storage": obj.get("storage"), "subresources": V1CustomResourceSubresources.from_dict(obj["subresources"]) if obj.get("subresources") is not None else None diff --git a/src/k8/v1_custom_resource_subresource_scale.py b/src/k8/v1_custom_resource_subresource_scale.py index 662b7ad..49b71f2 100644 --- a/src/k8/v1_custom_resource_subresource_scale.py +++ b/src/k8/v1_custom_resource_subresource_scale.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_custom_resource_subresources.py b/src/k8/v1_custom_resource_subresources.py index b4bd848..3edb0bd 100644 --- a/src/k8/v1_custom_resource_subresources.py +++ b/src/k8/v1_custom_resource_subresources.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_custom_resource_validation.py b/src/k8/v1_custom_resource_validation.py index 922e6d7..ce0630f 100644 --- a/src/k8/v1_custom_resource_validation.py +++ b/src/k8/v1_custom_resource_validation.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_daemon_endpoint.py b/src/k8/v1_daemon_endpoint.py index 2d285a5..9d81701 100644 --- a/src/k8/v1_daemon_endpoint.py +++ b/src/k8/v1_daemon_endpoint.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_daemon_set.py b/src/k8/v1_daemon_set.py index fa38489..81eb0b6 100644 --- a/src/k8/v1_daemon_set.py +++ b/src/k8/v1_daemon_set.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_daemon_set_condition.py b/src/k8/v1_daemon_set_condition.py index dfb74f4..b432b1e 100644 --- a/src/k8/v1_daemon_set_condition.py +++ b/src/k8/v1_daemon_set_condition.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_daemon_set_list.py b/src/k8/v1_daemon_set_list.py index 5036a10..d074cea 100644 --- a/src/k8/v1_daemon_set_list.py +++ b/src/k8/v1_daemon_set_list.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_daemon_set_spec.py b/src/k8/v1_daemon_set_spec.py index ff14635..e9a306a 100644 --- a/src/k8/v1_daemon_set_spec.py +++ b/src/k8/v1_daemon_set_spec.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_daemon_set_status.py b/src/k8/v1_daemon_set_status.py index 7cdadb1..e56cc71 100644 --- a/src/k8/v1_daemon_set_status.py +++ b/src/k8/v1_daemon_set_status.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_daemon_set_update_strategy.py b/src/k8/v1_daemon_set_update_strategy.py index 4cbd524..16e9195 100644 --- a/src/k8/v1_daemon_set_update_strategy.py +++ b/src/k8/v1_daemon_set_update_strategy.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_delete_options.py b/src/k8/v1_delete_options.py index c3f1a97..6dea09f 100644 --- a/src/k8/v1_delete_options.py +++ b/src/k8/v1_delete_options.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -30,12 +30,13 @@ class V1DeleteOptions(BaseModel): api_version: Optional[StrictStr] = Field(default=None, description="APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", alias="apiVersion") dry_run: Optional[List[StrictStr]] = Field(default=None, description="When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed", alias="dryRun") grace_period_seconds: Optional[StrictInt] = Field(default=None, description="The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately.", alias="gracePeriodSeconds") + ignore_store_read_error_with_cluster_breaking_potential: Optional[StrictBool] = Field(default=None, description="if set to true, it will trigger an unsafe deletion of the resource in case the normal deletion flow fails with a corrupt object error. A resource is considered corrupt if it can not be retrieved from the underlying storage successfully because of a) its data can not be transformed e.g. decryption failure, or b) it fails to decode into an object. NOTE: unsafe deletion ignores finalizer constraints, skips precondition checks, and removes the object from the storage. WARNING: This may potentially break the cluster if the workload associated with the resource being unsafe-deleted relies on normal deletion flow. Use only if you REALLY know what you are doing. The default value is false, and the user must opt in to enable it", alias="ignoreStoreReadErrorWithClusterBreakingPotential") kind: Optional[StrictStr] = Field(default=None, description="Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds") orphan_dependents: Optional[StrictBool] = Field(default=None, description="Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the \"orphan\" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both.", alias="orphanDependents") preconditions: Optional[V1Preconditions] = None propagation_policy: Optional[StrictStr] = Field(default=None, description="Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy. Acceptable values are: 'Orphan' - orphan the dependents; 'Background' - allow the garbage collector to delete the dependents in the background; 'Foreground' - a cascading policy that deletes all dependents in the foreground.", alias="propagationPolicy") additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["apiVersion", "dryRun", "gracePeriodSeconds", "kind", "orphanDependents", "preconditions", "propagationPolicy"] + __properties: ClassVar[List[str]] = ["apiVersion", "dryRun", "gracePeriodSeconds", "ignoreStoreReadErrorWithClusterBreakingPotential", "kind", "orphanDependents", "preconditions", "propagationPolicy"] model_config = ConfigDict( populate_by_name=True, @@ -101,6 +102,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "apiVersion": obj.get("apiVersion"), "dryRun": obj.get("dryRun"), "gracePeriodSeconds": obj.get("gracePeriodSeconds"), + "ignoreStoreReadErrorWithClusterBreakingPotential": obj.get("ignoreStoreReadErrorWithClusterBreakingPotential"), "kind": obj.get("kind"), "orphanDependents": obj.get("orphanDependents"), "preconditions": V1Preconditions.from_dict(obj["preconditions"]) if obj.get("preconditions") is not None else None, diff --git a/src/k8/v1_deployment.py b/src/k8/v1_deployment.py index 837da45..a36206d 100644 --- a/src/k8/v1_deployment.py +++ b/src/k8/v1_deployment.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_deployment_condition.py b/src/k8/v1_deployment_condition.py index 5d95251..3c389f9 100644 --- a/src/k8/v1_deployment_condition.py +++ b/src/k8/v1_deployment_condition.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_deployment_list.py b/src/k8/v1_deployment_list.py index 854b992..9ae22c0 100644 --- a/src/k8/v1_deployment_list.py +++ b/src/k8/v1_deployment_list.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_deployment_spec.py b/src/k8/v1_deployment_spec.py index 6fcc961..3ba6086 100644 --- a/src/k8/v1_deployment_spec.py +++ b/src/k8/v1_deployment_spec.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_deployment_status.py b/src/k8/v1_deployment_status.py index f0f6bdb..14a0607 100644 --- a/src/k8/v1_deployment_status.py +++ b/src/k8/v1_deployment_status.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -27,16 +27,17 @@ class V1DeploymentStatus(BaseModel): """ DeploymentStatus is the most recently observed status of the Deployment. """ # noqa: E501 - available_replicas: Optional[StrictInt] = Field(default=None, description="Total number of available pods (ready for at least minReadySeconds) targeted by this deployment.", alias="availableReplicas") + available_replicas: Optional[StrictInt] = Field(default=None, description="Total number of available non-terminating pods (ready for at least minReadySeconds) targeted by this deployment.", alias="availableReplicas") collision_count: Optional[StrictInt] = Field(default=None, description="Count of hash collisions for the Deployment. The Deployment controller uses this field as a collision avoidance mechanism when it needs to create the name for the newest ReplicaSet.", alias="collisionCount") conditions: Optional[List[V1DeploymentCondition]] = Field(default=None, description="Represents the latest available observations of a deployment's current state.") observed_generation: Optional[StrictInt] = Field(default=None, description="The generation observed by the deployment controller.", alias="observedGeneration") - ready_replicas: Optional[StrictInt] = Field(default=None, description="readyReplicas is the number of pods targeted by this Deployment with a Ready Condition.", alias="readyReplicas") - replicas: Optional[StrictInt] = Field(default=None, description="Total number of non-terminated pods targeted by this deployment (their labels match the selector).") + ready_replicas: Optional[StrictInt] = Field(default=None, description="Total number of non-terminating pods targeted by this Deployment with a Ready Condition.", alias="readyReplicas") + replicas: Optional[StrictInt] = Field(default=None, description="Total number of non-terminating pods targeted by this deployment (their labels match the selector).") + terminating_replicas: Optional[StrictInt] = Field(default=None, description="Total number of terminating pods targeted by this deployment. Terminating pods have a non-null .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase. This is an alpha field. Enable DeploymentReplicaSetTerminatingReplicas to be able to use this field.", alias="terminatingReplicas") unavailable_replicas: Optional[StrictInt] = Field(default=None, description="Total number of unavailable pods targeted by this deployment. This is the total number of pods that are still required for the deployment to have 100% available capacity. They may either be pods that are running but not yet available or pods that still have not been created.", alias="unavailableReplicas") - updated_replicas: Optional[StrictInt] = Field(default=None, description="Total number of non-terminated pods targeted by this deployment that have the desired template spec.", alias="updatedReplicas") + updated_replicas: Optional[StrictInt] = Field(default=None, description="Total number of non-terminating pods targeted by this deployment that have the desired template spec.", alias="updatedReplicas") additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["availableReplicas", "collisionCount", "conditions", "observedGeneration", "readyReplicas", "replicas", "unavailableReplicas", "updatedReplicas"] + __properties: ClassVar[List[str]] = ["availableReplicas", "collisionCount", "conditions", "observedGeneration", "readyReplicas", "replicas", "terminatingReplicas", "unavailableReplicas", "updatedReplicas"] model_config = ConfigDict( populate_by_name=True, @@ -109,6 +110,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "observedGeneration": obj.get("observedGeneration"), "readyReplicas": obj.get("readyReplicas"), "replicas": obj.get("replicas"), + "terminatingReplicas": obj.get("terminatingReplicas"), "unavailableReplicas": obj.get("unavailableReplicas"), "updatedReplicas": obj.get("updatedReplicas") }) diff --git a/src/k8/v1_deployment_strategy.py b/src/k8/v1_deployment_strategy.py index d20e828..0f82a29 100644 --- a/src/k8/v1_deployment_strategy.py +++ b/src/k8/v1_deployment_strategy.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/src/k8/v1_device.py b/src/k8/v1_device.py new file mode 100644 index 0000000..f1399b8 --- /dev/null +++ b/src/k8/v1_device.py @@ -0,0 +1,168 @@ +# coding: utf-8 + +""" + Kubernetes + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: release-1.34 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from .v1_device_attribute import V1DeviceAttribute +from .v1_device_capacity import V1DeviceCapacity +from .v1_device_counter_consumption import V1DeviceCounterConsumption +from .v1_device_taint import V1DeviceTaint +from .v1_node_selector import V1NodeSelector +from typing import Optional, Set +from typing_extensions import Self + +class V1Device(BaseModel): + """ + Device represents one individual hardware instance that can be selected based on its attributes. Besides the name, exactly one field must be set. + """ # noqa: E501 + all_nodes: Optional[StrictBool] = Field(default=None, description="AllNodes indicates that all nodes have access to the device. Must only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.", alias="allNodes") + allow_multiple_allocations: Optional[StrictBool] = Field(default=None, description="AllowMultipleAllocations marks whether the device is allowed to be allocated to multiple DeviceRequests. If AllowMultipleAllocations is set to true, the device can be allocated more than once, and all of its capacity is consumable, regardless of whether the requestPolicy is defined or not.", alias="allowMultipleAllocations") + attributes: Optional[Dict[str, V1DeviceAttribute]] = Field(default=None, description="Attributes defines the set of attributes for this device. The name of each attribute must be unique in that set. The maximum number of attributes and capacities combined is 32.") + binding_conditions: Optional[List[StrictStr]] = Field(default=None, description="BindingConditions defines the conditions for proceeding with binding. All of these conditions must be set in the per-device status conditions with a value of True to proceed with binding the pod to the node while scheduling the pod. The maximum number of binding conditions is 4. The conditions must be a valid condition type string. This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", alias="bindingConditions") + binding_failure_conditions: Optional[List[StrictStr]] = Field(default=None, description="BindingFailureConditions defines the conditions for binding failure. They may be set in the per-device status conditions. If any is set to \"True\", a binding failure occurred. The maximum number of binding failure conditions is 4. The conditions must be a valid condition type string. This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", alias="bindingFailureConditions") + binds_to_node: Optional[StrictBool] = Field(default=None, description="BindsToNode indicates if the usage of an allocation involving this device has to be limited to exactly the node that was chosen when allocating the claim. If set to true, the scheduler will set the ResourceClaim.Status.Allocation.NodeSelector to match the node where the allocation was made. This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", alias="bindsToNode") + capacity: Optional[Dict[str, V1DeviceCapacity]] = Field(default=None, description="Capacity defines the set of capacities for this device. The name of each capacity must be unique in that set. The maximum number of attributes and capacities combined is 32.") + consumes_counters: Optional[List[V1DeviceCounterConsumption]] = Field(default=None, description="ConsumesCounters defines a list of references to sharedCounters and the set of counters that the device will consume from those counter sets. There can only be a single entry per counterSet. The total number of device counter consumption entries must be <= 32. In addition, the total number in the entire ResourceSlice must be <= 1024 (for example, 64 devices with 16 counters each).", alias="consumesCounters") + name: StrictStr = Field(description="Name is unique identifier among all devices managed by the driver in the pool. It must be a DNS label.") + node_name: Optional[StrictStr] = Field(default=None, description="NodeName identifies the node where the device is available. Must only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.", alias="nodeName") + node_selector: Optional[V1NodeSelector] = Field(default=None, alias="nodeSelector") + taints: Optional[List[V1DeviceTaint]] = Field(default=None, description="If specified, these are the driver-defined taints. The maximum number of taints is 4. This is an alpha field and requires enabling the DRADeviceTaints feature gate.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["allNodes", "allowMultipleAllocations", "attributes", "bindingConditions", "bindingFailureConditions", "bindsToNode", "capacity", "consumesCounters", "name", "nodeName", "nodeSelector", "taints"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V1Device from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each value in attributes (dict) + _field_dict = {} + if self.attributes: + for _key in self.attributes: + if self.attributes[_key]: + _field_dict[_key] = self.attributes[_key].to_dict() + _dict['attributes'] = _field_dict + # override the default output from pydantic by calling `to_dict()` of each value in capacity (dict) + _field_dict = {} + if self.capacity: + for _key in self.capacity: + if self.capacity[_key]: + _field_dict[_key] = self.capacity[_key].to_dict() + _dict['capacity'] = _field_dict + # override the default output from pydantic by calling `to_dict()` of each item in consumes_counters (list) + _items = [] + if self.consumes_counters: + for _item in self.consumes_counters: + if _item: + _items.append(_item.to_dict()) + _dict['consumesCounters'] = _items + # override the default output from pydantic by calling `to_dict()` of node_selector + if self.node_selector: + _dict['nodeSelector'] = self.node_selector.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in taints (list) + _items = [] + if self.taints: + for _item in self.taints: + if _item: + _items.append(_item.to_dict()) + _dict['taints'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V1Device from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "allNodes": obj.get("allNodes"), + "allowMultipleAllocations": obj.get("allowMultipleAllocations"), + "attributes": dict( + (_k, V1DeviceAttribute.from_dict(_v)) + for _k, _v in obj["attributes"].items() + ) + if obj.get("attributes") is not None + else None, + "bindingConditions": obj.get("bindingConditions"), + "bindingFailureConditions": obj.get("bindingFailureConditions"), + "bindsToNode": obj.get("bindsToNode"), + "capacity": dict( + (_k, V1DeviceCapacity.from_dict(_v)) + for _k, _v in obj["capacity"].items() + ) + if obj.get("capacity") is not None + else None, + "consumesCounters": [V1DeviceCounterConsumption.from_dict(_item) for _item in obj["consumesCounters"]] if obj.get("consumesCounters") is not None else None, + "name": obj.get("name"), + "nodeName": obj.get("nodeName"), + "nodeSelector": V1NodeSelector.from_dict(obj["nodeSelector"]) if obj.get("nodeSelector") is not None else None, + "taints": [V1DeviceTaint.from_dict(_item) for _item in obj["taints"]] if obj.get("taints") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/src/k8/v1alpha2_resource_claim_spec.py b/src/k8/v1_device_allocation_configuration.py similarity index 65% rename from src/k8/v1alpha2_resource_claim_spec.py rename to src/k8/v1_device_allocation_configuration.py index 8cd38a4..86e7a88 100644 --- a/src/k8/v1alpha2_resource_claim_spec.py +++ b/src/k8/v1_device_allocation_configuration.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -19,19 +19,19 @@ from pydantic import BaseModel, ConfigDict, Field, StrictStr from typing import Any, ClassVar, Dict, List, Optional -from .v1alpha2_resource_claim_parameters_reference import V1alpha2ResourceClaimParametersReference +from .v1_opaque_device_configuration import V1OpaqueDeviceConfiguration from typing import Optional, Set from typing_extensions import Self -class V1alpha2ResourceClaimSpec(BaseModel): +class V1DeviceAllocationConfiguration(BaseModel): """ - ResourceClaimSpec defines how a resource is to be allocated. + DeviceAllocationConfiguration gets embedded in an AllocationResult. """ # noqa: E501 - allocation_mode: Optional[StrictStr] = Field(default=None, description="Allocation can start immediately or when a Pod wants to use the resource. \"WaitForFirstConsumer\" is the default.", alias="allocationMode") - parameters_ref: Optional[V1alpha2ResourceClaimParametersReference] = Field(default=None, alias="parametersRef") - resource_class_name: StrictStr = Field(description="ResourceClassName references the driver and additional parameters via the name of a ResourceClass that was created as part of the driver deployment.", alias="resourceClassName") + opaque: Optional[V1OpaqueDeviceConfiguration] = None + requests: Optional[List[StrictStr]] = Field(default=None, description="Requests lists the names of requests where the configuration applies. If empty, its applies to all requests. References to subrequests must include the name of the main request and may include the subrequest using the format
[/]. If just the main request is given, the configuration applies to all subrequests.") + source: StrictStr = Field(description="Source records whether the configuration comes from a class and thus is not something that a normal user would have been able to set or from a claim.") additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["allocationMode", "parametersRef", "resourceClassName"] + __properties: ClassVar[List[str]] = ["opaque", "requests", "source"] model_config = ConfigDict( populate_by_name=True, @@ -51,7 +51,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of V1alpha2ResourceClaimSpec from a JSON string""" + """Create an instance of V1DeviceAllocationConfiguration from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -74,9 +74,9 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # override the default output from pydantic by calling `to_dict()` of parameters_ref - if self.parameters_ref: - _dict['parametersRef'] = self.parameters_ref.to_dict() + # override the default output from pydantic by calling `to_dict()` of opaque + if self.opaque: + _dict['opaque'] = self.opaque.to_dict() # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: for _key, _value in self.additional_properties.items(): @@ -86,7 +86,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of V1alpha2ResourceClaimSpec from a dict""" + """Create an instance of V1DeviceAllocationConfiguration from a dict""" if obj is None: return None @@ -94,9 +94,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "allocationMode": obj.get("allocationMode"), - "parametersRef": V1alpha2ResourceClaimParametersReference.from_dict(obj["parametersRef"]) if obj.get("parametersRef") is not None else None, - "resourceClassName": obj.get("resourceClassName") + "opaque": V1OpaqueDeviceConfiguration.from_dict(obj["opaque"]) if obj.get("opaque") is not None else None, + "requests": obj.get("requests"), + "source": obj.get("source") }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/src/k8/v1alpha1_validating_admission_policy_status.py b/src/k8/v1_device_allocation_result.py similarity index 61% rename from src/k8/v1alpha1_validating_admission_policy_status.py rename to src/k8/v1_device_allocation_result.py index a6cf7db..1155129 100644 --- a/src/k8/v1alpha1_validating_admission_policy_status.py +++ b/src/k8/v1_device_allocation_result.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -17,22 +17,21 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, Field, StrictInt +from pydantic import BaseModel, ConfigDict, Field from typing import Any, ClassVar, Dict, List, Optional -from .v1_condition import V1Condition -from .v1alpha1_type_checking import V1alpha1TypeChecking +from .v1_device_allocation_configuration import V1DeviceAllocationConfiguration +from .v1_device_request_allocation_result import V1DeviceRequestAllocationResult from typing import Optional, Set from typing_extensions import Self -class V1alpha1ValidatingAdmissionPolicyStatus(BaseModel): +class V1DeviceAllocationResult(BaseModel): """ - ValidatingAdmissionPolicyStatus represents the status of a ValidatingAdmissionPolicy. + DeviceAllocationResult is the result of allocating devices. """ # noqa: E501 - conditions: Optional[List[V1Condition]] = Field(default=None, description="The conditions represent the latest available observations of a policy's current state.") - observed_generation: Optional[StrictInt] = Field(default=None, description="The generation observed by the controller.", alias="observedGeneration") - type_checking: Optional[V1alpha1TypeChecking] = Field(default=None, alias="typeChecking") + config: Optional[List[V1DeviceAllocationConfiguration]] = Field(default=None, description="This field is a combination of all the claim and class configuration parameters. Drivers can distinguish between those based on a flag. This includes configuration parameters for drivers which have no allocated devices in the result because it is up to the drivers which configuration parameters they support. They can silently ignore unknown configuration parameters.") + results: Optional[List[V1DeviceRequestAllocationResult]] = Field(default=None, description="Results lists all allocated devices.") additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["conditions", "observedGeneration", "typeChecking"] + __properties: ClassVar[List[str]] = ["config", "results"] model_config = ConfigDict( populate_by_name=True, @@ -52,7 +51,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of V1alpha1ValidatingAdmissionPolicyStatus from a JSON string""" + """Create an instance of V1DeviceAllocationResult from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -75,16 +74,20 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # override the default output from pydantic by calling `to_dict()` of each item in conditions (list) + # override the default output from pydantic by calling `to_dict()` of each item in config (list) _items = [] - if self.conditions: - for _item in self.conditions: + if self.config: + for _item in self.config: if _item: _items.append(_item.to_dict()) - _dict['conditions'] = _items - # override the default output from pydantic by calling `to_dict()` of type_checking - if self.type_checking: - _dict['typeChecking'] = self.type_checking.to_dict() + _dict['config'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item in self.results: + if _item: + _items.append(_item.to_dict()) + _dict['results'] = _items # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: for _key, _value in self.additional_properties.items(): @@ -94,7 +97,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of V1alpha1ValidatingAdmissionPolicyStatus from a dict""" + """Create an instance of V1DeviceAllocationResult from a dict""" if obj is None: return None @@ -102,9 +105,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "conditions": [V1Condition.from_dict(_item) for _item in obj["conditions"]] if obj.get("conditions") is not None else None, - "observedGeneration": obj.get("observedGeneration"), - "typeChecking": V1alpha1TypeChecking.from_dict(obj["typeChecking"]) if obj.get("typeChecking") is not None else None + "config": [V1DeviceAllocationConfiguration.from_dict(_item) for _item in obj["config"]] if obj.get("config") is not None else None, + "results": [V1DeviceRequestAllocationResult.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/src/k8/v1_device_attribute.py b/src/k8/v1_device_attribute.py new file mode 100644 index 0000000..c3dd6fe --- /dev/null +++ b/src/k8/v1_device_attribute.py @@ -0,0 +1,106 @@ +# coding: utf-8 + +""" + Kubernetes + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: release-1.34 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class V1DeviceAttribute(BaseModel): + """ + DeviceAttribute must have exactly one field set. + """ # noqa: E501 + bool: Optional[StrictBool] = Field(default=None, description="BoolValue is a true/false value.") + int: Optional[StrictInt] = Field(default=None, description="IntValue is a number.") + string: Optional[StrictStr] = Field(default=None, description="StringValue is a string. Must not be longer than 64 characters.") + version: Optional[StrictStr] = Field(default=None, description="VersionValue is a semantic version according to semver.org spec 2.0.0. Must not be longer than 64 characters.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["bool", "int", "string", "version"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V1DeviceAttribute from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V1DeviceAttribute from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "bool": obj.get("bool"), + "int": obj.get("int"), + "string": obj.get("string"), + "version": obj.get("version") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/src/k8/v1_device_capacity.py b/src/k8/v1_device_capacity.py new file mode 100644 index 0000000..66f4241 --- /dev/null +++ b/src/k8/v1_device_capacity.py @@ -0,0 +1,106 @@ +# coding: utf-8 + +""" + Kubernetes + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: release-1.34 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from .v1_capacity_request_policy import V1CapacityRequestPolicy +from typing import Optional, Set +from typing_extensions import Self + +class V1DeviceCapacity(BaseModel): + """ + DeviceCapacity describes a quantity associated with a device. + """ # noqa: E501 + request_policy: Optional[V1CapacityRequestPolicy] = Field(default=None, alias="requestPolicy") + value: StrictStr = Field(description="Value defines how much of a certain capacity that device has. This field reflects the fixed total capacity and does not change. The consumed amount is tracked separately by scheduler and does not affect this value.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["requestPolicy", "value"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V1DeviceCapacity from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of request_policy + if self.request_policy: + _dict['requestPolicy'] = self.request_policy.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V1DeviceCapacity from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "requestPolicy": V1CapacityRequestPolicy.from_dict(obj["requestPolicy"]) if obj.get("requestPolicy") is not None else None, + "value": obj.get("value") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/src/k8/v1alpha1_validating_admission_policy_binding_list.py b/src/k8/v1_device_claim.py similarity index 55% rename from src/k8/v1alpha1_validating_admission_policy_binding_list.py rename to src/k8/v1_device_claim.py index a4e99a1..afa9571 100644 --- a/src/k8/v1alpha1_validating_admission_policy_binding_list.py +++ b/src/k8/v1_device_claim.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -17,23 +17,23 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field from typing import Any, ClassVar, Dict, List, Optional -from .v1_list_meta import V1ListMeta -from .v1alpha1_validating_admission_policy_binding import V1alpha1ValidatingAdmissionPolicyBinding +from .v1_device_claim_configuration import V1DeviceClaimConfiguration +from .v1_device_constraint import V1DeviceConstraint +from .v1_device_request import V1DeviceRequest from typing import Optional, Set from typing_extensions import Self -class V1alpha1ValidatingAdmissionPolicyBindingList(BaseModel): +class V1DeviceClaim(BaseModel): """ - ValidatingAdmissionPolicyBindingList is a list of ValidatingAdmissionPolicyBinding. + DeviceClaim defines how to request devices with a ResourceClaim. """ # noqa: E501 - api_version: Optional[StrictStr] = Field(default=None, description="APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", alias="apiVersion") - items: Optional[List[V1alpha1ValidatingAdmissionPolicyBinding]] = Field(default=None, description="List of PolicyBinding.") - kind: Optional[StrictStr] = Field(default=None, description="Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds") - metadata: Optional[V1ListMeta] = None + config: Optional[List[V1DeviceClaimConfiguration]] = Field(default=None, description="This field holds configuration for multiple potential drivers which could satisfy requests in this claim. It is ignored while allocating the claim.") + constraints: Optional[List[V1DeviceConstraint]] = Field(default=None, description="These constraints must be satisfied by the set of devices that get allocated for the claim.") + requests: Optional[List[V1DeviceRequest]] = Field(default=None, description="Requests represent individual requests for distinct devices which must all be satisfied. If empty, nothing needs to be allocated.") additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["apiVersion", "items", "kind", "metadata"] + __properties: ClassVar[List[str]] = ["config", "constraints", "requests"] model_config = ConfigDict( populate_by_name=True, @@ -53,7 +53,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of V1alpha1ValidatingAdmissionPolicyBindingList from a JSON string""" + """Create an instance of V1DeviceClaim from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -76,16 +76,27 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # override the default output from pydantic by calling `to_dict()` of each item in items (list) + # override the default output from pydantic by calling `to_dict()` of each item in config (list) _items = [] - if self.items: - for _item in self.items: + if self.config: + for _item in self.config: if _item: _items.append(_item.to_dict()) - _dict['items'] = _items - # override the default output from pydantic by calling `to_dict()` of metadata - if self.metadata: - _dict['metadata'] = self.metadata.to_dict() + _dict['config'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in constraints (list) + _items = [] + if self.constraints: + for _item in self.constraints: + if _item: + _items.append(_item.to_dict()) + _dict['constraints'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in requests (list) + _items = [] + if self.requests: + for _item in self.requests: + if _item: + _items.append(_item.to_dict()) + _dict['requests'] = _items # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: for _key, _value in self.additional_properties.items(): @@ -95,7 +106,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of V1alpha1ValidatingAdmissionPolicyBindingList from a dict""" + """Create an instance of V1DeviceClaim from a dict""" if obj is None: return None @@ -103,10 +114,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "apiVersion": obj.get("apiVersion"), - "items": [V1alpha1ValidatingAdmissionPolicyBinding.from_dict(_item) for _item in obj["items"]] if obj.get("items") is not None else None, - "kind": obj.get("kind"), - "metadata": V1ListMeta.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None + "config": [V1DeviceClaimConfiguration.from_dict(_item) for _item in obj["config"]] if obj.get("config") is not None else None, + "constraints": [V1DeviceConstraint.from_dict(_item) for _item in obj["constraints"]] if obj.get("constraints") is not None else None, + "requests": [V1DeviceRequest.from_dict(_item) for _item in obj["requests"]] if obj.get("requests") is not None else None }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/src/k8/v1_device_claim_configuration.py b/src/k8/v1_device_claim_configuration.py new file mode 100644 index 0000000..57aa035 --- /dev/null +++ b/src/k8/v1_device_claim_configuration.py @@ -0,0 +1,106 @@ +# coding: utf-8 + +""" + Kubernetes + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: release-1.34 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from .v1_opaque_device_configuration import V1OpaqueDeviceConfiguration +from typing import Optional, Set +from typing_extensions import Self + +class V1DeviceClaimConfiguration(BaseModel): + """ + DeviceClaimConfiguration is used for configuration parameters in DeviceClaim. + """ # noqa: E501 + opaque: Optional[V1OpaqueDeviceConfiguration] = None + requests: Optional[List[StrictStr]] = Field(default=None, description="Requests lists the names of requests where the configuration applies. If empty, it applies to all requests. References to subrequests must include the name of the main request and may include the subrequest using the format
[/]. If just the main request is given, the configuration applies to all subrequests.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["opaque", "requests"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V1DeviceClaimConfiguration from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of opaque + if self.opaque: + _dict['opaque'] = self.opaque.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V1DeviceClaimConfiguration from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "opaque": V1OpaqueDeviceConfiguration.from_dict(obj["opaque"]) if obj.get("opaque") is not None else None, + "requests": obj.get("requests") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/src/k8/v1beta1_self_subject_review.py b/src/k8/v1_device_class.py similarity index 80% rename from src/k8/v1beta1_self_subject_review.py rename to src/k8/v1_device_class.py index 247a751..4c09bb6 100644 --- a/src/k8/v1beta1_self_subject_review.py +++ b/src/k8/v1_device_class.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -19,21 +19,21 @@ from pydantic import BaseModel, ConfigDict, Field, StrictStr from typing import Any, ClassVar, Dict, List, Optional +from .v1_device_class_spec import V1DeviceClassSpec from .v1_object_meta import V1ObjectMeta -from .v1beta1_self_subject_review_status import V1beta1SelfSubjectReviewStatus from typing import Optional, Set from typing_extensions import Self -class V1beta1SelfSubjectReview(BaseModel): +class V1DeviceClass(BaseModel): """ - SelfSubjectReview contains the user information that the kube-apiserver has about the user making this request. When using impersonation, users will receive the user info of the user being impersonated. If impersonation or request header authentication is used, any extra keys will have their case ignored and returned as lowercase. + DeviceClass is a vendor- or admin-provided resource that contains device configuration and selectors. It can be referenced in the device requests of a claim to apply these presets. Cluster scoped. This is an alpha type and requires enabling the DynamicResourceAllocation feature gate. """ # noqa: E501 api_version: Optional[StrictStr] = Field(default=None, description="APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", alias="apiVersion") kind: Optional[StrictStr] = Field(default=None, description="Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds") metadata: Optional[V1ObjectMeta] = None - status: Optional[V1beta1SelfSubjectReviewStatus] = None + spec: V1DeviceClassSpec additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["apiVersion", "kind", "metadata", "status"] + __properties: ClassVar[List[str]] = ["apiVersion", "kind", "metadata", "spec"] model_config = ConfigDict( populate_by_name=True, @@ -53,7 +53,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of V1beta1SelfSubjectReview from a JSON string""" + """Create an instance of V1DeviceClass from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -79,9 +79,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of metadata if self.metadata: _dict['metadata'] = self.metadata.to_dict() - # override the default output from pydantic by calling `to_dict()` of status - if self.status: - _dict['status'] = self.status.to_dict() + # override the default output from pydantic by calling `to_dict()` of spec + if self.spec: + _dict['spec'] = self.spec.to_dict() # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: for _key, _value in self.additional_properties.items(): @@ -91,7 +91,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of V1beta1SelfSubjectReview from a dict""" + """Create an instance of V1DeviceClass from a dict""" if obj is None: return None @@ -102,7 +102,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "apiVersion": obj.get("apiVersion"), "kind": obj.get("kind"), "metadata": V1ObjectMeta.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None, - "status": V1beta1SelfSubjectReviewStatus.from_dict(obj["status"]) if obj.get("status") is not None else None + "spec": V1DeviceClassSpec.from_dict(obj["spec"]) if obj.get("spec") is not None else None }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/src/k8/v1_device_class_configuration.py b/src/k8/v1_device_class_configuration.py new file mode 100644 index 0000000..a697703 --- /dev/null +++ b/src/k8/v1_device_class_configuration.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Kubernetes + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: release-1.34 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from .v1_opaque_device_configuration import V1OpaqueDeviceConfiguration +from typing import Optional, Set +from typing_extensions import Self + +class V1DeviceClassConfiguration(BaseModel): + """ + DeviceClassConfiguration is used in DeviceClass. + """ # noqa: E501 + opaque: Optional[V1OpaqueDeviceConfiguration] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["opaque"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V1DeviceClassConfiguration from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of opaque + if self.opaque: + _dict['opaque'] = self.opaque.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V1DeviceClassConfiguration from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "opaque": V1OpaqueDeviceConfiguration.from_dict(obj["opaque"]) if obj.get("opaque") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/src/k8/v1beta3_flow_schema_list.py b/src/k8/v1_device_class_list.py similarity index 88% rename from src/k8/v1beta3_flow_schema_list.py rename to src/k8/v1_device_class_list.py index b9b9f92..9752062 100644 --- a/src/k8/v1beta3_flow_schema_list.py +++ b/src/k8/v1_device_class_list.py @@ -5,7 +5,7 @@ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: release-1.29 + The version of the OpenAPI document: release-1.34 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -19,17 +19,17 @@ from pydantic import BaseModel, ConfigDict, Field, StrictStr from typing import Any, ClassVar, Dict, List, Optional +from .v1_device_class import V1DeviceClass from .v1_list_meta import V1ListMeta -from .v1beta3_flow_schema import V1beta3FlowSchema from typing import Optional, Set from typing_extensions import Self -class V1beta3FlowSchemaList(BaseModel): +class V1DeviceClassList(BaseModel): """ - FlowSchemaList is a list of FlowSchema objects. + DeviceClassList is a collection of classes. """ # noqa: E501 api_version: Optional[StrictStr] = Field(default=None, description="APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", alias="apiVersion") - items: List[V1beta3FlowSchema] = Field(description="`items` is a list of FlowSchemas.") + items: List[V1DeviceClass] = Field(description="Items is the list of resource classes.") kind: Optional[StrictStr] = Field(default=None, description="Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds") metadata: Optional[V1ListMeta] = None additional_properties: Dict[str, Any] = {} @@ -53,7 +53,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of V1beta3FlowSchemaList from a JSON string""" + """Create an instance of V1DeviceClassList from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -95,7 +95,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of V1beta3FlowSchemaList from a dict""" + """Create an instance of V1DeviceClassList from a dict""" if obj is None: return None @@ -104,7 +104,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "apiVersion": obj.get("apiVersion"), - "items": [V1beta3FlowSchema.from_dict(_item) for _item in obj["items"]] if obj.get("items") is not None else None, + "items": [V1DeviceClass.from_dict(_item) for _item in obj["items"]] if obj.get("items") is not None else None, "kind": obj.get("kind"), "metadata": V1ListMeta.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None }) diff --git a/src/k8/v1_device_class_spec.py b/src/k8/v1_device_class_spec.py new file mode 100644 index 0000000..b1714b1 --- /dev/null +++ b/src/k8/v1_device_class_spec.py @@ -0,0 +1,120 @@ +# coding: utf-8 + +""" + Kubernetes + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: release-1.34 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from .v1_device_class_configuration import V1DeviceClassConfiguration +from .v1_device_selector import V1DeviceSelector +from typing import Optional, Set +from typing_extensions import Self + +class V1DeviceClassSpec(BaseModel): + """ + DeviceClassSpec is used in a [DeviceClass] to define what can be allocated and how to configure it. + """ # noqa: E501 + config: Optional[List[V1DeviceClassConfiguration]] = Field(default=None, description="Config defines configuration parameters that apply to each device that is claimed via this class. Some classses may potentially be satisfied by multiple drivers, so each instance of a vendor configuration applies to exactly one driver. They are passed to the driver, but are not considered while allocating the claim.") + extended_resource_name: Optional[StrictStr] = Field(default=None, description="ExtendedResourceName is the extended resource name for the devices of this class. The devices of this class can be used to satisfy a pod's extended resource requests. It has the same format as the name of a pod's extended resource. It should be unique among all the device classes in a cluster. If two device classes have the same name, then the class created later is picked to satisfy a pod's extended resource requests. If two classes are created at the same time, then the name of the class lexicographically sorted first is picked. This is an alpha field.", alias="extendedResourceName") + selectors: Optional[List[V1DeviceSelector]] = Field(default=None, description="Each selector must be satisfied by a device which is claimed via this class.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["config", "extendedResourceName", "selectors"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V1DeviceClassSpec from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in config (list) + _items = [] + if self.config: + for _item in self.config: + if _item: + _items.append(_item.to_dict()) + _dict['config'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in selectors (list) + _items = [] + if self.selectors: + for _item in self.selectors: + if _item: + _items.append(_item.to_dict()) + _dict['selectors'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V1DeviceClassSpec from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "config": [V1DeviceClassConfiguration.from_dict(_item) for _item in obj["config"]] if obj.get("config") is not None else None, + "extendedResourceName": obj.get("extendedResourceName"), + "selectors": [V1DeviceSelector.from_dict(_item) for _item in obj["selectors"]] if obj.get("selectors") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/src/k8/v1_device_constraint.py b/src/k8/v1_device_constraint.py new file mode 100644 index 0000000..d61511a --- /dev/null +++ b/src/k8/v1_device_constraint.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Kubernetes + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: release-1.34 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class V1DeviceConstraint(BaseModel): + """ + DeviceConstraint must have exactly one field set besides Requests. + """ # noqa: E501 + distinct_attribute: Optional[StrictStr] = Field(default=None, description="DistinctAttribute requires that all devices in question have this attribute and that its type and value are unique across those devices. This acts as the inverse of MatchAttribute. This constraint is used to avoid allocating multiple requests to the same device by ensuring attribute-level differentiation. This is useful for scenarios where resource requests must be fulfilled by separate physical devices. For example, a container requests two network interfaces that must be allocated from two different physical NICs.", alias="distinctAttribute") + match_attribute: Optional[StrictStr] = Field(default=None, description="MatchAttribute requires that all devices in question have this attribute and that its type and value are the same across those devices. For example, if you specified \"dra.example.com/numa\" (a hypothetical example!), then only devices in the same NUMA node will be chosen. A device which does not have that attribute will not be chosen. All devices should use a value of the same type for this attribute because that is part of its specification, but if one device doesn't, then it also will not be chosen. Must include the domain qualifier.", alias="matchAttribute") + requests: Optional[List[StrictStr]] = Field(default=None, description="Requests is a list of the one or more requests in this claim which must co-satisfy this constraint. If a request is fulfilled by multiple devices, then all of the devices must satisfy the constraint. If this is not specified, this constraint applies to all requests in this claim. References to subrequests must include the name of the main request and may include the subrequest using the format
[/]. If just the main request is given, the constraint applies to all subrequests.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["distinctAttribute", "matchAttribute", "requests"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V1DeviceConstraint from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V1DeviceConstraint from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "distinctAttribute": obj.get("distinctAttribute"), + "matchAttribute": obj.get("matchAttribute"), + "requests": obj.get("requests") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/src/k8/v1_device_counter_consumption.py b/src/k8/v1_device_counter_consumption.py new file mode 100644 index 0000000..0b18653 --- /dev/null +++ b/src/k8/v1_device_counter_consumption.py @@ -0,0 +1,115 @@ +# coding: utf-8 + +""" + Kubernetes + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: release-1.34 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from .v1_counter import V1Counter +from typing import Optional, Set +from typing_extensions import Self + +class V1DeviceCounterConsumption(BaseModel): + """ + DeviceCounterConsumption defines a set of counters that a device will consume from a CounterSet. + """ # noqa: E501 + counter_set: StrictStr = Field(description="CounterSet is the name of the set from which the counters defined will be consumed.", alias="counterSet") + counters: Dict[str, V1Counter] = Field(description="Counters defines the counters that will be consumed by the device. The maximum number counters in a device is 32. In addition, the maximum number of all counters in all devices is 1024 (for example, 64 devices with 16 counters each).") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["counterSet", "counters"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V1DeviceCounterConsumption from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each value in counters (dict) + _field_dict = {} + if self.counters: + for _key in self.counters: + if self.counters[_key]: + _field_dict[_key] = self.counters[_key].to_dict() + _dict['counters'] = _field_dict + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V1DeviceCounterConsumption from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "counterSet": obj.get("counterSet"), + "counters": dict( + (_k, V1Counter.from_dict(_v)) + for _k, _v in obj["counters"].items() + ) + if obj.get("counters") is not None + else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/src/k8/v1_device_request.py b/src/k8/v1_device_request.py new file mode 100644 index 0000000..2036b80 --- /dev/null +++ b/src/k8/v1_device_request.py @@ -0,0 +1,116 @@ +# coding: utf-8 + +""" + Kubernetes + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: release-1.34 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from .v1_device_sub_request import V1DeviceSubRequest +from .v1_exact_device_request import V1ExactDeviceRequest +from typing import Optional, Set +from typing_extensions import Self + +class V1DeviceRequest(BaseModel): + """ + DeviceRequest is a request for devices required for a claim. This is typically a request for a single resource like a device, but can also ask for several identical devices. With FirstAvailable it is also possible to provide a prioritized list of requests. + """ # noqa: E501 + exactly: Optional[V1ExactDeviceRequest] = None + first_available: Optional[List[V1DeviceSubRequest]] = Field(default=None, description="FirstAvailable contains subrequests, of which exactly one will be selected by the scheduler. It tries to satisfy them in the order in which they are listed here. So if there are two entries in the list, the scheduler will only check the second one if it determines that the first one can not be used. DRA does not yet implement scoring, so the scheduler will select the first set of devices that satisfies all the requests in the claim. And if the requirements can be satisfied on more than one node, other scheduling features will determine which node is chosen. This means that the set of devices allocated to a claim might not be the optimal set available to the cluster. Scoring will be implemented later.", alias="firstAvailable") + name: StrictStr = Field(description="Name can be used to reference this request in a pod.spec.containers[].resources.claims entry and in a constraint of the claim. References using the name in the DeviceRequest will uniquely identify a request when the Exactly field is set. When the FirstAvailable field is set, a reference to the name of the DeviceRequest will match whatever subrequest is chosen by the scheduler. Must be a DNS label.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["exactly", "firstAvailable", "name"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V1DeviceRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of exactly + if self.exactly: + _dict['exactly'] = self.exactly.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in first_available (list) + _items = [] + if self.first_available: + for _item in self.first_available: + if _item: + _items.append(_item.to_dict()) + _dict['firstAvailable'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V1DeviceRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "exactly": V1ExactDeviceRequest.from_dict(obj["exactly"]) if obj.get("exactly") is not None else None, + "firstAvailable": [V1DeviceSubRequest.from_dict(_item) for _item in obj["firstAvailable"]] if obj.get("firstAvailable") is not None else None, + "name": obj.get("name") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/src/k8/v1_device_request_allocation_result.py b/src/k8/v1_device_request_allocation_result.py new file mode 100644 index 0000000..4eb8475 --- /dev/null +++ b/src/k8/v1_device_request_allocation_result.py @@ -0,0 +1,126 @@ +# coding: utf-8 + +""" + Kubernetes + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: release-1.34 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from .v1_device_toleration import V1DeviceToleration +from typing import Optional, Set +from typing_extensions import Self + +class V1DeviceRequestAllocationResult(BaseModel): + """ + DeviceRequestAllocationResult contains the allocation result for one request. + """ # noqa: E501 + admin_access: Optional[StrictBool] = Field(default=None, description="AdminAccess indicates that this device was allocated for administrative access. See the corresponding request field for a definition of mode. This is an alpha field and requires enabling the DRAAdminAccess feature gate. Admin access is disabled if this field is unset or set to false, otherwise it is enabled.", alias="adminAccess") + binding_conditions: Optional[List[StrictStr]] = Field(default=None, description="BindingConditions contains a copy of the BindingConditions from the corresponding ResourceSlice at the time of allocation. This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", alias="bindingConditions") + binding_failure_conditions: Optional[List[StrictStr]] = Field(default=None, description="BindingFailureConditions contains a copy of the BindingFailureConditions from the corresponding ResourceSlice at the time of allocation. This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", alias="bindingFailureConditions") + consumed_capacity: Optional[Dict[str, StrictStr]] = Field(default=None, description="ConsumedCapacity tracks the amount of capacity consumed per device as part of the claim request. The consumed amount may differ from the requested amount: it is rounded up to the nearest valid value based on the device’s requestPolicy if applicable (i.e., may not be less than the requested amount). The total consumed capacity for each device must not exceed the DeviceCapacity's Value. This field is populated only for devices that allow multiple allocations. All capacity entries are included, even if the consumed amount is zero.", alias="consumedCapacity") + device: StrictStr = Field(description="Device references one device instance via its name in the driver's resource pool. It must be a DNS label.") + driver: StrictStr = Field(description="Driver specifies the name of the DRA driver whose kubelet plugin should be invoked to process the allocation once the claim is needed on a node. Must be a DNS subdomain and should end with a DNS domain owned by the vendor of the driver.") + pool: StrictStr = Field(description="This name together with the driver name and the device name field identify which device was allocated (`//`). Must not be longer than 253 characters and may contain one or more DNS sub-domains separated by slashes.") + request: StrictStr = Field(description="Request is the name of the request in the claim which caused this device to be allocated. If it references a subrequest in the firstAvailable list on a DeviceRequest, this field must include both the name of the main request and the subrequest using the format
/. Multiple devices may have been allocated per request.") + share_id: Optional[StrictStr] = Field(default=None, description="ShareID uniquely identifies an individual allocation share of the device, used when the device supports multiple simultaneous allocations. It serves as an additional map key to differentiate concurrent shares of the same device.", alias="shareID") + tolerations: Optional[List[V1DeviceToleration]] = Field(default=None, description="A copy of all tolerations specified in the request at the time when the device got allocated. The maximum number of tolerations is 16. This is an alpha field and requires enabling the DRADeviceTaints feature gate.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["adminAccess", "bindingConditions", "bindingFailureConditions", "consumedCapacity", "device", "driver", "pool", "request", "shareID", "tolerations"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V1DeviceRequestAllocationResult from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in tolerations (list) + _items = [] + if self.tolerations: + for _item in self.tolerations: + if _item: + _items.append(_item.to_dict()) + _dict['tolerations'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V1DeviceRequestAllocationResult from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "adminAccess": obj.get("adminAccess"), + "bindingConditions": obj.get("bindingConditions"), + "bindingFailureConditions": obj.get("bindingFailureConditions"), + "consumedCapacity": obj.get("consumedCapacity"), + "device": obj.get("device"), + "driver": obj.get("driver"), + "pool": obj.get("pool"), + "request": obj.get("request"), + "shareID": obj.get("shareID"), + "tolerations": [V1DeviceToleration.from_dict(_item) for _item in obj["tolerations"]] if obj.get("tolerations") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/src/k8/v1_device_selector.py b/src/k8/v1_device_selector.py new file mode 100644 index 0000000..5c125d6 --- /dev/null +++ b/src/k8/v1_device_selector.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Kubernetes + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: release-1.34 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from .v1_cel_device_selector import V1CELDeviceSelector +from typing import Optional, Set +from typing_extensions import Self + +class V1DeviceSelector(BaseModel): + """ + DeviceSelector must have exactly one field set. + """ # noqa: E501 + cel: Optional[V1CELDeviceSelector] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["cel"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V1DeviceSelector from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of cel + if self.cel: + _dict['cel'] = self.cel.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V1DeviceSelector from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "cel": V1CELDeviceSelector.from_dict(obj["cel"]) if obj.get("cel") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/src/k8/v1_device_sub_request.py b/src/k8/v1_device_sub_request.py new file mode 100644 index 0000000..ba24da1 --- /dev/null +++ b/src/k8/v1_device_sub_request.py @@ -0,0 +1,132 @@ +# coding: utf-8 + +""" + Kubernetes + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: release-1.34 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from .v1_capacity_requirements import V1CapacityRequirements +from .v1_device_selector import V1DeviceSelector +from .v1_device_toleration import V1DeviceToleration +from typing import Optional, Set +from typing_extensions import Self + +class V1DeviceSubRequest(BaseModel): + """ + DeviceSubRequest describes a request for device provided in the claim.spec.devices.requests[].firstAvailable array. Each is typically a request for a single resource like a device, but can also ask for several identical devices. DeviceSubRequest is similar to ExactDeviceRequest, but doesn't expose the AdminAccess field as that one is only supported when requesting a specific device. + """ # noqa: E501 + allocation_mode: Optional[StrictStr] = Field(default=None, description="AllocationMode and its related fields define how devices are allocated to satisfy this subrequest. Supported values are: - ExactCount: This request is for a specific number of devices. This is the default. The exact number is provided in the count field. - All: This subrequest is for all of the matching devices in a pool. Allocation will fail if some devices are already allocated, unless adminAccess is requested. If AllocationMode is not specified, the default mode is ExactCount. If the mode is ExactCount and count is not specified, the default count is one. Any other subrequests must specify this field. More modes may get added in the future. Clients must refuse to handle requests with unknown modes.", alias="allocationMode") + capacity: Optional[V1CapacityRequirements] = None + count: Optional[StrictInt] = Field(default=None, description="Count is used only when the count mode is \"ExactCount\". Must be greater than zero. If AllocationMode is ExactCount and this field is not specified, the default is one.") + device_class_name: StrictStr = Field(description="DeviceClassName references a specific DeviceClass, which can define additional configuration and selectors to be inherited by this subrequest. A class is required. Which classes are available depends on the cluster. Administrators may use this to restrict which devices may get requested by only installing classes with selectors for permitted devices. If users are free to request anything without restrictions, then administrators can create an empty DeviceClass for users to reference.", alias="deviceClassName") + name: StrictStr = Field(description="Name can be used to reference this subrequest in the list of constraints or the list of configurations for the claim. References must use the format
/. Must be a DNS label.") + selectors: Optional[List[V1DeviceSelector]] = Field(default=None, description="Selectors define criteria which must be satisfied by a specific device in order for that device to be considered for this subrequest. All selectors must be satisfied for a device to be considered.") + tolerations: Optional[List[V1DeviceToleration]] = Field(default=None, description="If specified, the request's tolerations. Tolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute. In addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated. The maximum number of tolerations is 16. This is an alpha field and requires enabling the DRADeviceTaints feature gate.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["allocationMode", "capacity", "count", "deviceClassName", "name", "selectors", "tolerations"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V1DeviceSubRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of capacity + if self.capacity: + _dict['capacity'] = self.capacity.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in selectors (list) + _items = [] + if self.selectors: + for _item in self.selectors: + if _item: + _items.append(_item.to_dict()) + _dict['selectors'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in tolerations (list) + _items = [] + if self.tolerations: + for _item in self.tolerations: + if _item: + _items.append(_item.to_dict()) + _dict['tolerations'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V1DeviceSubRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "allocationMode": obj.get("allocationMode"), + "capacity": V1CapacityRequirements.from_dict(obj["capacity"]) if obj.get("capacity") is not None else None, + "count": obj.get("count"), + "deviceClassName": obj.get("deviceClassName"), + "name": obj.get("name"), + "selectors": [V1DeviceSelector.from_dict(_item) for _item in obj["selectors"]] if obj.get("selectors") is not None else None, + "tolerations": [V1DeviceToleration.from_dict(_item) for _item in obj["tolerations"]] if obj.get("tolerations") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/src/k8/v1_device_taint.py b/src/k8/v1_device_taint.py new file mode 100644 index 0000000..a5d6655 --- /dev/null +++ b/src/k8/v1_device_taint.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Kubernetes + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: release-1.34 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class V1DeviceTaint(BaseModel): + """ + The device this taint is attached to has the \"effect\" on any claim which does not tolerate the taint and, through the claim, to pods using the claim. + """ # noqa: E501 + effect: StrictStr = Field(description="The effect of the taint on claims that do not tolerate the taint and through such claims on the pods using them. Valid effects are NoSchedule and NoExecute. PreferNoSchedule as used for nodes is not valid here.") + key: StrictStr = Field(description="The taint key to be applied to a device. Must be a label name.") + time_added: Optional[datetime] = Field(default=None, description="TimeAdded represents the time at which the taint was added. Added automatically during create or update if not set.", alias="timeAdded") + value: Optional[StrictStr] = Field(default=None, description="The taint value corresponding to the taint key. Must be a label value.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["effect", "key", "timeAdded", "value"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V1DeviceTaint from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V1DeviceTaint from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "effect": obj.get("effect"), + "key": obj.get("key"), + "timeAdded": obj.get("timeAdded"), + "value": obj.get("value") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/src/k8/v1_device_toleration.py b/src/k8/v1_device_toleration.py new file mode 100644 index 0000000..018bd89 --- /dev/null +++ b/src/k8/v1_device_toleration.py @@ -0,0 +1,108 @@ +# coding: utf-8 + +""" + Kubernetes + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: release-1.34 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class V1DeviceToleration(BaseModel): + """ + The ResourceClaim this DeviceToleration is attached to tolerates any taint that matches the triple using the matching operator . + """ # noqa: E501 + effect: Optional[StrictStr] = Field(default=None, description="Effect indicates the taint effect to match. Empty means match all taint effects. When specified, allowed values are NoSchedule and NoExecute.") + key: Optional[StrictStr] = Field(default=None, description="Key is the taint key that the toleration applies to. Empty means match all taint keys. If the key is empty, operator must be Exists; this combination means to match all values and all keys. Must be a label name.") + operator: Optional[StrictStr] = Field(default=None, description="Operator represents a key's relationship to the value. Valid operators are Exists and Equal. Defaults to Equal. Exists is equivalent to wildcard for value, so that a ResourceClaim can tolerate all taints of a particular category.") + toleration_seconds: Optional[StrictInt] = Field(default=None, description="TolerationSeconds represents the period of time the toleration (which must be of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default, it is not set, which means tolerate the taint forever (do not evict). Zero and negative values will be treated as 0 (evict immediately) by the system. If larger than zero, the time when the pod needs to be evicted is calculated as