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

Update Grafana, build plugins #607

Merged
merged 1 commit into from
Jan 27, 2025
Merged

Update Grafana, build plugins #607

merged 1 commit into from
Jan 27, 2025

Conversation

kvaps
Copy link
Member

@kvaps kvaps commented Jan 27, 2025

Signed-off-by: Andrei Kvapil [email protected]

Summary by CodeRabbit

Release Notes

  • New Features

    • Updated Grafana to version 11.4.0
    • Added new Grafana plugins: VictoriaMetrics logs datasource, Natel Discrete Panel, and Worldmap Panel
  • Improvements

    • Enhanced Grafana image build process
    • Dynamically manage Grafana image versioning
    • Updated plugin installation method
  • Version Update

    • Monitoring package version bumped from 1.7.0 to 1.8.0

@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Jan 27, 2025
Copy link
Contributor

coderabbitai bot commented Jan 27, 2025

Walkthrough

This pull request introduces updates to the monitoring package, focusing on Grafana image and plugin management. The changes include updating the Grafana version to 11.4.0, modifying the Dockerfile to support plugin installation, and adjusting the Kubernetes deployment configuration. The Makefile has been enhanced to dynamically set the Grafana version and streamline the Docker image build process. The version in Chart.yaml has been incremented from 1.7.0 to 1.8.0.

Changes

File Change Summary
Makefile Added build command for monitoring package image
packages/extra/monitoring/Chart.yaml Version updated from 1.7.0 to 1.8.0
packages/extra/monitoring/Makefile Added GRAFANA_TAG variable, new image target for Docker build
packages/extra/monitoring/images/grafana.tag New image reference added with specific digest
packages/extra/monitoring/images/grafana/Dockerfile Updated base image to Grafana 11.4.0, added plugin installation steps
packages/extra/monitoring/templates/grafana/grafana.yaml Removed init container, updated image reference, modified plugin path
packages/extra/versions_map Updated monitoring package versions

Sequence Diagram

sequenceDiagram
    participant Makefile
    participant Dockerfile
    participant Grafana Deployment
    
    Makefile->>Dockerfile: Build Grafana image
    Dockerfile-->>Dockerfile: Install plugins
    Dockerfile->>Grafana Deployment: Deploy configured image
    Grafana Deployment->>Grafana Deployment: Use new plugins and configuration
Loading

Possibly related PRs

Suggested labels

size:L, lgtm

Suggested reviewers

  • klinch0
  • themoriarti

Poem

🐰 A Rabbit's Ode to Monitoring Might

Grafana's version takes a leap,
Plugins dancing, secrets to keep
Docker builds with magical flair
Monitoring now beyond compare!
Code hops forward, version so bright 🚀


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@kvaps kvaps requested a review from klinch0 January 27, 2025 17:20
@dosubot dosubot bot added the enhancement New feature or request label Jan 27, 2025
Signed-off-by: Andrei Kvapil <[email protected]>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
packages/extra/monitoring/images/grafana/Dockerfile (1)

10-15: Consider optimizing plugin installation steps.

The plugin installation commands can be combined to reduce image layers:

 ARG VLOGS_VERSION=v0.14.1
-RUN curl -L https://github.com/VictoriaMetrics/victorialogs-datasource/releases/download/${VLOGS_VERSION}/victoriametrics-logs-datasource-${VLOGS_VERSION}.tar.gz | \
-      tar -xzf - -C /var/lib/grafana-plugins
-
-RUN grafana-cli --pluginsDir /var/lib/grafana-plugins plugins install natel-discrete-panel
-RUN grafana-cli --pluginsDir /var/lib/grafana-plugins plugins install grafana-worldmap-panel
+RUN curl -L https://github.com/VictoriaMetrics/victorialogs-datasource/releases/download/${VLOGS_VERSION}/victoriametrics-logs-datasource-${VLOGS_VERSION}.tar.gz | \
+      tar -xzf - -C /var/lib/grafana-plugins && \
+    grafana-cli --pluginsDir /var/lib/grafana-plugins plugins install natel-discrete-panel && \
+    grafana-cli --pluginsDir /var/lib/grafana-plugins plugins install grafana-worldmap-panel
packages/extra/monitoring/Makefile (1)

1-2: Consider adding version validation.

The version extraction from Chart.yaml could benefit from validation:

-GRAFANA_TAG = $(shell awk '$$1 == "version:" {print $$2}' Chart.yaml)
+GRAFANA_TAG = $(shell awk '$$1 == "version:" {print $$2}' Chart.yaml)
+$(if $(GRAFANA_TAG),,$(error Failed to extract version from Chart.yaml))
+$(if $(shell echo "$(GRAFANA_TAG)" | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$$'),,$(error Invalid version format in Chart.yaml))
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 80b4c15 and ea67523.

📒 Files selected for processing (7)
  • Makefile (1 hunks)
  • packages/extra/monitoring/Chart.yaml (1 hunks)
  • packages/extra/monitoring/Makefile (2 hunks)
  • packages/extra/monitoring/images/grafana.tag (1 hunks)
  • packages/extra/monitoring/images/grafana/Dockerfile (1 hunks)
  • packages/extra/monitoring/templates/grafana/grafana.yaml (1 hunks)
  • packages/extra/versions_map (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • packages/extra/monitoring/Chart.yaml
  • packages/extra/monitoring/images/grafana.tag
🔇 Additional comments (6)
packages/extra/versions_map (1)

27-28: LGTM! Version mappings are properly updated.

Good practice to pin the previous version (1.7.0) to a specific commit while keeping the new version (1.8.0) at HEAD for development.

packages/extra/monitoring/images/grafana/Dockerfile (1)

1-8: LGTM! Good security practices in place.

  • Using specific version for base image
  • Proper permission handling
  • Appropriate user context switching
packages/extra/monitoring/Makefile (1)

15-26: LGTM! Well-structured image build configuration.

Good practices observed:

  • Platform specification
  • Proper cache configuration
  • Clean metadata handling
Makefile (1)

9-9: LGTM! Build target properly integrated.

The monitoring image build is correctly added to the build sequence, following the established pattern.

packages/extra/monitoring/templates/grafana/grafana.yaml (2)

41-41: Add validation for the image tag file.

Good practice moving to externalized version management. However, consider adding validation to handle cases where the file is missing or empty.

Run this script to verify the image tag file exists and contains valid content:

✅ Verification successful

Image tag file exists and contains valid content

The file packages/extra/monitoring/images/grafana.tag exists and contains a properly formatted image reference with SHA256 digest, ensuring immutable deployments. No additional validation is required.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify Grafana image tag file exists and contains valid content

TAG_FILE="packages/extra/monitoring/images/grafana.tag"

if [ ! -f "$TAG_FILE" ]; then
  echo "Error: $TAG_FILE not found"
  exit 1
fi

# Check if file is empty or contains only whitespace
if ! grep -q '[^[:space:]]' "$TAG_FILE"; then
  echo "Error: $TAG_FILE is empty or contains only whitespace"
  exit 1
fi

echo "Content of $TAG_FILE:"
cat "$TAG_FILE"

Length of output: 475


48-51: Document plugin management changes and verify plugin availability.

The shift from runtime to build-time plugin installation has several implications:

  1. Ensure all required plugins are included in the new image
  2. Document the list of pre-installed plugins
  3. Provide migration steps for custom plugins in existing deployments

Run this script to verify plugin configuration in the Dockerfile:

Consider adding documentation in the chart's README about:

  • List of pre-installed plugins
  • Process for adding custom plugins
  • Migration guide for existing installations
✅ Verification successful

✓ Plugin installation properly configured in Dockerfile

The previously runtime-configured plugins (worldmap-panel, discrete-panel) are now pre-installed in the image using grafana-cli, and the custom plugin path is correctly set via GF_PATHS_PLUGINS.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify plugin installation configuration in Dockerfile

# Check Dockerfile for plugin installation
echo "Checking plugin installation in Dockerfile:"
rg -A 5 'GF_PATHS_PLUGINS|grafana-plugins' packages/extra/monitoring/images/grafana/Dockerfile

# List any references to removed plugins
echo -e "\nChecking references to worldmap and discrete panel plugins:"
rg 'grafana-worldmap-panel|natel-discrete-panel' packages/extra/monitoring/

Length of output: 1344

@kvaps kvaps merged commit ef2e065 into main Jan 27, 2025
2 checks passed
@kvaps kvaps deleted the upd-grafana branch January 27, 2025 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants