MAIA.maia_fn module#

MAIA.maia_fn.convert_username_to_jupyterhub_username(username)[source]#

Convert a username to a JupyterHub-compatible username.

Parameters:

username (str) – The original username.

Returns:

str – The JupyterHub-compatible username.

MAIA.maia_fn.create_config_map_from_data(data, config_map_name, namespace, kubeconfig_dict, data_key='values.yaml')[source]#

Create a ConfigMap on a Kubernetes Cluster.

Parameters:
  • data (str) – String containing the content of the ConfigMap to dump.

  • config_map_name (str) – ConfigMap name.

  • namespace (str) – Namespace where to create the ConfigMap.

  • data_key (str, optional) – Value to use as the filename for the content in the ConfigMap.

  • kubeconfig_dict (dict) – Kube Configuration dictionary for Kubernetes cluster authentication.

MAIA.maia_fn.deploy_mlflow(cluster_config, user_config, config_folder, mysql_config=None, minio_config=None)[source]#

Deploy an MLflow instance on a Kubernetes cluster using Helm.

Parameters:
  • cluster_config (dict) – Configuration dictionary for the Kubernetes cluster.

  • user_config (dict) – Configuration dictionary for the user, including group_ID.

  • config_folder (str) – Path to the folder where configuration files will be stored.

  • mysql_config (dict, optional) – Configuration dictionary for MySQL, including mysql_user and mysql_password. Defaults to None.

  • minio_config (dict, optional) – Configuration dictionary for MinIO, including console_access_key and console_secret_key. Defaults to None.

Returns:

dict – A dictionary containing deployment details such as namespace, release name, chart name, repository URL, chart version, and path to the values file.

MAIA.maia_fn.deploy_mysql(cluster_config, user_config, config_folder, mysql_configs)[source]#

Deploy a MySQL instance on a Kubernetes cluster using Helm.

Parameters:
  • cluster_config (dict) – Configuration dictionary for the cluster, including storage class.

  • user_config (dict) – Configuration dictionary for the user, including group ID.

  • config_folder (str) – Path to the folder where configuration files will be stored.

  • mysql_configs (dict) – Configuration dictionary for MySQL, including user, password, and other settings.

Returns:

dict – A dictionary containing deployment details such as namespace, release name, chart name, repository URL, version, and values file path.

MAIA.maia_fn.deploy_oauth2_proxy(cluster_config, user_config, config_folder=None)[source]#

Deploy an OAuth2 Proxy using the provided cluster and user configurations.

Parameters:
  • cluster_config (dict) –

    Configuration dictionary for the cluster. Expected keys include:
    • ”keycloak”: A dictionary with “issuer_url”, “client_id”, and “client_secret”.

    • ”domain”: The domain name for the cluster.

    • ”url_type”: The type of URL, either “subpath” or other.

    • ”storage_class”: The storage class for Redis.

    • ”nginx_cluster_issuer” (optional): The cluster issuer for NGINX.

    • ”traefik_resolver” (optional): The resolver for Traefik.

  • user_config (dict) –

    Configuration dictionary for the user. Expected keys include:
    • ”group_ID”: The group ID for the user.

    • ”group_subdomain”: The subdomain for the user’s group.

  • config_folder (str, optional) – The folder path where the configuration files will be saved. Defaults to None.

Returns:

dict

A dictionary containing deployment details:
  • ”namespace”: The namespace for the deployment.

  • ”release”: The release name for the deployment.

  • ”chart”: The chart name for the deployment.

  • ”repo”: The repository URL for the chart.

  • ”version”: The chart version.

  • ”values”: The path to the generated values YAML file.

MAIA.maia_fn.encode_docker_registry_secret(docker_server, docker_username, docker_password)[source]#

Encode Docker registry credentials into a base64-encoded string.

Parameters:
  • docker_server (str) – The Docker registry server.

  • docker_username (str) – The Docker registry username.

  • docker_password (str) – The Docker registry password.

Returns:

str – The base64-encoded Docker registry credentials.

MAIA.maia_fn.get_ssh_ports(n_requested_ports, port_type, ip_range, maia_metallb_ip=None)[source]#

Retrieve a list of available SSH ports based on the specified criteria.

Parameters:
  • n_requested_ports (int) – The number of SSH ports requested.

  • port_type (str) – The type of port to search for (‘LoadBalancer’ or ‘NodePort’).

  • ip_range (tuple) – A tuple specifying the range of IPs to search within (start, end).

  • maia_metallb_ip (str, optional) – The specific IP address to match for ‘LoadBalancer’ type. Defaults to None.

Returns:

  • list – A list of available SSH ports that meet the specified criteria.

  • None – If an error occurs during the process.