Dask lab extension iframes are not resolving the dashboard server

I have a local Harvester OS (K8s cluster) running with daskhub installed
I can create a gateway cluster in the single user jupyter notebook and connect it to the generated dashboard link
in order to get the buttons to show up I have had to add “http://proxy-public” to the generated dashboard link
the dask lab extension buttons then show up
however when I click on one, such as workers, the iframe element it brings up says “proxy-public’s server ip address could not be found”
if I manually remove “http://proxy-public” from that in widget’s iframe’s src parameter its content shows up as expected

one of these things seems likely to be true:

  • my gateway cluster is not configured correctly
  • my daskhub ingress logic is not configured correctly (its pretty close to the vanilla implementation)
  • dask lab extension is broken

I can’t speak to your specific setup, but historically, getting the labextension working with dask gateway has been challenging. Depending on how your ingress is set up, you might want to try setting this setting to true:

from pprint import pprint
import os
from dask_gateway import Gateway, GatewayCluster, JupyterHubAuth

# import logging
# logger = logging.getLogger("distributed.client")
# logger.setLevel(logging.DEBUG)

def shutdown_all_clusters(config):
    client = Gateway(address=config['address'], auth='jupyterhub')
    for cluster in client.list_clusters():
        print('shutdown', cluster.name)
        client.stop_cluster(cluster.name)

def get_options(default_image='pangeo/base-notebook:2022.08.19'):
    # image = os.environ.get('DASK_GATEWAY__CLUSTER__OPTIONS__IMAGE', default_image)
    options = Gateway().cluster_options()
    options['image'] = default_image
    return options

def get_config():
     return dict(
        address=os.environ['DASK_GATEWAY__ADDRESS'],
        proxy_address=os.environ['DASK_GATEWAY__PROXY_ADDRESS'],
        public_address=os.environ['DASK_GATEWAY__PUBLIC_ADDRESS'],
        cluster_options=get_options(),
        auth = JupyterHubAuth(
            api_token=os.environ['JUPYTERHUB_API_TOKEN']
        ),
    )

def write_labextension_yaml(config, source='/home/jovyan/.config/dask/labextension.yaml'):
    content = f'''
labextension:
  factory:
    module: 'dask_gateway'
    class: 'GatewayCluster'
    kwargs:
      address: "{config['address']}"
      proxy_address: "{config['proxy_address']}"
      public_address: "{config['public_address']}"
      cluster_options:
        image: "{config['cluster_options']['image']}"
      auth:
        jupyterhub:
          api_token: "{config['auth'].api_token}"
'''[1:-1]
    with open(source, 'w') as f:
        f.write(content)

options = get_options()
config = get_config()
pprint(config)
print()
shutdown_all_clusters(config)
# write_labextension_yaml(config)
{'address': 'http://proxy-public/services/dask-gateway',
 'auth': <dask_gateway.auth.JupyterHubAuth object at 0x7ff8b060b040>,
 'cluster_options': <dask_gateway.options.Options object at 0x7ff809b5e280>,
 'proxy_address': 'gateway://traefik-daskhub-dask-gateway.core:80',
 'public_address': '/services/dask-gateway/'}

prepending the public domain into public_address fixed it
hub ingress set to “jupyter.bravo”

def get_config(
    domain='jupyter.bravo',
    image='pangeo/base-notebook:2022.08.19',
):
    options = Gateway().cluster_options()
    options['image'] = image
    return dict(
        address=os.environ['DASK_GATEWAY__ADDRESS'],
        proxy_address=os.environ['DASK_GATEWAY__PROXY_ADDRESS'],
        public_address=f'http://{domain}' + os.environ['DASK_GATEWAY__PUBLIC_ADDRESS'],
        cluster_options=options,
        auth = JupyterHubAuth(
            api_token=os.environ['JUPYTERHUB_API_TOKEN']
        )
    )