Skip to content

feat(graph-node): add pg and ipfs charts as dependency #521

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

1doce8
Copy link

@1doce8 1doce8 commented Apr 17, 2025

Hey this PR adds Postgres and ipfs as optional dependencies to make it easier to get started with Graph Node.
Both dependencies are disabled by default, so this change is fully backward compatible with existing deployments.
The idea is to provide a quick-start option where users can deploy a complete Graph Node setup with a single Helm command

Summary by CodeRabbit

  • New Features

    • Added support for optional PostgreSQL and IPFS Cluster dependencies in the Helm chart, allowing users to enable or disable these components during deployment.
    • Introduced post-installation instructions and connection details for dependencies, improving deployment guidance.
  • Documentation

    • Expanded README with a new "Dependencies" section, including configuration examples and environment variable details for PostgreSQL and IPFS Cluster.
    • Enhanced comments in configuration values for clarity on default behaviors and overrides.
  • Refactor

    • Improved handling of environment variables by providing sensible defaults when values are not explicitly set.

Copy link

coderabbitai bot commented Apr 17, 2025

Walkthrough

This change introduces optional Helm chart dependencies for PostgreSQL and IPFS Cluster into the graph-node Helm chart, updating the chart version and adding related documentation. Conditional logic is added to the templates to provide default environment variable values for database and IPFS connection parameters when not explicitly set. A new NOTES.txt template is included to display post-installation connection details, and a helper template is added to determine the PostgreSQL secret name. The values file is updated with new configuration sections and expanded documentation for these dependencies.

Changes

File(s) Change Summary
charts/graph-node/Chart.yaml Chart version incremented to 0.5.10. Added dependencies section for optional PostgreSQL (Bitnami) and IPFS Cluster (Ethereum Helm charts) dependencies, each with alias and enable condition.
charts/graph-node/README.md Added a "Dependencies" section documenting the new PostgreSQL and IPFS Cluster dependencies, their default environment variable handling, and example configuration snippets for enabling and customizing these dependencies.
charts/graph-node/templates/NOTES.txt New template providing post-installation instructions, including conditional connection details for PostgreSQL and IPFS Cluster if enabled.
charts/graph-node/templates/_helpers.tpl Added a new Helm template helper graph-node.postgresql.secretName to determine the PostgreSQL secret name based on values or defaults.
charts/graph-node/templates/graph-node/all.yaml Enhanced template logic to provide default values for PostgreSQL and IPFS-related environment variables when keys are present but empty. Logic applies to both init and main containers, handling both regular and secret environment variables. No structural changes to manifests.
charts/graph-node/values.yaml Expanded comments for secret environment variables to clarify defaulting behavior. Added configuration sections for ipfs-cluster and postgresql dependencies, including enable flags, resource limits, and extended configuration. Defaults set to not enable dependencies unless specified.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Helm Chart
    participant PostgreSQL Dependency
    participant IPFS Cluster Dependency
    participant Kubernetes

    User->>Helm Chart: Install/upgrade graph-node chart
    Helm Chart-->>Kubernetes: Deploy graph-node resources
    alt postgresql.enabled = true
        Helm Chart-->>PostgreSQL Dependency: Deploy PostgreSQL subchart
        PostgreSQL Dependency-->>Kubernetes: Deploy PostgreSQL resources
        Helm Chart-->>Kubernetes: Set env vars for DB connection (defaults if not set)
    end
    alt ipfs-cluster.enabled = true
        Helm Chart-->>IPFS Cluster Dependency: Deploy IPFS Cluster subchart
        IPFS Cluster Dependency-->>Kubernetes: Deploy IPFS Cluster resources
        Helm Chart-->>Kubernetes: Set env var for IPFS endpoint (default if not set)
    end
    Helm Chart-->>Kubernetes: Deploy NOTES.txt with connection info
    User->>Kubernetes: Inspect deployment and notes
Loading

Suggested reviewers

  • calinah

Tip

⚡💬 Agentic Chat (Pro Plan, General Availability)
  • We're introducing multi-step agentic chat in review comments and issue comments, within and outside of PR's. This feature enhances review and issue discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments and add commits to existing pull requests.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
  • @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.

Copy link

@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 (6)
charts/graph-node/Chart.yaml (1)

37-37: Missing newline at end of file.

Add a newline at the end of the file to comply with YAML best practices and fix the linting error.

    repository: https://ethpandaops.github.io/ethereum-helm-charts
    condition: ipfs-cluster.enabled
+
🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 37-37: no new line character at the end of file

(new-line-at-end-of-file)

charts/graph-node/values.yaml (1)

309-309: Add newline at end of file
YAMLLint flagged a missing newline at EOF. Consider adding a trailing newline for compliance with YAML best practices.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 309-309: no new line character at the end of file

(new-line-at-end-of-file)

charts/graph-node/templates/graph-node/all.yaml (4)

124-132: Defaults for PGHOST, PGDATABASE, and IPFS in initContainer env
The conditional blocks correctly inject fallback values when those env vars are empty. To reduce repetition, consider extracting this logic into a helper (e.g., defaultEnvValue) and invoking it both here and in the main container block.


136-150: Incorporate customizable PostgreSQL secret name
The template hardcodes <Release>-postgresql but you’ve introduced postgresql.secretName in values.yaml. Verify whether users should be able to override the secret name via that field; if so, use .Values.postgresql.secretName (or the graph-node.postgresql.secretName helper) instead of the fixed release suffix.


250-258: Defaults for PGHOST, PGDATABASE, and IPFS in main container env
This block mirrors the initContainer logic for environment variables, which is correct. Extracting it into a shared helper would DRY up the template and make future tweaks safer.


260-275: SecretEnv logic duplication and helper usage
The secret‑env logic for PGUSER/PGPASSWORD is duplicated here. It also bypasses the new postgresql.secretName field. Consider refactoring into a helper (e.g., postgresqlSecretRef) and leveraging your _helpers.tpl function to centralize the secret‑naming logic.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between be3ab2f and ba148dd.

⛔ Files ignored due to path filters (1)
  • charts/graph-node/Chart.lock is excluded by !**/*.lock
📒 Files selected for processing (6)
  • charts/graph-node/Chart.yaml (1 hunks)
  • charts/graph-node/README.md (1 hunks)
  • charts/graph-node/templates/NOTES.txt (1 hunks)
  • charts/graph-node/templates/_helpers.tpl (1 hunks)
  • charts/graph-node/templates/graph-node/all.yaml (2 hunks)
  • charts/graph-node/values.yaml (2 hunks)
🧰 Additional context used
🪛 YAMLlint (1.35.1)
charts/graph-node/values.yaml

[error] 309-309: no new line character at the end of file

(new-line-at-end-of-file)

charts/graph-node/Chart.yaml

[error] 37-37: no new line character at the end of file

(new-line-at-end-of-file)

🪛 LanguageTool
charts/graph-node/README.md

[uncategorized] ~328-~328: Possible missing article found.
Context: ...efault and will automatically configure Graph Node to use them. #### PostgreSQL Depe...

(AI_HYDRA_LEO_MISSING_THE)


[uncategorized] ~334-~334: Loose punctuation mark.
Context: ...ables: - PRIMARY_SUBGRAPH_DATA_PGHOST: Defaults to <release-name>-postgresql...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~368-~368: Loose punctuation mark.
Context: ...ollowing environment variable: - IPFS: Defaults to `http://ipfs-...

(UNLIKELY_OPENING_PUNCTUATION)

🔇 Additional comments (14)
charts/graph-node/templates/_helpers.tpl (1)

8-18: Looks good - helper function properly determines PostgreSQL secret name.

The new template function graph-node.postgresql.secretName correctly determines the PostgreSQL secret name, either using a user-provided value or falling back to the standard naming pattern for the PostgreSQL dependency.

charts/graph-node/templates/NOTES.txt (4)

1-9: Good installation instructions and commands.

This section provides helpful post-installation guidance including commands to check the status and details of the deployment.


10-17: Clear PostgreSQL connection information.

The conditional block provides users with the necessary PostgreSQL connection details when the dependency is enabled. This helps users understand how to connect to the database.


19-24: Clear IPFS Cluster connection information.

The conditional block provides users with the necessary IPFS Cluster connection details when the dependency is enabled.


26-27: Helpful deployment verification command.

The command provided allows users to quickly verify their deployment status.

charts/graph-node/Chart.yaml (2)

18-18: Version bump is appropriate.

The chart version has been properly incremented to reflect the new feature additions.


27-37:

❓ Verification inconclusive

Dependencies are properly configured.

The PostgreSQL and IPFS Cluster dependencies are appropriately defined with proper versioning, repositories, and conditional enabling.


🏁 Script executed:

#!/bin/bash
# Check if the dependency repositories are valid
echo "Checking Bitnami repository..."
curl -s https://charts.bitnami.com/bitnami/index.yaml | grep -A 5 "name: postgresql"

echo "Checking Ethereum Helm charts repository..."
curl -s https://ethpandaops.github.io/ethereum-helm-charts/index.yaml | grep -A 5 "name: ipfs-cluster"

Length of output: 3378


🏁 Script executed:

#!/bin/bash
echo "Searching for 'name: postgresql' entries in Bitnami index.yaml"
curl -sS https://charts.bitnami.com/bitnami/index.yaml | grep -n "name: postgresql"
echo "Searching for chart version 16.6.3 in Bitnami index.yaml"
curl -sS https://charts.bitnami.com/bitnami/index.yaml | grep -n "version: 16.6.3"

Length of output: 434


Manual Verification Required: Confirm Bitnami PostgreSQL Chart Version

I ran a check against the Bitnami index and didn’t see any entries for “name: postgresql” or “version: 16.6.3.” Please manually verify that your Chart.yaml’s PostgreSQL dependency matches an existing chart in the repo:

• File: charts/graph-node/Chart.yaml
• Lines: 27–31 (PostgreSQL dependency)

If the Bitnami repo has moved to a different version, update this to the correct chart version.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 37-37: no new line character at the end of file

(new-line-at-end-of-file)

charts/graph-node/README.md (5)

326-329: Good introduction to dependencies section.

The new dependencies section clearly explains the purpose of the optional dependencies.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~328-~328: Possible missing article found.
Context: ...efault and will automatically configure Graph Node to use them. #### PostgreSQL Depe...

(AI_HYDRA_LEO_MISSING_THE)


330-340: Clear documentation for PostgreSQL dependency.

The PostgreSQL dependency section explains what environment variables are automatically configured, which is valuable information for users.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~334-~334: Loose punctuation mark.
Context: ...ables: - PRIMARY_SUBGRAPH_DATA_PGHOST: Defaults to <release-name>-postgresql...

(UNLIKELY_OPENING_PUNCTUATION)


341-362: Helpful PostgreSQL configuration example.

The example configuration provides a good starting point for users who want to customize their PostgreSQL deployment.


364-371: Clear documentation for IPFS Cluster dependency.

The IPFS Cluster dependency section explains what environment variable is automatically configured.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~368-~368: Loose punctuation mark.
Context: ...ollowing environment variable: - IPFS: Defaults to `http://ipfs-...

(UNLIKELY_OPENING_PUNCTUATION)


372-378: Helpful IPFS Cluster configuration example.

The example configuration provides a good starting point for users who want to customize their IPFS Cluster deployment.

charts/graph-node/values.yaml (2)

162-164: Approve updated secretEnv comments
The added comments clearly explain the fallback behavior for PRIMARY_SUBGRAPH_DATA_PGUSER and PRIMARY_SUBGRAPH_DATA_PGPASSWORD when no secret is provided, improving value‑file documentation.

Also applies to: 168-170


284-309: Verify Chart.yaml dependencies for new sections
You’ve introduced ipfs-cluster and postgresql blocks here, but we haven’t seen the corresponding entries in charts/graph-node/Chart.yaml. Please confirm that those charts are declared as optional dependencies (disabled by default) in Chart.yaml so these values take effect.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 309-309: no new line character at the end of file

(new-line-at-end-of-file)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant