Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added jsonnet and grafanet into confgenerator code #369

Merged
merged 7 commits into from
Feb 8, 2023

Conversation

KalmanMeth
Copy link
Collaborator

As a step towards creating grafana dashboards in the Network Observability Operator, this PR adds into the confgenerator the steps of running jsonnet using the grafannet defined constructs to generate the grafana panels, accessible via a function call (instead of performing these operations externally and then reading additional files).
The grafannet files are embedded in the confgenerator code so that they will be accessible when we run this code from the operator.

@codecov-commenter
Copy link

codecov-commenter commented Jan 29, 2023

Codecov Report

Merging #369 (cbadb19) into main (84428d1) will decrease coverage by 7.56%.
The diff coverage is 54.86%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##             main     #369      +/-   ##
==========================================
- Coverage   69.23%   61.67%   -7.56%     
==========================================
  Files          88       91       +3     
  Lines        5204     5939     +735     
==========================================
+ Hits         3603     3663      +60     
- Misses       1382     2045     +663     
- Partials      219      231      +12     
Flag Coverage Δ
unittests 61.67% <54.86%> (-7.56%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
cmd/confgenerator/main.go 0.00% <0.00%> (ø)
pkg/confgen/config.go 33.33% <ø> (ø)
pkg/confgen/confgen.go 47.82% <35.71%> (-1.39%) ⬇️
pkg/confgen/grafana_jsonnet.go 54.21% <58.16%> (+6.73%) ⬆️
pkg/pipeline/pipeline_builder.go 71.06% <0.00%> (-0.46%) ⬇️
pkg/config/config.go 63.33% <0.00%> (ø)
pkg/api/write_ipfix.go 0.00% <0.00%> (ø)
pkg/pipeline/write/write_ipfix.go 0.00% <0.00%> (ø)
hack/examples/ipfix-collector/ipfix-dump.go 0.00% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@KalmanMeth KalmanMeth requested review from ronensc, eranra and jotak and removed request for ronensc and eranra January 31, 2023 13:16
@openshift-ci
Copy link

openshift-ci bot commented Feb 1, 2023

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from kalmanmeth by writing /assign @kalmanmeth in a comment. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link
Collaborator

@ronensc ronensc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have the hack/generate-dashboards.sh script which is triggered by make dashboards.
This script downloads the jsonnet CLI and grafonnet-lib to ./bin
So we have 2 instances of grafonnet-lib. Can we consolidate the two?

@@ -0,0 +1,201 @@
Apache License
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIUC grafana/grafonnet-lib contains selected files from https://github.com/grafana/grafonnet-lib
I think we should write it somewhere and include the its version

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a sentence in confGenerator.md. Note that the License is already included in the grafonnet-lib directory.

@@ -165,32 +168,39 @@ type Dashboard struct {
Panels []byte
}

func (cg *ConfGen) generateGrafanaJsonnet(folderName string) error {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for breaking this function into smaller functions

pkg/confgen/grafana_jsonnet.go Outdated Show resolved Hide resolved
pkg/confgen/grafana_jsonnet.go Show resolved Hide resolved
@KalmanMeth
Copy link
Collaborator Author

So we have 2 instances of grafonnet-lib. Can we consolidate the two?
Yes, we should remove the script from hack once this PR is merged.

@KalmanMeth KalmanMeth merged commit f7794d4 into netobserv:main Feb 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants