def METHOD_NAME(self, container: V1Pod) -> str:
    """Get the pod's main container name.
    The main container name is determined from the value of `CN_CONTAINER_MAIN_NAME`
    environment variable set in the pod.
    If the value is empty, fallback to the first container inside the pod.
    Args:
        container: Pod object.
    """
    name = ""
    for cntr in container.spec.containers:
        if not cntr.env:
            continue
        for env in cntr.env:
            if env.name == "CN_CONTAINER_MAIN_NAME":
                name = env.value
                break
    # add fallback (if needed)
    return name or container.spec.containers[0].name