Skip to content

Support the new app.kubernetes.io labels in a backward compatible way #155

@consideRatio

Description

@consideRatio

The JupyterHub Helm chart and KubeSpawner now provides app.kubernetes.io labels that supersedes the old app and component labels. So instead of app one can use app.kubernetes.io/name and instead of component one can use app.kubernetes.io/component.

I figure we could make the dashboards work even without scraping details for the labels app and component. So for example, we would transition like this for the panels that references label_app:

 # Sum up all running user pods by namespace
 sum(
   # Grab a list of all running pods.
   # The group aggregator always returns "1" for the number of times each
   # unique label appears in the time series. This is desirable for this
   # use case because we're merely identifying running pods by name,
   # not how many times they might be running.
   group(
     kube_pod_status_phase{phase="Running"}
   ) by (pod)
-  * on (pod) group_right() group(
-    kube_pod_labels{label_app="jupyterhub", label_component="singleuser-server"}
-  ) by (namespace, pod)
+  * on (pod) group_right() (
+    group(
+      kube_pod_labels{label_app_kubernetes_io_name="jupyterhub", label_app_kubernetes_io_component="singleuser-server"}
+    ) by (namespace, pod)
+    or
+    group(
+      kube_pod_labels{label_app="jupyterhub", label_component="singleuser-server"}
+    ) by (namespace, pod)
+  )
 ) by (namespace)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions