Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ NOTE: As semantic versioning states all 0.y.z releases can contain breaking chan
- [#160](https://github.com/kobsio/kobs/pull/160): Allow users to sort the returned logs within the documents table in the ClickHouse plugin.
- [#161](https://github.com/kobsio/kobs/pull/161): Add support for materialized columns, to improve query performance for most frequently queried field.
- [#162](https://github.com/kobsio/kobs/pull/162): Add support to visualize logs in the ClickHouse plugin.
- [#170](https://github.com/kobsio/kobs/pull/170): Add Custom Resource Definition for Users.

### Fixed

Expand Down
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ REPO ?= github.com/kobsio/kobs
REVISION ?= $(shell git rev-parse HEAD)
VERSION ?= $(shell git describe --tags)

CRDS ?= team application dashboard
CRDS ?= team application dashboard user

.PHONY: build
build:
Expand All @@ -27,14 +27,15 @@ generate-crds:
rm -rf ./pkg/api/clients/$$crd/clientset; \
rm -rf ./pkg/api/clients/$$crd/informers; \
rm -rf ./pkg/api/clients/$$crd/listers; \
mkdir -p ./pkg/api/clients/$$crd; \
mv ./tmp/github.com/kobsio/kobs/pkg/api/apis/$$crd/v1beta1/zz_generated.deepcopy.go ./pkg/api/apis/$$crd/v1beta1; \
mv ./tmp/github.com/kobsio/kobs/pkg/api/clients/$$crd/clientset ./pkg/api/clients/$$crd/clientset; \
mv ./tmp/github.com/kobsio/kobs/pkg/api/clients/$$crd/informers ./pkg/api/clients/$$crd/informers; \
mv ./tmp/github.com/kobsio/kobs/pkg/api/clients/$$crd/listers ./pkg/api/clients/$$crd/listers; \
rm -rf ./tmp; \
done

controller-gen "crd:crdVersions={v1},trivialVersions=true" paths="./..." output:crd:artifacts:config=deploy/kustomize/crds
controller-gen "crd:crdVersions={v1},trivialVersions=true" paths="./pkg/..." output:crd:artifacts:config=deploy/kustomize/crds

for crd in $(CRDS); do \
cp ./deploy/kustomize/crds/kobs.io_$$crd\s.yaml ./deploy/helm/kobs/crds/kobs.io_$$crd\s.yaml; \
Expand Down
1 change: 1 addition & 0 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"@kobsio/plugin-resources": "*",
"@kobsio/plugin-rss": "*",
"@kobsio/plugin-teams": "*",
"@kobsio/plugin-users": "*",
"@types/react": "^17.0.0",
"@types/react-dom": "^17.0.0",
"react": "^17.0.2",
Expand Down
2 changes: 2 additions & 0 deletions app/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import './index.css';
import { App } from '@kobsio/plugin-core';
import resourcesPlugin from '@kobsio/plugin-resources';
import teamsPlugin from '@kobsio/plugin-teams';
import usersPlugin from '@kobsio/plugin-users';
import applicationsPlugin from '@kobsio/plugin-applications';
import dashboardsPlugin from '@kobsio/plugin-dashboards';
import prometheusPlugin from '@kobsio/plugin-prometheus';
Expand All @@ -26,6 +27,7 @@ ReactDOM.render(
<App plugins={{
...resourcesPlugin,
...teamsPlugin,
...usersPlugin,
...applicationsPlugin,
...dashboardsPlugin,
...prometheusPlugin,
Expand Down
3 changes: 3 additions & 0 deletions cmd/kobs/plugins/plugins.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@ import (
"github.com/kobsio/kobs/plugins/rss"
"github.com/kobsio/kobs/plugins/sql"
"github.com/kobsio/kobs/plugins/teams"
"github.com/kobsio/kobs/plugins/users"
)

// Config holds the configuration for all plugins. We have to add the configuration for all the imported plugins.
type Config struct {
Applications applications.Config `json:"applications"`
Resources resources.Config `json:"resources"`
Teams teams.Config `json:"teams"`
Users users.Config `json:"users"`
Dashboards dashboards.Config `json:"dashboards"`
Prometheus prometheus.Config `json:"prometheus"`
Elasticsearch elasticsearch.Config `json:"elasticsearch"`
Expand Down Expand Up @@ -70,6 +72,7 @@ func Register(clusters *clusters.Clusters, config Config) chi.Router {
router.Mount(resources.Route, resources.Register(clusters, router.plugins, config.Resources))
router.Mount(applications.Route, applications.Register(clusters, router.plugins, config.Applications))
router.Mount(teams.Route, teams.Register(clusters, router.plugins, config.Teams))
router.Mount(users.Route, users.Register(clusters, router.plugins, config.Users))
router.Mount(dashboards.Route, dashboards.Register(clusters, router.plugins, config.Dashboards))
router.Mount(prometheus.Route, prometheus.Register(clusters, router.plugins, config.Prometheus))
router.Mount(elasticsearch.Route, elasticsearch.Register(clusters, router.plugins, config.Elasticsearch))
Expand Down
2 changes: 1 addition & 1 deletion deploy/helm/kobs/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ description: Kubernetes Observability Platform
type: application
home: https://kobs.io
icon: https://kobs.io/assets/images/logo.svg
version: 0.6.1
version: 0.7.0
appVersion: v0.5.0
80 changes: 80 additions & 0 deletions deploy/helm/kobs/crds/kobs.io_users.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@

---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.3.0
creationTimestamp: null
name: users.kobs.io
spec:
group: kobs.io
names:
kind: User
listKind: UserList
plural: users
singular: user
scope: Namespaced
versions:
- name: v1beta1
schema:
openAPIV3Schema:
description: User is the User CRD.
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
properties:
bio:
type: string
cluster:
type: string
email:
type: string
fullName:
type: string
id:
type: string
name:
type: string
namespace:
type: string
position:
type: string
teams:
items:
properties:
cluster:
type: string
name:
type: string
namespace:
type: string
required:
- name
type: object
type: array
required:
- email
- fullName
- id
type: object
type: object
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
80 changes: 80 additions & 0 deletions deploy/kustomize/crds/kobs.io_users.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@

---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.3.0
creationTimestamp: null
name: users.kobs.io
spec:
group: kobs.io
names:
kind: User
listKind: UserList
plural: users
singular: user
scope: Namespaced
versions:
- name: v1beta1
schema:
openAPIV3Schema:
description: User is the User CRD.
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
properties:
bio:
type: string
cluster:
type: string
email:
type: string
fullName:
type: string
id:
type: string
name:
type: string
namespace:
type: string
position:
type: string
teams:
items:
properties:
cluster:
type: string
name:
type: string
namespace:
type: string
required:
- name
type: object
type: array
required:
- email
- fullName
- id
type: object
type: object
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
34 changes: 34 additions & 0 deletions docs/plugins/users.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Users

The users plugin can be used to show a list of users which are members of the specified team on a dashboard.

## Options

| Field | Type | Description | Required |
| ----- | ---- | ----------- | -------- |
| clusters | string | The cluster name of the team. | No |
| namespaces | string | The namespace of the team | No |
| name | string | The name of the team. | Yes |

## Example

```yaml
---
apiVersion: kobs.io/v1beta1
kind: Team
metadata:
name: team-diablo
namespace: kobs
spec:
dashboards:
- title: Users
inline:
rows:
- size: -1
panels:
- title: Users
plugin:
name: users
options:
name: team-diablo
```
53 changes: 53 additions & 0 deletions docs/resources/users.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Users

Users are an extension of kobs via the [User Custom Resource Definition](https://github.com/kobsio/kobs/blob/main/deploy/kustomize/crds/kobs.io_users.yaml). Users can be used to define the members of a team.

You can access all users via the **Users** item on the home page of kobs.

![Users](assets/users.png)

## Specification

In the following you can found the specification for the User CRD.

| Field | Type | Description | Required |
| ----- | ---- | ----------- | -------- |
| id | string | A unique id for the user. The id must be unique across all clusters and namespace. | Yes |
| fullName | string | The full name of the user. | Yes |
| email | string | The email address of the user. | Yes |
| position | string | The position of the user. | No |
| bio | string | The bio of the user. The bio field supports markdown syntax. | No |
| links | [[]Team](#team) | A list of links (e.g. a link to the teams Slack channel, Confluence page, etc.) | No |

### Team

| Field | Type | Description | Required |
| ----- | ---- | ----------- | -------- |
| cluster | string | The cluster name of the team, where the user is a member of. If this field isn't provided the cluster property of the user will be used. | No |
| namespace | string | The namespace of the team, where the user is a member of. If this field isn't provided the namespace property of the user will be used. | No |
| name | string | The name of the team. | Yes |

## Example

```yaml
---
apiVersion: kobs.io/v1beta1
kind: User
metadata:
name: ricoberger
namespace: kobs
spec:
id: ricoberger
fullName: Rico Berger
email: admin@kobs.io
position: Site Reliability Engineer
bio: |
Site Reliability Engineer at Staffbase. Hacker, Gopher, Cloud Native Enthusiast.

- [GitHub](https://github.com/ricoberger)
- [Twitter](https://twitter.com/rico_berger)
- [LinkedIn](https://www.linkedin.com/in/ricoberger/)
- [Xing](https://www.xing.com/profile/Rico_Berger5)
teams:
- name: team-diablo
```
2 changes: 2 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ nav:
- Resources: resources/resources.md
- Applications: resources/applications.md
- Teams: resources/teams.md
- Users: resources/users.md
- Dashboards: resources/dashboards.md
- Plugins:
- Getting Started: plugins/getting-started.md
Expand All @@ -59,6 +60,7 @@ nav:
- RSS: plugins/rss.md
- SQL: plugins/sql.md
- Teams: plugins/teams.md
- Users: plugins/users.md
- Contributing:
- Getting Started: contributing/getting-started.md
- Add a Plugin: contributing/add-a-plugin.md
Expand Down
6 changes: 6 additions & 0 deletions pkg/api/apis/user/register.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package user

// GroupName is the group name used in this package.
const (
GroupName = "kobs.io"
)
4 changes: 4 additions & 0 deletions pkg/api/apis/user/v1beta1/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// +k8s:deepcopy-gen=package
// +groupName=kobs.io

package v1beta1
Loading