Previously, when connecting to a Kuberay cluster with Basic Authentication, I would do something like:
import ray
import base64
def get_metadata():
"""
Get authentication header metadata for ray.util.connect
"""
headers = {"Authorization": f"Basic {base64.b64encode(bytes('my_username:my_password', encoding='ascii')).decode()}"}
return [(key.lower(), value) for key, value in headers.items()]
ray.util.connect(
"my-ray-cluster.io:443",
metadata=get_metadata(),
secure=True,
)
However, according to the Ray Core 2.0 Changes docs, ray.util.connect
is deprecated and I should be using ray.init
instead. How do I pass the metadata for Basic Authentication when using ray.init
?