import string
import re


def cleanup_str_for_k8s(value: str):
    """
    Clean up string so that it is kubernetes-compatible: remove special chars (except "-"), and
    convert all text to lower-case.

    Args:
        value (str): The string to clean up

    Returns:
        str: The kubernetes-compatible string
    """

    value = value.replace("_", "-")
    invalid_chars = string.punctuation.replace("-", "") + string.whitespace
    chars = re.escape(invalid_chars)
    new_value = re.sub(r"[" + chars + "]", "", value).lower()
    return new_value