def object_sort_key(obj):
    """
    Define a predictable sort ordering for Kubernetes objects.

    This should be the same ordering that Kubernetes itself imposes.
    """
    return getattr(obj.metadata, 'namespace', None), obj.metadata.name
