Coder Social home page Coder Social logo

cdk8s-grafana's People

Contributors

amazon-auto avatar camba1 avatar cdk8s-automation avatar chriscbr avatar github-actions[bot] avatar iliapolo avatar njlynch avatar vinayak-kukreja avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

camba1

cdk8s-grafana's Issues

Bug: Error trying to add a dashboard: unknown field "name" in org.integreatly.v1alpha1.GrafanaDashboard.spec

What happened:

Tried adding a dashboard to grafana in Python using:

        grafana.add_dashboard("k8sDashBoard",
                              title="Kubernetes Metrics",
                              json_model=k8s_dashboard,
                              data_source_variables={"DS_PROMETHEUS": "prometheus.name"}
                              )

Expected:

The dashboard gets added to Grafana

Result:

cdk8s synth worked fine and generated the Yaml. However on kubectl apply, K8s threw the error:

error: error validating "dist/GrafanaDashboard.grafana-k8sdashboard-c8f7fb82.k8s.yaml": error validating data: ValidationError(GrafanaDashboard.spec): unknown field "name" in org.integreatly.v1alpha1.GrafanaDashboard.spec; if you choose to ignore these errors, turn validation off with --validate=false

Reason for Issue:

The generated manifest added a spec.name field which is not recognized but the validation. Synth is adding the id fo the dashboard as a name inside the spec. Partial yaml naivest below (for brevity):

apiVersion: integreatly.org/v1alpha1
kind: GrafanaDashboard
metadata:
  labels:
    app: grafana
  name: grafana-k8sdashboard2-c8bfb3a3
  namespace: my-grafana-operator
spec:
  datasources:
    - datasourceName: prometheus.name
      inputName: DS_PROMETHEUS
  json: <...>
  name: k8sDashBoard
  plugins: []

If the spec.name is commented out, the yaml can be deployed normally

cdk8s synth --version
1.0.57

How to fix it

Change required to operator in cdk8s-grafana/src/dashboard.ts

    new GrafanaDashboard(this, 'Resource', {
      metadata: {
        labels: props.labels,
        namespace: props.namespace,
      },
      spec: {
        customFolderName: props.folder,
        datasources: dataSources,
        plugins: this.plugins,
        json: JSON.stringify({
          ...defaults,
          ...props.jsonModel,
        }, null, 2),
        name: id,
      },
    });

Should be:

    new GrafanaDashboard(this, 'Resource', {
      metadata: {
        labels: props.labels,
        namespace: props.namespace,
      },
      spec: {
        customFolderName: props.folder,
        datasources: dataSources,
        plugins: this.plugins,
        json: JSON.stringify({
          ...defaults,
          ...props.jsonModel,
        }, null, 2),
      },
    });

Bug: Unable to setup NodePort service

The construct does not expose the service type and thus the end user cannot create a service of type NodePort to expose Grafana when using the construct.
Currently the only way to create a NodePort is to set the Ingress flag to false in the init and then add the following to the generated YAML:

  service:
    type: NodePort

Note that the underlying object exposes the service object, it just needs to be exposed in the construct as well.

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.