- .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 named V1LoadBalancerIngress
representing a LoadBalancer ingress in Kubernetes. This class is part of the Kubernetes client library, which allows developers to interact with Kubernetes clusters using Python.
Class Structure and Attributes:
The class is auto-generated based on the Kubernetes API schema. It has several attributes:
hostname
(str): Represents the hostname of the load balancer ingress point. This is typically used for DNS-based load balancers (e.g., AWS).ip
(str): Represents the IP address of the load balancer ingress point. This is typically used for IP-based load balancers (e.g., GCE, OpenStack).ip_mode
(str): Specifies how the load balancer IP behaves, with possible values “VIP” or “Proxy”. “VIP” indicates traffic is delivered to the node with the destination set to the load balancer’s IP and port. “Proxy” indicates traffic is delivered to the node or pod using the node’s IP and port or the pod’s IP and port, respectively.ports
(list[V1PortStatus]): This attribute is a list ofV1PortStatus
objects, each representing a port exposed by the load balancer.
Key Functions:
__init__(self, hostname=None, ip=None, ip_mode=None, ports=None, local_vars_configuration=None):
: This is the constructor for the class. It initializes the attributes with the provided values. Thelocal_vars_configuration
argument is used for configuration settings of the client library.to_dict(self):
: Converts the object’s attributes into a Python dictionary representation, useful for serializing the object to JSON.to_str(self):
: Converts the object into a string representation (usingpprint.pformat
), helpful for debugging and printing.__repr__(self):
: Used for theprint
andpprint
functions to display the object’s string representation.__eq__(self, other):
: Compares the object with another object, returningTrue
if they have the same attributes.__ne__(self, other):
: Compares the object with another object, returningTrue
if they are not equal.
Usage Example:
from kubernetes.client.models.v1_load_balancer_ingress import V1LoadBalancerIngress
ingress = V1LoadBalancerIngress(
hostname="my-service.example.com",
ip="10.10.10.10",
ip_mode="Proxy",
ports=[
{"port": 80, "protocol": "TCP"}
]
)
print(ingress.to_dict()) # Prints a dictionary representation of the object
Summary:
The V1LoadBalancerIngress
class defines a Python representation of a Kubernetes load balancer ingress, allowing developers to manipulate and access information about load balancer ingress points through the Kubernetes client library.
Graph
The graph shows the usage of functions within the codebase.
Select a code symbol to view it's graph