- .github
- devel
- doc
-
examples
-
dynamic-client
-
notebooks
-
watch
-
yaml_dir
- README.md
- __init__.py
- annotate_deployment.py
- api_discovery.py
- apply_from_dict.py
- apply_from_directory.py
- apply_from_single_file.py
- cluster_scoped_custom_object.py
- cronjob_crud.py
- deployment_create.py
- deployment_crud.py
- duration-gep2257.py
- in_cluster_config.py
- ingress_create.py
- job_crud.py
- multiple_clusters.py
- namespaced_custom_object.py
- node_labels.py
- out_of_cluster_config.py
- pick_kube_config_context.py
- pod_config_list.py
- pod_exec.py
- pod_portforward.py
- remote_cluster.py
- rollout-daemonset.py
- rollout-statefulset.py
-
dynamic-client
- kubernetes
- scripts
- .gitignore
- CHANGELOG.md
- CONTRIBUTING.md
- LICENSE
- MANIFEST.in
- OWNERS
- README.md
- SECURITY_CONTACTS
- code-of-conduct.md
- codecov.yml
- requirements.txt
- setup.cfg
- setup.py
- test-requirements.txt
- tox.ini
Explanation
This test suite focuses on the DynamicClient
class and its ability to dynamically discover and interact with Kubernetes API resources. Here’s a breakdown:
test_init_cache_from_file
:
- This test checks if the
DynamicClient
loads its resource cache from a file. - It creates two
DynamicClient
instances and retrieves theNode
resource usingclient.resources.get()
. - The test ensures that the modification timestamp of the cache file remains unchanged between the two instances. This indicates that the cache is loaded from the file and not being rewritten.
test_cache_decoder_resource_and_subresource
:
- This test validates the cache decoding process for both resources and their subresources.
- It first invalidates the cache using
client.resources.invalidate_cache()
. - Then, it creates two
DynamicClient
instances. - The first instance retrieves the
Deployment
resource, causing the cache to be populated from the Kubernetes API. - The second instance retrieves the
Deployment
resource, now using the cached data. - The test verifies that the two retrieved
Deployment
instances (one from API, one from cache) are identical. - Finally, it asserts that the
status
subresource of the twoDeployment
instances are also identical.
Overall, this test suite confirms that DynamicClient
correctly utilizes a cached file for resource discovery and that this cache accurately represents the actual resource data from the Kubernetes API. The caching behavior ensures efficiency by reducing the number of API calls for repeated requests.
Graph
The graph shows the usage of functions within the codebase.
Select a code symbol to view it's graph