Skip to content

Commit

Permalink
docs: add README.md (#1)
Browse files Browse the repository at this point in the history
Initial draft of API instructions and usage.
  • Loading branch information
Chriscbr authored Jul 19, 2021
1 parent bd10a9c commit df2c3ab
Show file tree
Hide file tree
Showing 7 changed files with 179 additions and 97 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/stale.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .projen/deps.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .projenrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const project = new ConstructLibraryCdk8s({
defaultReleaseBranch: 'main',
name: 'cdk8s-grafana',
repositoryUrl: 'https://github.com/cdk8s-team/cdk8s-grafana.git',
constructsVersion: '3.3.48',

// deps: [], /* Runtime dependencies of this module. */
// description: undefined, /* The description is just a string that helps people understand the purpose of the package. */
Expand Down
28 changes: 28 additions & 0 deletions API.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# API Reference <a name="API Reference"></a>



## Classes <a name="Classes"></a>

### Hello <a name="cdk8s-grafana.Hello"></a>

#### Initializer <a name="cdk8s-grafana.Hello.Initializer"></a>

```typescript
import { Hello } from 'cdk8s-grafana'

new Hello()
```

#### Methods <a name="Methods"></a>

##### `sayHello` <a name="cdk8s-grafana.Hello.sayHello"></a>

```typescript
public sayHello()
```





65 changes: 59 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,68 @@
## My Project
## cdk8s-grafana

TODO: Fill this README out!
cdk8s-grafana is a library that lets you easily define a Grafana service for
your kubernetes cluster along with associated dashboards and datasources, using
a high level API.

Be sure to:
### Usage

* Change the title in this README
* Edit your repository description on GitHub
To apply the resources generated by this construct, the Grafana operator must be
installed on your cluster. See
<https://operatorhub.io/operator/grafana-operator> for full installation
instructions.

The following will define a Grafana cluster connected to a Prometheus
datasource:

```typescript
import { Grafana } from 'cdk8s-grafana';

// inside your chart:
const grafana = new Grafana(this, 'my-grafana', {
defaultDataSource: {
name: 'Prometheus',
type: 'prometheus',
access: 'proxy',
url: 'http://prometheus-service:9090',
}
});
```

Basic aspects of a dashboard can be customized:

```typescript
const github = grafana.addDatasource('github', ...);
const dashboard = grafana.addDashboard('my-dashboard', {
title: 'My Dashboard',
refreshRate: Duration.seconds(10),
timeRange: Duration.hours(6), // show metrics from now-6h to now
panels: [
{
"type": "text",
"title": "Panel Title",
"gridPos": {
"x": 0,
"y": 0,
"w": 12,
"h": 9
},
"mode": "markdown",
"content": "# title"
},
],
plugins: [
{
name: 'grafana-piechart-panel',
version: '1.3.6',
}
],
});
```

## Security

See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information.
See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more
information.

## License

Expand Down
4 changes: 2 additions & 2 deletions package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit df2c3ab

Please sign in to comment.