- .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 Python code defines a class V1VolumeMount
representing a Kubernetes Volume Mount. This class is part of the Kubernetes client library for Python, which provides a way to interact with Kubernetes APIs.
Here’s a breakdown of the key aspects:
Class Structure:
openapi_types
: A dictionary mapping attribute names to their corresponding data types. This is used for type checking and serialization.attribute_map
: A dictionary mapping attribute names to their corresponding JSON keys in the API definition. This facilitates serialization and deserialization.- Constructor: The constructor takes several optional parameters, including
mount_path
(required),mount_propagation
,name
(required),read_only
,recursive_read_only
,sub_path
, andsub_path_expr
. These parameters are used to initialize the attributes of theV1VolumeMount
object. - Properties: Each attribute has a getter and setter method. These methods allow accessing and modifying the values of the attributes.
to_dict
: This method converts the object’s attributes into a dictionary format, facilitating serialization.to_str
: This method converts the dictionary representation into a string, useful for debugging and printing.__repr__
: This method returns the string representation of the object, typically used for debugging.__eq__
and__ne__
: These methods define how equality and inequality are checked betweenV1VolumeMount
objects.
Attributes:
mount_path
(str): Path inside the container where the volume is mounted. This is required and cannot contain colons.mount_propagation
(str): Determines how mounts are propagated from the host to the container and vice versa. Defaults toNone
. This field is beta in 1.10. WhenRecursiveReadOnly
is set toIfPossible
orEnabled
,MountPropagation
must beNone
or unspecified (which defaults toNone
).name
(str): Must match the name of the volume being mounted. This is required.read_only
(bool): Specifies whether the mount should be read-only. Defaults toFalse
.recursive_read_only
(str): Specifies whether read-only mounts should be handled recursively. IfReadOnly
isFalse
, this field has no meaning and must be unspecified. IfReadOnly
isTrue
, and this field is set toDisabled
, the mount is not made recursively read-only. If this field is set toIfPossible
, the mount is made recursively read-only, if it is supported by the container runtime. If this field is set toEnabled
, the mount is made recursively read-only if it is supported by the container runtime, otherwise the pod will not be started and an error will be generated to indicate the reason. If this field is set toIfPossible
orEnabled
,MountPropagation
must be set toNone
(or be unspecified, which defaults toNone
). If this field is not specified, it is treated as an equivalent ofDisabled
.sub_path
(str): Path within the volume to be mounted. Defaults to an empty string (volume’s root).sub_path_expr
(str): Expanded path within the volume to be mounted. Similar tosub_path
, but environment variable references ($(VAR_NAME)
) are expanded using the container’s environment. Defaults to an empty string (volume’s root).sub_path_expr
andsub_path
are mutually exclusive.
In Summary:
The V1VolumeMount
class encapsulates information about how a Kubernetes volume is mounted within a container. It provides a standardized way to represent these details, facilitating communication with the Kubernetes API.
Graph
The graph shows the usage of functions within the codebase.
Select a code symbol to view it's graph