import { Grafana } from 'cdk8s-kube-prometheus'
new Grafana(scope: Construct, id: string)
Name | Type | Description |
---|---|---|
scope |
constructs.Construct |
No description. |
id |
string |
No description. |
- Type: constructs.Construct
- Type: string
Name | Description |
---|---|
toString |
Returns a string representation of this construct. |
addDependency |
Create a dependency between this Chart and other constructs. |
generateObjectName |
Generates a app-unique name for an object given it's construct node path. |
toJson |
Renders this chart to a set of Kubernetes JSON resources. |
public toString(): string
Returns a string representation of this construct.
public addDependency(dependencies: ...IConstruct[]): void
Create a dependency between this Chart and other constructs.
These can be other ApiObjects, Charts, or custom.
- Type: ...constructs.IConstruct[]
the dependencies to add.
public generateObjectName(apiObject: ApiObject): string
Generates a app-unique name for an object given it's construct node path.
Different resource types may have different constraints on names
(metadata.name
). The previous version of the name generator was
compatible with DNS_SUBDOMAIN but not with DNS_LABEL.
For example, Deployment
names must comply with DNS_SUBDOMAIN while
Service
names must comply with DNS_LABEL.
Since there is no formal specification for this, the default name generation scheme for kubernetes objects in cdk8s was changed to DNS_LABEL, since it’s the common denominator for all kubernetes resources (supposedly).
You can override this method if you wish to customize object names at the chart level.
- Type: cdk8s.ApiObject
The API object to generate a name for.
public toJson(): any[]
Renders this chart to a set of Kubernetes JSON resources.
Name | Description |
---|---|
isConstruct |
Checks if x is a construct. |
isChart |
Return whether the given object is a Chart. |
of |
Finds the chart in which a node is defined. |
import { Grafana } from 'cdk8s-kube-prometheus'
Grafana.isConstruct(x: any)
Checks if x
is a construct.
Use this method instead of instanceof
to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs
library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct
in each copy of the constructs
library
is seen as a different class, and an instance of one class will not test as
instanceof
the other class. npm install
will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof
will behave
unpredictably. It is safest to avoid using instanceof
, and using
this type-testing method instead.
- Type: any
Any object.
import { Grafana } from 'cdk8s-kube-prometheus'
Grafana.isChart(x: any)
Return whether the given object is a Chart.
We do attribute detection since we can't reliably use 'instanceof'.
- Type: any
import { Grafana } from 'cdk8s-kube-prometheus'
Grafana.of(c: IConstruct)
Finds the chart in which a node is defined.
- Type: constructs.IConstruct
a construct node.
Name | Type | Description |
---|---|---|
node |
constructs.Node |
The tree node. |
apiObjects |
cdk8s.ApiObject[] |
Returns all the included API objects. |
labels |
{[ key: string ]: string} |
Labels applied to all resources in this chart. |
namespace |
string |
The default namespace for all objects in this chart. |
public readonly node: Node;
- Type: constructs.Node
The tree node.
public readonly apiObjects: ApiObject[];
- Type: cdk8s.ApiObject[]
Returns all the included API objects.
public readonly labels: {[ key: string ]: string};
- Type: {[ key: string ]: string}
Labels applied to all resources in this chart.
This is an immutable copy.
public readonly namespace: string;
- Type: string
The default namespace for all objects in this chart.