Minikube Module

class emulations.minikube.PortForwardProcess(container_name: str, event: Event, commands: list, pod_names: list, label_selectors: list, namespaces: list)

Bases: Process

A multiprocessing Process class for managing port forwarding and pod readiness checks.

Args:

  • container_name (str): The name of the Docker container.

  • event (multiprocessing.Event): An event to signal when port forwarding is complete.

  • commands (list): A list of kubectl port-forward commands to execute.

  • pod_names (list): A list of pod names corresponding to the commands.

  • label_selectors (list): A list of label selectors for pods to check readiness.

  • namespaces (list): A list of namespaces for the pods.

Methods:

  • stop(): Stop the port forwarding process.

  • check_pod_status(label_selector: str, namespace: str) -> bool: Check if pods are ready.

check_pod_status(label_selector: str, namespace: str) bool
run()

Method to be run in sub-process; can be overridden in sub-class

stop()
emulations.minikube.enable_minikube_addons(container_name: str)

Enable Minikube addons for metrics-server, dashboard, ingress, ingress-dns, and list enabled addons.

Args: - container_name (str): The name of the Docker container.

Returns: None

emulations.minikube.get_minikube_ip(container_name: str)

Get the IP address of the Minikube cluster.

Args: - container_name (str): The name of the Docker container.

Returns: str: The IP address of the Minikube cluster.

emulations.minikube.get_public_port(container_name: str, private_port: int)

Get the public port associated with a private port in a Docker container.

Args: - container_name (str): The name of the Docker container. - private_port (int): The private port number.

Returns: int: The public port number, or None if not found.

emulations.minikube.kubectl_config(container_name: str, public_port: int)

Configure kubectl to connect to the Minikube cluster.

Args:

  • container_name (str): The name of the Docker container.

  • public_port (int): The public port of the Minikube cluster.

Returns: None

emulations.minikube.setup_prometheus_monitoring(container_name: str)

Set up Prometheus monitoring in the Kubernetes cluster.

Args: - container_name (str): The name of the Docker container.

Returns: None

emulations.minikube.skooner_get_deployment_token(container_name: str)

Get the Skooner deployment token.

Args: - container_name (str): The name of the Docker container.

Returns: str: The Skooner deployment token.

emulations.minikube.start_kubectl_proxy(event2)

Start kubectl proxy in the background.

Args: - event2 (multiprocessing.Event): An event to signal when kubectl proxy is running.

Returns: multiprocessing.Process: The process running kubectl proxy.

emulations.minikube.terminate_kubectl_proxy()

Terminate the kubectl proxy process.

Returns: None

This module provides functions for managing Minikube, enabling addons, setting up Prometheus monitoring, getting Skooner deployment tokens, configuring kubectl, and starting kubectl proxy.