Skip to content

Conversation

@Avi-Robusta
Copy link
Contributor

No description provided.

@coderabbitai
Copy link

coderabbitai bot commented Sep 3, 2025

Walkthrough

Adds an optional EKS assume-role parameter across CLI, config model, and Prometheus AWS config construction; updates prometrix dependency to 0.2.3 in pyproject.toml and requirements.txt.

Changes

Cohort / File(s) Summary
Dependency bump
pyproject.toml, requirements.txt
Update prometrix from 0.2.2 to 0.2.3; no other changes.
Config and CLI plumbing
robusta_krr/core/models/config.py, robusta_krr/main.py
Add optional eks_assume_role to Config; introduce --eks-assume-role CLI option and pass it into Config.
AWS Prometheus config wiring
robusta_krr/core/integrations/prometheus/prometheus_utils.py
In EKS managed Prometheus branch, pass assume_role_arn=settings.eks_assume_role to AWSPrometheusConfig; other branches unchanged.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant CLI as CLI (run_strategy)
  participant Config as Config Model
  participant Utils as prometheus_utils.generate_prometheus_config
  participant AWS as AWSPrometheusConfig

  User->>CLI: run with --eks-assume-role=<ARN>
  CLI->>Config: Construct Config(eks_assume_role=ARN, ...)
  CLI->>Utils: generate_prometheus_config(settings=Config)
  alt EKS managed Prometheus
    Utils->>AWS: new AWSPrometheusConfig(..., assume_role_arn=Config.eks_assume_role)
    AWS-->>Utils: AWS config instance
  else other providers/branches
    Utils-->>CLI: Other config instances (unchanged)
  end
  Utils-->>CLI: Prometheus config
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • [ROB-1923] - amp irsa support #465 — Also modifies the AWS-managed Prometheus configuration path, adjusting auth handling; overlaps with the AWSPrometheusConfig construction changes.

Suggested reviewers

  • arikalon1
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch irsa-cross-platform

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.
    • 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.
  • 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 the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit 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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
robusta_krr/core/integrations/prometheus/prometheus_utils.py (1)

37-51: Handle missing AWS credentials gracefully (pre-existing)

session.get_credentials() can return None. Calling get_frozen_credentials() will then crash. Add an explicit guard and a clearer error.

-        else:
-            # we need at least one parameter from credentials, but we should use whatever we can from settings (this has higher precedence)
-            credentials = credentials.get_frozen_credentials()
+        else:
+            # we need at least one parameter from credentials, but we should use whatever we can from settings (this has higher precedence)
+            if credentials is None:
+                raise Exception(
+                    "No AWS credentials found for EKS Managed Prometheus. "
+                    "Provide --eks-profile-name or --eks-access-key/--eks-secret-key, "
+                    "or configure credentials via environment/IRSA."
+                )
+            credentials = credentials.get_frozen_credentials()
🧹 Nitpick comments (3)
robusta_krr/core/models/config.py (1)

49-49: Validate eks_assume_role as an IAM Role ARN

Add a light validator to catch typos early (supports aws, aws-cn, aws-us-gov partitions).

Additional code (outside this hunk):

@pd.validator("eks_assume_role")
def validate_eks_assume_role(cls, v: Optional[str]) -> Optional[str]:
    if v is None:
        return v
    import re
    pat = r"^arn:(aws(-[a-z]+)?):iam::\d{12}:role\/.+$"
    if not re.match(pat, v):
        raise ValueError("--eks-assume-role must be a valid IAM role ARN, e.g. arn:aws:iam::123456789012:role/metrics-readonly")
    return v
robusta_krr/core/integrations/prometheus/prometheus_utils.py (1)

53-55: Simplify service_name selection

Minor: prefer a straightforward defaulting.

-        service_name = settings.eks_service_name if settings.eks_secret_key else "aps"
+        service_name = settings.eks_service_name or "aps"
robusta_krr/main.py (1)

186-191: Clarify help text with ARN example

Add a concrete ARN example to reduce user error.

-                    help="Sets the assumed role for eks prometheus connection. (for cross-account role assumption)",
+                    help="IAM role ARN to assume for AWS Managed Prometheus (cross-account supported), e.g. arn:aws:iam::123456789012:role/metrics-readonly",
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between f82111d and da0bfca.

⛔ Files ignored due to path filters (1)
  • poetry.lock is excluded by !**/*.lock
📒 Files selected for processing (5)
  • pyproject.toml (1 hunks)
  • requirements.txt (1 hunks)
  • robusta_krr/core/integrations/prometheus/prometheus_utils.py (1 hunks)
  • robusta_krr/core/models/config.py (1 hunks)
  • robusta_krr/main.py (2 hunks)
🔇 Additional comments (4)
requirements.txt (1)

30-30: Prometrix bump to 0.2.3 — assume_role_arn supported
Confirmed that AWSPrometheusConfig in prometrix v0.2.3 defines an assume_role_arn field.

pyproject.toml (1)

33-33: Sync with requirements — LGTM

Version pin matches requirements.txt. Remember to refresh the lockfile (poetry lock) before merging.

robusta_krr/core/integrations/prometheus/prometheus_utils.py (1)

63-65: Pass-through of assume_role_arn — LGTM

Forwarding settings.eks_assume_role into AWSPrometheusConfig is correct.

robusta_krr/main.py (1)

352-352: Value is correctly plumbed into Config

eks_assume_role is passed through to Config as expected.

@arikalon1 arikalon1 merged commit c7c6601 into main Sep 3, 2025
3 checks passed
@arikalon1 arikalon1 deleted the irsa-cross-platform branch September 3, 2025 07:28
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.

3 participants