- .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 code defines a Python class V1ResourceRequirements
that represents resource requirements for a container in Kubernetes. The class is automatically generated from the Kubernetes OpenAPI specification and includes attributes for defining resource limits and requests.
Attributes:
claims
: A list of resource names from thespec.resourceClaims
field that are used by the container. This attribute is an alpha feature that requires theDynamicResourceAllocation
feature gate to be enabled. It is immutable and can only be set for containers.limits
: A dictionary mapping resource names to their maximum allowed quantities. This specifies the maximum resources the container can consume.requests
: A dictionary mapping resource names to their minimum required quantities. This specifies the minimum resources the container needs to function. If not specified, the container defaults to the value oflimits
if available, or an implementation-defined value.
Methods:
__init__
: The constructor takes optional arguments forclaims
,limits
, andrequests
and initializes the object with the specified values.claims
: A property that retrieves or sets theclaims
attribute.limits
: A property that retrieves or sets thelimits
attribute.requests
: A property that retrieves or sets therequests
attribute.to_dict
: Converts the object to a dictionary representation for serialization.to_str
: Returns a string representation of the object usingpprint.pformat
.__repr__
: Returns a string representation of the object for use inprint
andpprint
.__eq__
: Compares twoV1ResourceRequirements
objects based on their attribute values.__ne__
: Compares twoV1ResourceRequirements
objects based on their attribute values, returning True if they are not equal.
The code adheres to the Kubernetes API conventions and is used to represent resource constraints for containers within a Kubernetes cluster. Developers can leverage this class to programmatically configure resource requirements for their containerized applications.
Graph
The graph shows the usage of functions within the codebase.
Select a code symbol to view it's graph