Skip to content

Commit 5bb085b

Browse files
authored
feat: Add typing and split fake client code (#2438)
* feat: Add typing and split fake client code * feat: Add typing and split fake client code * feat: Add typing and split fake client code * feat: Add typing and split fake client code * Use Union for type * Use Union for type * improve the client code
1 parent d76c4d4 commit 5bb085b

File tree

98 files changed

+743471
-331673
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+743471
-331673
lines changed

.flake8

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ fcn_exclude_functions =
6767
add_row,
6868
get_args,
6969
get_type_hints,
70+
shutil,
7071

7172
enable-extensions =
7273
FCN,

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ repos:
4242
[
4343
"--exclude-files=class_generator/schema/*",
4444
"--exclude-files=class_generator/__k8s-openapi-.*.json",
45+
"--exclude-files=fake_kubernetes_client/__resources-mappings.json",
4546
]
4647

4748
- repo: https://github.com/astral-sh/ruff-pre-commit

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ From pypi:
4141
pip install openshift-python-wrapper --user
4242
```
4343

44+
## Fake Kubernetes Client
45+
46+
The project includes a comprehensive fake Kubernetes client for testing without a real cluster. See [Fake Kubernetes Client documentation](fake_kubernetes_client/README.md) for details.
47+
4448
## Release new version
4549

4650
### requirements
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v1.32.3
1+
v1.32.5

class_generator/class_generator.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,14 @@ def update_kind_schema():
241241
client=client, newer_cluster_version=same_or_newer_version, schema_definition_file=ocp_openapi_json_file
242242
)
243243

244+
# Copy the resources mapping file to fake_kubernetes_client for the fake client to use
245+
fake_client_mappings = Path("fake_kubernetes_client/__resources-mappings.json")
246+
try:
247+
shutil.copy2(RESOURCES_MAPPING_FILE, fake_client_mappings)
248+
except (OSError, IOError):
249+
# Don't fail the entire process if copy fails
250+
pass
251+
244252

245253
def convert_camel_case_to_snake_case(name: str) -> str:
246254
"""

class_generator/schema/__not-kind.txt

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1069,4 +1069,19 @@ io.external-secrets.v1alpha1.SecretStoreList
10691069
org.kubeflow.pipelines.v2beta1.PipelineVersionList
10701070
io.opendatahub.platform.components.v1alpha1.LlamaStackOperatorList
10711071
io.llamastack.v1alpha1.LlamaStackDistributionList
1072-
org.kubeflow.pipelines.v2beta1.PipelineList
1072+
org.kubeflow.pipelines.v2beta1.PipelineList
1073+
io.konveyor.forklift.v1beta1.VSphereXcopyVolumePopulatorList
1074+
io.k8s.networking.gateway.v1beta1.ReferenceGrantList
1075+
io.k8s.networking.gateway.v1beta1.HTTPRouteList
1076+
io.k8s.networking.gateway.v1beta1.HTTPRoute
1077+
io.k8s.networking.gateway.v1beta1.GatewayList
1078+
io.k8s.networking.gateway.v1beta1.GatewayClassList
1079+
io.k8s.networking.gateway.v1beta1.GatewayClass
1080+
io.k8s.networking.gateway.v1beta1.Gateway
1081+
io.k8s.networking.gateway.v1.HTTPRouteList
1082+
io.k8s.networking.gateway.v1.GatewayList
1083+
io.k8s.networking.gateway.v1.GatewayClassList
1084+
io.k8s.networking.gateway.v1.GRPCRouteList
1085+
io.openshift.ocs.v1.StorageAutoScalerList
1086+
io.openshift.machineconfiguration.v1.MachineOSConfigList
1087+
io.openshift.machineconfiguration.v1.MachineOSBuildList

0 commit comments

Comments
 (0)