A machine-readable index of this documentation for AI agents is available at https://kubevela.io/llms.txt. Markdown versions of documentation pages are available by appending .md to their URLs.
Skip to main content
Version: Prism 1.7

How Prism Serves Its APIs

Every Prism API is a projection: a Kubernetes-shaped view of something that is stored somewhere else. Prism keeps no copy, so what you read is always what is in the backing object at that moment, and deleting Prism loses nothing.

The request path​

Two identities are involved, and it helps to keep them apart:

  • The caller's is checked once, against the Prism resource: applicationresourcetrackers in team-a, clusters, grafanadashboards. Hub RBAC decides, through a SubjectAccessReview, exactly as for a built-in resource.
  • Prism's own ServiceAccount (vela-prism) does the reading and writing of the backing object. The caller needs no access to ResourceTrackers, Secrets or Grafana at all.

That second point is what makes Prism useful, and it is also the thing to be careful with: whoever may use a Prism resource gets what Prism's ServiceAccount can do with the object behind it. A user who can get grafanas reads the Grafana credential; a user who can create grafanadashboards writes to Grafana as whatever account the Grafana object holds.

What each API is backed by​

APIScopeBacked byVerbs
applicationresourcetrackersNamespacedResourceTrackers labelled app.oam.dev/namespace=<namespace>get, list
clustersClusterlocal, plus cluster Secrets in the storage namespace and OCM ManagedClustersget, list
grafanasClusterSecret grafana.<name> in the observability namespace (o11y-system)get, list, create, update, patch, delete
grafanadashboardsClusterGrafana's /api/dashboards and /api/searchget, list, create, update, patch, delete
grafanadatasourcesClusterGrafana's /api/datasourcesget, list, create, update, patch, delete

None of them supports watch: kubectl get -w fails with MethodNotAllowed. A Role can still list watch among its verbs; it just never applies.

How names map​

APIPrism nameBacking name
ApplicationResourceTrackerhello-v1 in namespace team-aResourceTracker hello-v1-team-a
ClustermemberSecret member in vela-system, or ManagedCluster member
GrafanadefaultSecret grafana.default in o11y-system
GrafanaDashboardteam-a-overview@defaultDashboard with uid team-a-overview in the Grafana named default
GrafanaDatasourceprometheus@defaultDatasource with uid prometheus in the Grafana named default

Dashboards and datasources take a compound name, <uid>@<grafana>. Without the @<grafana> part, Prism uses the Grafana named default. A list goes to one Grafana at a time, picked with a label selector: kubectl get grafanadashboards -l grafana=my-grafana.

What projected objects don't have​

Because nothing is stored, some of the usual object machinery is missing, and it shows in a few places:

  • No resourceVersion or creationTimestamp on Grafana dashboards and datasources, and uid is -. kubectl apply warns that the last-applied annotation is missing on every update, because there is nowhere to keep it; the update still goes through.
  • Labels and annotations on dashboards and datasources are not kept, except the two folder labels Prism reads and writes itself (see the API reference).
  • No status, finalizers or owner references that mean anything. KubeVela knows this: when an Application applies a Prism object, it doesn't expect the object it reads back to carry what it wrote.
  • ApplicationResourceTracker's spec is the ResourceTracker's, and KubeVela compresses that by default (spec.compression), so kubectl get apprt -o yaml shows a zstd blob rather than a list of resources. vela status --tree decodes it.

Where Prism looks​

Two namespaces are flags on the Prism binary, fixed when it starts:

FlagDefaultUsed for
--storage-namespacevela-systemCluster Secrets, the same namespace KubeVela's vela cluster join writes to.
--observability-namespaceo11y-systemThe grafana.<name> Secrets behind Grafana objects.

The addon sets --storage-namespace to its namespace parameter and leaves --observability-namespace at its default. Configuration has the rest.