Kubeflow Dashboard

  • By Kubeflow Charmers
  • Ai Ml
Channel Revision Published Runs on
latest/stable 64 20 Jan 2022
Ubuntu 20.04
latest/beta 435 04 Oct 2023
Ubuntu 20.04
latest/edge 479 18 Feb 2024
Ubuntu 20.04
1.8/stable 454 21 Nov 2023
Ubuntu 20.04
1.8/edge 498 15 Apr 2024
Ubuntu 20.04
1.7/stable 439 09 Oct 2023
Ubuntu 20.04
1.7/beta 307 28 Mar 2023
Ubuntu 20.04
1.7/edge 439 28 Sep 2023
Ubuntu 20.04
1.6/stable 183 12 Dec 2022
Ubuntu 20.04
1.6/beta 154 14 Sep 2022
Ubuntu 20.04
1.6/edge 183 06 Dec 2022
Ubuntu 20.04
1.4/stable 70 30 Jun 2022
Ubuntu 20.04
1.4/edge 70 30 May 2022
Ubuntu 20.04
juju deploy kubeflow-dashboard
Show information

Platform:

charms.kubeflow_dashboard.v0.kubeflow_dashboard_links

KubeflowDashboardLinks Library This library implements data transfer for the kubeflow_dashboard_links interface used by Kubeflow Dashboard to implement the links relation. This relation enables applications to request a link on the Kubeflow Dashboard dynamically.

To enable an application to add a link to Kubeflow Dashboard, use the KubeflowDashboardLinksRequirer and DashboardLink classes included here as shown below. No additional action is required within the charm. On establishing the relation, the data will be sent to Kubeflow Dashboard to add the links. The links will be removed if the relation is broken.

Getting Started

To get started using the library, fetch the library with charmcraft.

cd some-charm
charmcraft fetch-lib charms.kubeflow_dashboard.v0.kubeflow_dashboard_links

Then in your charm, do:

from charms.kubeflow_dashboard.v0.kubeflow_dashboard_links import (
    KubeflowDashboardLinksRequirer,
    DashboardLink,
)
# ...

DASHBOARD_LINKS = [
    DashboardLink(
        text="Example Relative Link",
        link="/relative-link",
        type="item",
        icon="assessment",
        location="sidebar",
    ),
    DashboardLink(
        text="Example External Link",
        link="https://charmed-kubeflow.io/docs",
        type="item",
        icon="assessment",
        location="sidebar-external"
    ),
]

class SomeCharm(CharmBase):
  def __init__(self, *args):
    # ...
    self.kubeflow_dashboard_links = KubeflowDashboardLinksRequirer(
        charm=self,
        relation_name="links",  # use whatever you call the relation in your metadata.yaml
        DASHBOARD_LINKS
    )
    # ...

Representation of a Kubeflow Dashboard Link entry.

Arguments

text

The text shown for the link

link

The link (a relative link for location=sidebar or location=quick, eg: /mlflow, or a full URL for other locations, eg: http://my-website.com)

type

A type of sidebar entry (typically, "item")

icon

An icon for the link, from https://kevingleason.me/Polymer-Todo/bower_components/iron-icons/demo/index.html

location

Link's location on the dashboard. One of sidebar, sidebar_external, quick, and documentation.

Description

See https://www.kubeflow.org/docs/components/central-dash/customizing-menu/ for more details.

class KubeflowDashboardLinksUpdatedEvent

Description

Indicates the Kubeflow Dashboard link data was updated. None

class KubeflowDashboardLinksEvents

Description

Events for the Kubeflow Dashboard Links library. None

class KubeflowDashboardLinksProvider

Description

Relation manager for the Provider side of the Kubeflow Dashboard Sidebar relation.. None

Methods

KubeflowDashboardLinksProvider. __init__( self , charm: CharmBase , relation_name: str , refresh_event )

Relation manager for the Provider side of the Kubeflow Dashboard Links relation.

Arguments

charm

Charm this relation is being used by

relation_name

Name of this relation (from metadata.yaml)

refresh_event

List of BoundEvents that this manager should handle. Use this to update the data sent on this relation on demand.

Description

This relation manager subscribes to:

  • on[relation_name].relation_changed
  • any events provided in refresh_event

This library emits:

  • KubeflowDashboardLinksUpdatedEvent: when data received on the relation is updated

TODO: Should this class automatically subscribe to events, or should it optionally do that. The former is typical of charm libraries, the latter lets the user better control and visibility on how it is used.

Returns a list of all DashboardItems from related Applications.

Arguments

omit_breaking_app

If True and this is called during a link-relation-broken event, the remote app's data will be omitted. For more context, see: https://github.com/canonical/kubeflow-dashboard-operator/issues/124

location

If specified, return only links with this location. Else, returns all links.

Returns

List of DashboardLinks defining the dashboard links for all related applications.

Returns a JSON string of all DashboardItems from related Applications.

Arguments

omit_breaking_app

If True and this is called during a links-relation-broken event, the remote app's data will be omitted. For more context, see: https://github.com/canonical/kubeflow-dashboard-operator/issues/124

location

If specified, return only links with this location. Else, returns all links.

Returns

JSON string of all DashboardLinks for all related applications, each as dicts.

class KubeflowDashboardLinksRequirer

Description

Relation manager for the Requirer side of the Kubeflow Dashboard Links relation. None

Methods

KubeflowDashboardLinksRequirer. __init__( self , charm: CharmBase , relation_name: str , dashboard_links , refresh_event )

Relation manager for the Requirer side of the Kubeflow Dashboard Link relation.

Arguments

charm

Charm this relation is being used by

relation_name

Name of this relation (from metadata.yaml)

dashboard_links

List of DashboardLink objects to send over the relation

refresh_event

List of BoundEvents that this manager should handle. Use this to update the data sent on this relation on demand.

Description

This relation manager subscribes to:

  • on.leader_elected: because only the leader is allowed to provide this data, and relation_created may fire before the leadership election

  • on[relation_name].relation_created

  • any events provided in refresh_event

This library emits:

  • (nothing)

TODO: Should this class automatically subscribe to events, or should it optionally do that. The former is typical of charm libraries, the latter lets the user better control and visibility on how it is used.

def get_name_of_breaking_app(relation_name: str)

Returns breaking app name if called during RELATION_NAME-relation-broken and the breaking app name is available. # noqa

Description

Else, returns None.

Relation type and app name are inferred from juju environment variables.

Description

Returns a list of SidebarItems as a JSON string. None