Coder Social home page Coder Social logo

prism's Introduction

Prism

UnitTest Go Report Card codecov LICENSE Total alerts

Introduction

Prism provides API Extensions to the core KubeVela. It works as a Kubernetes Aggregated API Server.

PrismArch

Installation

From chart repository

Add the chart repository

helm repo add prism https://charts.kubevela.net/prism
helm repo update

Install helm chart

helm install vela-prism prism/vela-prism -n vela-system

From this repo

Clone this repo and run helm install vela-prism charts/ --namespace vela-system.

Modules

apiserver

The vela-prism is an apiserver which leverages the Kubernetes Aggregated API capability to provide native interface for users.

ApplicationResourceTracker

The original ResourceTracker in KubeVela is one kind of cluster-scoped resource (for some history reasons), which makes it hard for cluster administrator to assign privilege. The ApplicationResourceTracker is a kind of namespace-scoped resource, which works as a delegator to the original ResourceTracker. It does not need extra storages but can project requests to ApplicationResourceTracker to underlying ResourceTrackers. Therefore, it is possible for cluster administrator to assign ApplicationResourceTracker permissions to users.

After installing vela-prism in your cluster, you can run kubectl get apprt to view ResourceTrackers.

Cluster

In vela-prism, Cluster API is also introduced which works as a delegator to the ClusterGateway object. The original ClusterGateway object contains the credential information. This makes the exposure of ClusterGateway access can be dangerous. The Cluster object provided in prism, on the other hand, only expose metadata of clusters to accessor. Therefore, the credential information will be secured and the user can also use the API to access the cluster list.

After installing vela-prism in your cluster, you can run kubectl get vela-clusters to view all the installed clusters.

Notice that the vela-prism bootstrap parameter contains --storage-namespace, which identifies the underlying namespace for storing cluster secrets and the OCM managed cluster.

Grafana related APIs

PrismGrafanaArch

Grafana

In vela-prism, you can store grafana access into Grafana object. The Grafana object is projected into secrets in o11y-system (this can be configured through --observability-namespace parameter). The secret embeds the access endpoint and credential (either username/password for BasicAuth or token for BearerToken) for grafana. These will be used for communicating with Grafana APIs. Example of Grafana object is shown below.

apiVersion: o11y.prism.oam.dev/v1alpha1
kind: Grafana
metadata:
  name: example
spec:
  access:
    username: admin
    password: kubevela
  endpoint: https://grafana.o11y-system:3000/

GrafanaDashboard & GrafanaDatasource

After creating the Grafana object into the control plane, you are now able to manipulate Grafana resources through Kubernetes APIs now. Currently, vela-prism provides proxies for GrafanaDatasource and GrafanaDashboard. Their names are constructed by two parts, its original name and the backend grafana name.

For example, you can create a new GrafanaDashboard by applying the following YAML file. This will use the Grafana object above as the access credential, and call the Grafana APIs to create a new dashboard.

You can also update or delete dashboards or datasources. The spec part of GrafanaDashboard and GrafanaDatasource are directly projected into API request body.

apiVersion: o11y.prism.oam.dev/v1alpha1
kind: GrafanaDashboard
metadata:
  name: dashboard-test@example
spec:
  title: New dashboard
  tags: []
  style: dark
  timezone: browser
  editable: true
  hideControls: false
  graphTooltip: 1
  panels: []
  time:
    from: now-6h
    to: now
  timepicker:
    time_options: []
    refresh_intervals: []
  templating:
    list: []
  annotations:
    list: []
  refresh: 5s
  schemaVersion: 17
  version: 0
  links: []

Another example for GrafanaDatasource.

apiVersion: o11y.prism.oam.dev/v1alpha1
kind: GrafanaDatasource
metadata:
  name: prom-test@example
spec:
  access: proxy
  basicAuth: false
  isDefault: false
  name: ExamplePrometheus
  readOnly: true
  type: prometheus
  url: https://prometheus-server.o11y-system:9090

verse operator pattern

To operate Grafana instances in Kubernetes, there are also Grafana operators to help manage Grafana configurations.

Compared to operator pattern, the aggregator pattern has pros and cons.

Pros
  • There is no data consistency problem between the CustomResource and the Grafana underlying storage.
  • API requests are made in time. The response is also immediate. No need for checking CustomResource status repeatedly.
  • No reconciles. No need to hold CPUs and memories as controller does.
  • Easy to connect with third-party Grafana instance. For example, Grafana from cloud providers.
Cons
  • Cannot persist data outside Grafana storage. Once grafana is broken, the CustomResource will be unavailable as well.

The main drawback for vela-prism compared to operator pattern is that it cannot persist configurations. However, this can be solved through using KubeVela application to manage those configurations. For example, you can write KubeVela applications to hold the dashboard configurations, instead of create another separate CustomResource. With KubeVela application, leverage GitOps is also possible.

prism's People

Contributors

snyk-bot avatar somefive avatar wonderflow avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

prism's Issues

BUG: failed to list resources: secrets "grafana.default" not found

As soon as we install the vela-prism addon, either per vela addon or helm chart, we can't create cluster backups with velero or gke backup anymore as it seems something is missing:

failed to list resources: secrets "grafana.default" not found
time="2023-06-28T11:22:42Z" level=error msg="Error listing items" backup=velero/cluster-backup-hp-test error="secrets \"grafana.default\" not found" group=o11y.prism.oam.dev/v1alpha1 logSource="pkg/backup/item_collector.go:332" namespace= resource=grafanadashboards

After removing vela-prims the problem is gone. Whats missing there and how can we fix it?

[Bug] Cannot use 0.1.0 as chart version to helm install as an addon

kubectl get helmcharts.source.toolkit.fluxcd.io -A | grep prism
vela-system vela-system-vela-prism vela-prism 0.1.0 HelmRepository vela-prism False invalid chart reference: failed to get chart version for remote reference: no 'vela-prism' chart with version matching '0.1.0' found 3m15s

Feat: dynamic api

  • Dynamic API should remove pre-installed APIService and create it on demand.
  • Dynamic API should use the privileges of the incoming request.
  • Dynamic API should support filtering resources when decode / encode fails.
  • Dynamic API should add support for api template definition.
  • Dynamic API should support CUE execution engine.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.