Skip to content

adding enable_write_sre_tools flag#676

Merged
openshift-merge-bot[bot] merged 1 commit into
openshift-online:mainfrom
Makdaam:ROSAENG-61363
Jul 14, 2026
Merged

adding enable_write_sre_tools flag#676
openshift-merge-bot[bot] merged 1 commit into
openshift-online:mainfrom
Makdaam:ROSAENG-61363

Conversation

@Makdaam

@Makdaam Makdaam commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

What:
ROSAENG-61363

  • makes SRE WebUI tools read-only by default
  • adds a flag to re-enable read-write access in ephemeral envs
  • doesn't allow the flag to be set in non-ephemeral envs

Why:

  • we're moving towards ZOA actions, and away from making changes outside of that framework

Test steps:

  • uv run scripts/test_render.py
  • provisioned ephemeral env with defaults - grafana isn't editable, argocd doesn't allow resyncs or modifications
  • provisioned ephemeral env with enable_write_sre_tools: true - grafana is editable, argocd is in full admin mode

Summary by CodeRabbit

  • New Features

    • Added regional_cluster.enable_write_sre_tools to control SRE tool access (read-only vs admin) for ephemeral environments.
  • Bug Fixes

    • Updated Grafana and Argo CD so access/anonymous login and default RBAC change based on the selected mode.
    • Prevented write/admin access from being enabled in non-ephemeral environments.
  • Documentation

    • Documented the new flag and its access behavior.
  • Tests

    • Added coverage to verify the environment gating and rendered Grafana/Argo CD settings.

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Adds an ephemeral-only regional_cluster.enable_write_sre_tools flag that controls Grafana and Argo CD access modes. Rendering now rejects the flag outside ephemeral environments, with corresponding environment configuration, documentation, and tests.

Changes

SRE tools access control

Layer / File(s) Summary
Access flag and templated RBAC contract
config/defaults.yaml
Defines the flag and templates Grafana anonymous roles plus Argo CD admin, anonymous, and default RBAC settings from its value.
Environment configuration and rendered overlays
config/ephemeral/defaults.yaml, deploy/ephemeral/us-east-1/..., deploy/integration/us-east-1/...
Enables the flag for ephemeral defaults and adds the corresponding merged configurations and rendered Helm values for ephemeral and integration environments.
Ephemeral-only render enforcement
scripts/render.py
Raises ValueError when write access is enabled for a non-ephemeral environment.
Behavior tests and development documentation
scripts/test_render.py, docs/development-environment.md
Documents the access modes and validates environment gating and rendered Grafana and Argo CD settings.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
    participant Config as Environment configuration
    participant Render as render.py
    participant Values as Grafana and Argo CD values

    Config->>Render: enable_write_sre_tools
    alt enabled in non-ephemeral environment
        Render-->>Config: raise ValueError
    else enabled in ephemeral environment
        Render->>Values: render Grafana Admin and Argo CD admin settings
    else disabled
        Render->>Values: render Grafana Viewer and Argo CD read-only settings
    end
Loading

Suggested reviewers: typeid, jmelis

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: introducing the new enable_write_sre_tools flag.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
scripts/test_render.py (1)

2019-2119: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Duplicated fixture dict across two tests.

sre_tools_applications is defined identically in test_write_sre_tools_false_renders_readonly_overlay and test_write_sre_tools_true_renders_admin_overlay_for_ephemeral. Consider extracting to a shared helper/fixture to avoid drift if the template changes.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/test_render.py` around lines 2019 - 2119, The two tests duplicate the
same sre_tools_applications fixture data, which risks drift if the template
changes. Extract the shared dict into a reusable helper or pytest fixture in
this test module, then have test_write_sre_tools_false_renders_readonly_overlay
and test_write_sre_tools_true_renders_admin_overlay_for_ephemeral reference that
shared source instead of redefining it inline.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@scripts/test_render.py`:
- Around line 2019-2119: The two tests duplicate the same sre_tools_applications
fixture data, which risks drift if the template changes. Extract the shared dict
into a reusable helper or pytest fixture in this test module, then have
test_write_sre_tools_false_renders_readonly_overlay and
test_write_sre_tools_true_renders_admin_overlay_for_ephemeral reference that
shared source instead of redefining it inline.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 0f7bb882-2a98-4dc1-baa1-a4a80e077c93

📥 Commits

Reviewing files that changed from the base of the PR and between 942b09d and 94ca536.

📒 Files selected for processing (8)
  • config/defaults.yaml
  • deploy/ephemeral/us-east-1/_merged_config.yaml
  • deploy/ephemeral/us-east-1/argocd-values-regional-cluster.yaml
  • deploy/integration/us-east-1/_merged_config.yaml
  • deploy/integration/us-east-1/argocd-values-regional-cluster.yaml
  • docs/development-environment.md
  • scripts/render.py
  • scripts/test_render.py

@Makdaam Makdaam added the review-ready Indicates that a PR is ready for human review. label Jul 14, 2026
@@ -1 +1 @@
# GENERATED FILE - DO NOT EDIT MANUALLY

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

suggestion: default to write enabled for sre tools for ephemeral environments. This makes sense as a default.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Changed the default and re-tested the provisioning. Ready for review.

@typeid typeid removed the review-ready Indicates that a PR is ready for human review. label Jul 14, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
scripts/test_render.py (1)

2019-2136: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider extracting the sre_tools_applications dictionary to avoid duplication.

The sre_tools_applications dictionary setup is duplicated across test_write_sre_tools_false_renders_readonly_overlay and test_write_sre_tools_true_renders_admin_overlay_for_ephemeral. Consider extracting it into a class-level constant (e.g., SRE_TOOLS_APPLICATIONS = {...}) or a shared Pytest fixture to improve test maintainability and adhere to DRY principles.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/test_render.py` around lines 2019 - 2136, Extract the duplicated
sre_tools_applications dictionary from
test_write_sre_tools_false_renders_readonly_overlay and
test_write_sre_tools_true_renders_admin_overlay_for_ephemeral into a shared
class-level constant or pytest fixture, then reuse it in both tests without
changing their existing assertions or behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@scripts/test_render.py`:
- Around line 2019-2136: Extract the duplicated sre_tools_applications
dictionary from test_write_sre_tools_false_renders_readonly_overlay and
test_write_sre_tools_true_renders_admin_overlay_for_ephemeral into a shared
class-level constant or pytest fixture, then reuse it in both tests without
changing their existing assertions or behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: c0e83eca-478c-4ce3-95f1-c594f0ed8058

📥 Commits

Reviewing files that changed from the base of the PR and between 94ca536 and 2ea66d8.

📒 Files selected for processing (9)
  • config/defaults.yaml
  • config/ephemeral/defaults.yaml
  • deploy/ephemeral/us-east-1/_merged_config.yaml
  • deploy/ephemeral/us-east-1/argocd-values-regional-cluster.yaml
  • deploy/integration/us-east-1/_merged_config.yaml
  • deploy/integration/us-east-1/argocd-values-regional-cluster.yaml
  • docs/development-environment.md
  • scripts/render.py
  • scripts/test_render.py
🚧 Files skipped from review as they are similar to previous changes (2)
  • config/defaults.yaml
  • scripts/render.py

@Makdaam Makdaam added the review-ready Indicates that a PR is ready for human review. label Jul 14, 2026

@typeid typeid left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

/lgtm
/approve

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Jul 14, 2026
@openshift-ci

openshift-ci Bot commented Jul 14, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: typeid

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

The pull request process is described here

Details 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

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 14, 2026
@openshift-merge-bot
openshift-merge-bot Bot merged commit ef2104e into openshift-online:main Jul 14, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. review-ready Indicates that a PR is ready for human review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants