Sync KubeDB ResourceDashboards with the dashboard charts - #668
Merged
Conversation
Dashboards were missing or incomplete for several KubeDB kinds, so RenderDashboard returned an empty list for them. Titles taken from kubedb.dev/installer charts/kubedb-grafana-dashboards (helm-rendered GrafanaDashboard .spec.model.title). Filled in (were dashboards: null): Memcached, PerconaXtraDB, PgBouncer, RedisSentinel (v1 and v1alpha2) and Weaviate (v1alpha2). Completed: Kafka gains Summary and Pod, MariaDB gains Standard Replication, Postgres gains Remote Replica. Added kafka.kubedb.com/v1alpha1/connectclusters.yaml for the three Kafka / ConnectCluster dashboards. Conditions use spec.topology.mode for MariaDB (enum is MariaDBReplication|GaleraCluster) and spec.remoteReplica for Postgres. Signed-off-by: Arnob kumar saha <arnob@appscode.com>
hub/resourcetabledefinitions/core.k8s.appscode.com/v1alpha1/kubedb/podviews-*.yaml reference 28 <resource>-pod ResourceDashboards but only 7 existed, so the Dashboard column in those pod views failed to resolve. Adds the 17 v1alpha2 dashboards that the charts ship a Pod dashboard for, plus v1 copies for perconaxtradbs and pgbouncers, which also exist in kubedb.com/v1. db2s, documentdbs, hanadbs and milvuses stay unresolved: neither dashboard chart ships a Pod dashboard for them. Signed-off-by: Arnob kumar saha <arnob@appscode.com>
Neither kubedb-grafana-dashboards nor kubedb-perses-dashboards ships a HanaDB / Pod or a Milvus / Pod dashboard, so those two entries never resolved. ZooKeeper ships Ensemble, not Database. Signed-off-by: Arnob kumar saha <arnob@appscode.com>
Every entry passed namespace and app regardless of the dashboard's own templating list, so the values were inert wherever the dashboard declares something else. Variables per dashboard come from helm-rendering charts/kubedb-grafana-dashboards and reading .spec.model.templating.list. Cassandra Database/Pod use cluster and datacenter, HanaDB Database uses node_name/node_ip/sid/instance_number/database_name, Memcached Database uses job, Memcached Pod and Ignite Pod use their own names, Ignite Database has app but no namespace, Milvus Database has namespace but no app. Ignite Pod declares job, cacheName and node but no pod, so kubedb.com-v1alpha2-ignites-pod cannot scope to a pod. The dashboard needs a pod variable before that entry can do anything useful. Signed-off-by: Arnob kumar saha <arnob@appscode.com>
…tion The condition was replicas != 1, which is also true for a spec.topology.mode of MariaDBReplication, so both Galera-Cluster and Standard Replication rendered for a standard-replication cluster. spec.topology is optional and a MariaDB with replicas > 1 and no topology is Galera, so the default for the missing key is GaleraCluster. Rendered through pkg/shared.RenderTemplate against unstructured input for replicas=1, replicas=3 without topology, replicas=3 GaleraCluster and replicas=3 MariaDBReplication. Signed-off-by: Arnob kumar saha <arnob@appscode.com>
podviews-db2s, podviews-documentdbs, podviews-hanadbs and podviews-milvuses each carry a Dashboard column pointing at a <resource>-pod ResourceDashboard that cannot exist, because neither kubedb-grafana-dashboards nor kubedb-perses-dashboards ships a Pod dashboard for those four kinds. tableconvertor marks such a column RenderError and puts the lookup failure in its Message, so the column rendered as a permanent error rather than failing the table. With these removed, every dashboard reference in hub/resourcetabledefinitions resolves to an existing ResourceDashboard. Signed-off-by: Arnob kumar saha <arnob@appscode.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
RenderDashboardreturneddashboards: []for a number of KubeDB kinds because theResourceDashboardin the hub hadspec.dashboards: null. PgBouncer was the reportedcase; the same gap existed for Memcached, PerconaXtraDB, RedisSentinel and Weaviate,
and several other kinds were missing individual dashboards the charts ship.
Source of truth for every title and variable in this PR is
kubedb.dev/installer/charts/kubedb-grafana-dashboards, helm-rendered and read from.spec.model.title/.spec.model.templating.list(92 dashboards).charts/kubedb-perses-dashboardswas checked too: its 89 display names are a strictsubset of the Grafana titles (only Weaviate x3 differ), so it contributes no new names.
See "Perses" below.
Commits
Populate missing KubeDB ResourceDashboards from the dashboard charts
Filled in where
dashboardswasnull— Memcached, PerconaXtraDB, PgBouncer,RedisSentinel (v1 and v1alpha2) and Weaviate (v1alpha2). Completed Kafka (gains Summary
and Pod), MariaDB (Standard Replication) and Postgres (Remote Replica). Added
kafka.kubedb.com/v1alpha1/connectclusters.yamlfor the three Kafka / ConnectClusterdashboards.
New conditions read the real API fields:
spec.topology.modefor MariaDB (enum isMariaDBReplication|GaleraCluster) andspec.remoteReplicafor Postgres.Add the missing pod ResourceDashboards for KubeDB kinds
hub/resourcetabledefinitions/core.k8s.appscode.com/v1alpha1/kubedb/podviews-*.yamlreferences 28
<resource>-podResourceDashboards; only 7 existed, so the Dashboardcolumn in 21 pod views could not resolve. Adds the 17 v1alpha2 dashboards the charts
ship a Pod dashboard for, plus v1 copies for
perconaxtradbsandpgbouncers.Dangling references: 21 -> 4.
Drop ResourceDashboard titles that no dashboard chart ships
Neither chart ships
KubeDB / HanaDB / PodorKubeDB / Milvus / Pod, so those twoentries never resolved. ZooKeeper ships
Ensemble, notDatabase.Only pass dashboard vars the dashboard actually declares
Every entry passed
namespaceandappregardless of the dashboard's own templatinglist, so those values were inert wherever a dashboard declares something else —
Cassandra Database/Pod use
cluster+datacenter, HanaDB Database usesnode_name/node_ip/sid/instance_number/database_name, Memcached Database usesjob, Ignite Database hasappbut nonamespace, Milvus Database hasnamespacebutno
app.Do not show the MariaDB Galera-Cluster dashboard for standard replication
The condition was
replicas != 1, which is also true forspec.topology.mode: MariaDBReplication, so both Galera-Cluster and Standard Replication rendered for astandard-replication cluster.
spec.topologyis optional and a MariaDB withreplicas > 1and no topology is Galera, henceGaleraClusteras the missing-keydefault.
Verification
go build ./...cleanmake fmt(includingcmd/resource-fmt) idempotent, tree clean afterwardstitle:underhub/resourcedashboards/now resolves to a dashboard the chartships — 0 orphans, was 3
kubeops.dev/ui-server/pkg/shared.RenderTemplateagainst unstructured input forreplicas=1,replicas=3with no topology,replicas=3GaleraCluster andreplicas=3MariaDBReplication before being committedgo run ./cmd/check-schema/main.gopanics withtrigger: error unmarshaling JSON: cannot unmarshal string into map[string]interface {}.It panics identically on a clean
master, so it is pre-existing and unrelated to thisPR, but it means
check-schemadid not run as a gate here.Known gaps, not addressed here
db2s,documentdbs,hanadbsandmilvusesstill have unresolvable-podreferences, because no chart ships a Pod dashboard for them.
podviews-hanadbs.yamland
podviews-milvuses.yamlshould probably drop theirdashboard:column — that isa
resourcetabledefinitionschange.KubeDB / Ignite / Poddeclaresjob,cacheNameandnodebut nopod, sokubedb.com-v1alpha2-ignites-podresolves but cannot scope to a pod. The dashboardneeds a
podvariable in the chart before that entry does anything useful.db2sanddocumentdbkeepdashboards: null; neither chart ships anything for them.Perses
Not touched, and deliberately so.
DashboardProvideris+kubebuilder:validation:Enum=Grafana(apis/ui/v1alpha1/resourcedashboard_types.go:50),so adding a
Persesconstant would make the CRD start acceptingprovider: Perses.kubeops.dev/ui-serverthen rejects it at render time(
pkg/graph/dashboard.go:81), turning an up-front validation error into a runtime one.The blocker is upstream:
go.openviz.dev/apimachineryv0.0.10 is the newest publishedversion and ships no Perses types, so there is no
ui.openviz.devgroup/renderresource for
RenderDashboardto POST to the way it POSTsDashboardGrouptoday.openviz.dev/v1alpha1 PersesDashboard(in the perses chart'scrds/) is the storageCRD, not a render API. Worth revisiting once openviz grows the UI side.