From f5b8bbbd505f03d75cf07cf670d3e6e42fe6d4b0 Mon Sep 17 00:00:00 2001 From: threcc Date: Wed, 17 Jun 2026 14:26:55 +0200 Subject: [PATCH] Add LLMInferenceServiceConfig resource class Signed-off-by: threcc --- .../llm_inference_service_config.py | 90 +++++++++++++++++++ class_generator/tests/test_class_generator.py | 9 +- ocp_resources/llm_inference_service_config.py | 90 +++++++++++++++++++ 3 files changed, 185 insertions(+), 4 deletions(-) create mode 100644 class_generator/tests/manifests/LLMInferenceServiceConfig/llm_inference_service_config.py create mode 100644 ocp_resources/llm_inference_service_config.py diff --git a/class_generator/tests/manifests/LLMInferenceServiceConfig/llm_inference_service_config.py b/class_generator/tests/manifests/LLMInferenceServiceConfig/llm_inference_service_config.py new file mode 100644 index 0000000000..2549ade732 --- /dev/null +++ b/class_generator/tests/manifests/LLMInferenceServiceConfig/llm_inference_service_config.py @@ -0,0 +1,90 @@ +# Generated using https://github.com/RedHatQE/openshift-python-wrapper/blob/main/scripts/resource/README.md + + +from typing import Any + +from ocp_resources.resource import NamespacedResource + + +class LLMInferenceServiceConfig(NamespacedResource): + """ + No field description from API + """ + + api_group: str = NamespacedResource.ApiGroup.SERVING_KSERVE_IO + + def __init__( + self, + base_refs: list[Any] | None = None, + model: dict[str, Any] | None = None, + parallelism: dict[str, Any] | None = None, + prefill: dict[str, Any] | None = None, + replicas: int | None = None, + router: dict[str, Any] | None = None, + template: dict[str, Any] | None = None, + worker: dict[str, Any] | None = None, + **kwargs: Any, + ) -> None: + r""" + Args: + base_refs (list[Any]): No field description from API + + model (dict[str, Any]): No field description from API + + parallelism (dict[str, Any]): No field description from API + + prefill (dict[str, Any]): No field description from API + + replicas (int): No field description from API + + router (dict[str, Any]): No field description from API + + template (dict[str, Any]): No field description from API + + worker (dict[str, Any]): No field description from API + + """ + super().__init__(**kwargs) + + self.base_refs = base_refs + self.model = model + self.parallelism = parallelism + self.prefill = prefill + self.replicas = replicas + self.router = router + self.template = template + self.worker = worker + + def to_dict(self) -> None: + + super().to_dict() + + if not self.kind_dict and not self.yaml_file: + self.res["spec"] = {} + _spec = self.res["spec"] + + if self.base_refs is not None: + _spec["baseRefs"] = self.base_refs + + if self.model is not None: + _spec["model"] = self.model + + if self.parallelism is not None: + _spec["parallelism"] = self.parallelism + + if self.prefill is not None: + _spec["prefill"] = self.prefill + + if self.replicas is not None: + _spec["replicas"] = self.replicas + + if self.router is not None: + _spec["router"] = self.router + + if self.template is not None: + _spec["template"] = self.template + + if self.worker is not None: + _spec["worker"] = self.worker + + # End of generated code diff --git a/class_generator/tests/test_class_generator.py b/class_generator/tests/test_class_generator.py index 4bd6ae1bc8..16aa94c542 100644 --- a/class_generator/tests/test_class_generator.py +++ b/class_generator/tests/test_class_generator.py @@ -95,16 +95,17 @@ def test_parse_explain(tmp_path: Path) -> None: "DNS", "Deployment", "ImageContentSourcePolicy", + "Ingress", "Machine", "NMState", - "Pod", - "Secret", - "ServiceMeshMember", - "Ingress", "OAuth", "Pipeline", + "Pod", "RouteAdvertisements", + "Secret", + "ServiceMeshMember", "ServingRuntime", + "LLMInferenceServiceConfig", ] failures: list[tuple[str, str]] = [] diff --git a/ocp_resources/llm_inference_service_config.py b/ocp_resources/llm_inference_service_config.py new file mode 100644 index 0000000000..2549ade732 --- /dev/null +++ b/ocp_resources/llm_inference_service_config.py @@ -0,0 +1,90 @@ +# Generated using https://github.com/RedHatQE/openshift-python-wrapper/blob/main/scripts/resource/README.md + + +from typing import Any + +from ocp_resources.resource import NamespacedResource + + +class LLMInferenceServiceConfig(NamespacedResource): + """ + No field description from API + """ + + api_group: str = NamespacedResource.ApiGroup.SERVING_KSERVE_IO + + def __init__( + self, + base_refs: list[Any] | None = None, + model: dict[str, Any] | None = None, + parallelism: dict[str, Any] | None = None, + prefill: dict[str, Any] | None = None, + replicas: int | None = None, + router: dict[str, Any] | None = None, + template: dict[str, Any] | None = None, + worker: dict[str, Any] | None = None, + **kwargs: Any, + ) -> None: + r""" + Args: + base_refs (list[Any]): No field description from API + + model (dict[str, Any]): No field description from API + + parallelism (dict[str, Any]): No field description from API + + prefill (dict[str, Any]): No field description from API + + replicas (int): No field description from API + + router (dict[str, Any]): No field description from API + + template (dict[str, Any]): No field description from API + + worker (dict[str, Any]): No field description from API + + """ + super().__init__(**kwargs) + + self.base_refs = base_refs + self.model = model + self.parallelism = parallelism + self.prefill = prefill + self.replicas = replicas + self.router = router + self.template = template + self.worker = worker + + def to_dict(self) -> None: + + super().to_dict() + + if not self.kind_dict and not self.yaml_file: + self.res["spec"] = {} + _spec = self.res["spec"] + + if self.base_refs is not None: + _spec["baseRefs"] = self.base_refs + + if self.model is not None: + _spec["model"] = self.model + + if self.parallelism is not None: + _spec["parallelism"] = self.parallelism + + if self.prefill is not None: + _spec["prefill"] = self.prefill + + if self.replicas is not None: + _spec["replicas"] = self.replicas + + if self.router is not None: + _spec["router"] = self.router + + if self.template is not None: + _spec["template"] = self.template + + if self.worker is not None: + _spec["worker"] = self.worker + + # End of generated code