- .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 V1PodAntiAffinity
that represents the PodAntiAffinity object in the Kubernetes API.
Key Concepts:
- PodAntiAffinity: Defines how a pod should be scheduled away from other pods.
- PreferredDuringSchedulingIgnoredDuringExecution: Specifies an anti-affinity rule that should be preferred during scheduling but is not required. The scheduler prioritizes nodes that satisfy these rules.
- RequiredDuringSchedulingIgnoredDuringExecution: Specifies an anti-affinity rule that must be satisfied during scheduling. If a node doesn’t meet these rules, the pod won’t be scheduled on it.
Class Breakdown:
openapi_types
: A dictionary that maps attribute names to their data types according to the OpenAPI specification.attribute_map
: A dictionary that maps attribute names to their corresponding JSON keys in the API response.__init__
: The constructor initializes the object with thepreferred_during_scheduling_ignored_during_execution
andrequired_during_scheduling_ignored_during_execution
properties.preferred_during_scheduling_ignored_during_execution
: A list ofV1WeightedPodAffinityTerm
objects, each representing a preferred anti-affinity rule.required_during_scheduling_ignored_during_execution
: A list ofV1PodAffinityTerm
objects, each representing a required anti-affinity rule.to_dict
: Converts the object into a dictionary representation. This is useful for serialization and API interactions.to_str
: Converts the object into a string representation. This is helpful for debugging and logging.__repr__
: Returns the string representation of the object.__eq__
: Compares two objects for equality based on their dictionary representation.__ne__
: Compares two objects for inequality based on their dictionary representation.
Purpose:
This class is used by the Kubernetes Python client to interact with the Kubernetes API regarding PodAntiAffinity objects. Developers can create instances of V1PodAntiAffinity
to define anti-affinity rules for pods and then use the client to send requests to the API to configure pod scheduling accordingly.
Graph
The graph shows the usage of functions within the codebase.
Select a code symbol to view it's graph