Skip to content

NE-2390: Adding AGENTS.md file#1341

Merged
openshift-merge-bot[bot] merged 3 commits intoopenshift:masterfrom
Thealisyed:addingagentmd
Apr 21, 2026
Merged

NE-2390: Adding AGENTS.md file#1341
openshift-merge-bot[bot] merged 3 commits intoopenshift:masterfrom
Thealisyed:addingagentmd

Conversation

@Thealisyed
Copy link
Copy Markdown
Contributor

@Thealisyed Thealisyed commented Jan 15, 2026

Adding AGENTS.md file

Adding this AGENTS.md file will allow
all ai agents to index and refer to
this file for contextual awareness

@openshift-ci openshift-ci Bot requested review from candita and rfredette January 15, 2026 13:11
@Thealisyed Thealisyed changed the title Addingagentmd NE-2390: Adding AGENTS.md file Jan 15, 2026
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jan 15, 2026
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

openshift-ci-robot commented Jan 15, 2026

@Thealisyed: This pull request references NE-2390 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.22.0" version, but no target version was set.

Details

In response to this:

Adding AGENTS.md file

Adding this AGENTS.md file will allow
all ai agents to index and refer to
this file for contextual awareness

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

Adding this AGENTS.md file will allow
all ai agents to index and refer to
this file for contextual awareness

Assisted with Claude
@candita
Copy link
Copy Markdown
Contributor

candita commented Jan 21, 2026

All team members should check into this, with Brett as lead.

/assign @bentito
/assign

Copy link
Copy Markdown
Contributor

@bentito bentito left a comment

Choose a reason for hiding this comment

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

Overall, this is a strong addition that will significantly help agents (and humans) navigate the repo.

Review Comments

Strengths:

  • Naming Conventions: The table of naming helpers (like RouterDeploymentName) is excellent. This is the #1 thing agents get wrong (hallucinating names), so having the canonical list is huge.
  • Structure: The directory tree provides a good mental map.

Suggestions for Improvement:

  1. Refine "Project Structure":

    • The entry pkg/operator/controller/ # Reconciliation controllers implies the controllers are in that directory. In reality, they are in subdirectories (e.g., pkg/operator/controller/ingress/).
    • Suggestion: Clarify that this directory contains sub-packages for each controller type.
  2. Document the ensure Pattern:

    • The codebase heavily uses an ensureX pattern in reconcilers (e.g., ensureIngressController, ensureIngressDeleted in pkg/operator/controller/ingress/controller.go).
    • Suggestion: Add a note in the "Coding Style" or "Architecture" section: "Controllers typically delegate logic to ensure<Resource> methods that handle creation/update of specific resources."
  3. Encourage Constants over Strings:

    • The "Important Annotations" section lists raw string values.
    • Suggestion: Reference the Go constants (e.g., controller.IngressOperatorOwnedAnnotation in pkg/operator/controller/names.go). This encourages agents to import the constant rather than hardcoding the string, which is safer.
  4. Reference a "Golden" Test File:

    • Suggestion: Explicitly point to pkg/operator/controller/ingress/controller_test.go as the standard for how controller tests should be written. This gives an agent a concrete template to mimic.
  5. Manifests:

    • A brief mention of pkg/manifests and how assets are loaded/bound would be helpful context, as valid manifest generation is often tricky.

Great work on this doc!

Copy link
Copy Markdown
Contributor

@Miciah Miciah left a comment

Choose a reason for hiding this comment

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

It is interesting to compare this with openshift/router#710. In particular, is it useful to mention conventions for commit messages, PR descriptions, test coverage, and logical commits?

There is also some overlap with the design details in #1339, but that has a lot of content that was AI-generated and needs to be verified.

Comment thread AGENTS.md
Comment thread AGENTS.md Outdated
cluster-ingress-operator/
├── cmd/ingress-operator/ # Main entry point
│ ├── main.go # CLI commands (start, render)
│ └── start.go # Operator initialization and controller registration
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.

Controllers are registered in pkg/operator/operator.go.

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.

This is addressed in commit 76aebbe. The AGENTS.md file has been updated to correctly identify pkg/operator/operator.go for controller registration and cmd/ingress-operator/start.go for metrics.

Comment thread AGENTS.md Outdated
Comment thread AGENTS.md Outdated
Comment thread AGENTS.md Outdated
Comment thread AGENTS.md Outdated
Comment thread AGENTS.md

### Error Handling

- Return errors with context: `fmt.Errorf("failed to create deployment: %w", err)`
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.

Worth calling out explicitly: Use %w for wrapped error values (as in the example).

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.

This is addressed in commit 76aebbe. Explicit instructions to use %w for error wrapping and to follow Kubernetes logging conventions have been added to the 'Coding Style' section.

Comment thread AGENTS.md
### Logging

- Use structured logging via `go-logr/logr`
- Include relevant context (namespace, name, resource type)
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.

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.

commit 76aebbe added instructions to follow Kubernetes logging conventions to the 'Coding Style' section.

Comment thread AGENTS.md Outdated
Comment thread AGENTS.md Outdated
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 2, 2026

Walkthrough

Adds a new repository-wide documentation file AGENTS.md that specifies operating guidance for AI coding agents: system context, namespace constraints, CRD matrix, controller topology, error/condition handling, DNS/provider patterns, testing/linting/build instructions, coding conventions, and contribution rules (no code changes).

Changes

Cohort / File(s) Summary
Documentation
AGENTS.md
New guidance document for AI agents detailing repository architecture (north-south L4/L7, HAProxy vs Gateway API), namespace separation, CRD matrix, controller directory topology, error/condition handling rules, DNS provider interface, controller creation pattern, testing conventions (unit vs e2e), lint/build/run targets, coding and logging conventions, feature gates, distribution/deployment notes, and contribution guidelines. No code or API changes.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 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 'NE-2390: Adding AGENTS.md file' is clear and directly describes the main change: adding a new documentation file (AGENTS.md) to guide AI coding agents.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Stable And Deterministic Test Names ✅ Passed This check is not applicable to the provided pull request. The PR adds only an AGENTS.md documentation file that provides guidance for AI agents working with the repository. The file does not contain any test code, test definitions, or test titles (such as Ginkgo-style It(), Describe(), Context(), or When() blocks). While the documentation references test patterns and conventions in the repository, it does not define or modify actual test code where the Stable and Deterministic Test Names requirement would apply. Therefore, this check is inapplicable to this documentation-only PR.
Test Structure And Quality ✅ Passed The custom check for 'Test Structure and Quality' is not applicable to this pull request as only documentation file AGENTS.md is added.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@openshift-ci-robot
Copy link
Copy Markdown
Contributor

openshift-ci-robot commented Mar 2, 2026

@Thealisyed: This pull request references NE-2390 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.22.0" version, but no target version was set.

Details

In response to this:

Adding AGENTS.md file

Adding this AGENTS.md file will allow
all ai agents to index and refer to
this file for contextual awareness

Summary by CodeRabbit

  • Documentation
  • Added comprehensive guidance documentation covering development patterns, project structure, testing procedures, linting, building, and contribution conventions.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

Copy link
Copy Markdown

@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: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@AGENTS.md`:
- Around line 7-32: The fenced code block in AGENTS.md that contains the
repository tree snippet is missing a language identifier; update the opening
triple backticks for that block to "```text" so the snippet is treated as plain
text (i.e., change the block starting with "```" before the
cluster-ingress-operator/ tree to "```text").

ℹ️ Review info

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 56e2977 and 76aebbe.

📒 Files selected for processing (1)
  • AGENTS.md

Comment thread AGENTS.md
Comment on lines +7 to +32
```
cluster-ingress-operator/
├── cmd/ingress-operator/ # Main entry point
│ ├── main.go # CLI commands (start, render)
│ ├── render.go # Manifest rendering command
│ └── start.go # Operator startup and metrics registration
├── pkg/
│ ├── operator/
│ │ ├── operator.go # Controller registration
│ │ ├── controller/ # Reconciliation controllers (sub-packages per controller)
│ │ ├── client/ # Kubernetes client setup with custom schemes
│ │ └── config/ # Operator configuration structure
│ ├── dns/ # DNS provider implementations
│ │ ├── aws/ # AWS Route 53
│ │ ├── azure/ # Azure DNS
│ │ ├── gcp/ # Google Cloud DNS
│ │ ├── ibm/ # IBM Cloud DNS (public and private)
│ │ └── split/ # Meta-provider routing between public/private
│ └── manifests/ # Kubernetes object manifests used by controllers
├── manifests/ # CVO manifests (CRDs, RBAC, monitoring) — instantiated by CVO, not used by operator directly
├── test/
│ └── e2e/ # End-to-end integration tests
├── hack/ # Development and CI scripts
├── Makefile # Build automation
└── HACKING.md # Developer documentation
```
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Add a language identifier to the fenced block.

Line 7 uses a fenced code block without a language, which triggers MD040. Use text for the tree snippet.

Suggested diff
-```
+```text
 cluster-ingress-operator/
 ├── cmd/ingress-operator/        # Main entry point
 │   ├── main.go                  # CLI commands (start, render)
 │   ├── render.go                # Manifest rendering command
 │   └── start.go                 # Operator startup and metrics registration
 ...
 └── HACKING.md                   # Developer documentation
</details>

<details>
<summary>🧰 Tools</summary>

<details>
<summary>🪛 markdownlint-cli2 (0.21.0)</summary>

[warning] 7-7: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

</details>

</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

Verify each finding against the current code and only fix it if needed.

In @AGENTS.md around lines 7 - 32, The fenced code block in AGENTS.md that
contains the repository tree snippet is missing a language identifier; update
the opening triple backticks for that block to "text" so the snippet is treated as plain text (i.e., change the block starting with "" before the
cluster-ingress-operator/ tree to "```text").


</details>

<!-- fingerprinting:phantom:triton:hawk -->

<!-- This is an auto-generated comment by CodeRabbit -->

@bentito
Copy link
Copy Markdown
Contributor

bentito commented Mar 13, 2026

Sorry, this review is much delayed, but for now just a top-level comment that will require an added chunk:

You've got a good code standards outine so far and decent repo layout to quick orientation, but I think it needs more of an overall this is how CIO fits in:

The AGENTS.md needs to orient the agent on CIO's place in the cluster networking galaxy. I'm not sure about the ideal set of quick knowledge we can convey, but here's a starter list:

  • What CRs it manages (complete list) and why and how that fits into OCP
  • What its main operand haproxy/router does
  • What configs for router it is and isn't responsible for
  • The fact that it manages OSSM
  • ...

We should really pull together several people for a meeting with the agenda titled "What would you tell a new coder about CIO in their first month on the team?", digest the notes from that meeting and put it in AGENTS.md

Here's an example proposal, something we could discuss at a meeting to expand, delete, change:

AGENTS.md

1. SYSTEM CONTEXT & TOPOLOGY

  • Domain: North-South network traffic management (Layer 7 & Layer 4).
  • Prerequisites: CNI (Cluster Network Operator), Pod IP routing, internal CoreDNS.
  • Dual Architecture Mode:
    1. Legacy/Primary: HAProxy orchestration via openshift3/ose-haproxy-router.
    2. Modern/GWAPI: Gateway API via OpenShift Service Mesh (OSSM / Istio / Envoy).

2. STRICT NAMESPACE BOUNDARIES

  • openshift-ingress-operator: Execution environment for operator logic, control loops, and metrics endpoints. DO NOT deploy data-plane operands here.
  • openshift-ingress: Execution environment for all data-plane workloads. HAProxy pods, haproxy.cfg ConfigMaps, TLS secrets, Envoy proxies, and Services MUST be strictly confined to this namespace.

3. CUSTOM RESOURCE DEFINITION (CRD) MATRIX

Core Configuration

  • Ingress (config.openshift.io/v1, Cluster-scoped): Defines cluster-wide routing defaults and toggles.
  • IngressController (operator.openshift.io/v1, Namespace-scoped): Primary interface for legacy HAProxy. Controls replicas, deployment affinity, and endpoint publishing.
  • DNSRecord (ingress.operator.openshift.io/v1, Namespace-scoped): Internal abstraction for cloud DNS manipulation.

Gateway API (GWAPI)

  • GatewayClass: Trigger resource. Detecting openshift.io/gateway-controller/v1 initiates OSSM deployment.
  • Gateway: Defines external proxy instances / ports. Mapped to Envoy proxies.
  • HTTPRoute: Advanced routing, traffic weighting, and header matching to backend services.

4. DIRECTORY TOPOGRAPHY

  • pkg/operator/controller/ingress/: Legacy core. Reconciles IngressController and manages HAProxy deployment, load balancer services, and status loops.
  • pkg/operator/controller/dns/: Fulfills DNSRecord resources. Interfaces with AWS/GCP/Azure SDKs.
  • pkg/operator/controller/gatewayapi/: GWAPI meta-controller. Manages CRD lifecycles and launches dependent watchers.
  • pkg/operator/controller/gatewayclass/: Provisions OSSM and generates the ServiceMeshControlPlane.
  • pkg/operator/controller/certificate/: Manages automated certificate rotation and expiry.

5. TACTICAL DIRECTIVES & CONSTRAINTS

  • RULE 1: No Silent Failures. If a cloud API times out or a version conflict occurs, set the expected error condition in .status.conditions (expectedCondition in status.go) and mark the operator as Degraded.
  • RULE 2: OSSM Meta-Management for GWAPI. The operator does not write Envoy configs directly. It manages the OpenShift Service Mesh Operator by generating a ServiceMeshControlPlane (SMCP) resource.
  • RULE 3: Decouple DNS for GWAPI. Directly generate DNSRecord objects for GWAPI endpoints; do not tie external endpoints for Envoy to the legacy HAProxy IngressController.
  • RULE 4: Finalizer Management. Explicitly handle the removal of finalizers (e.g., ingress.openshift.io/operator) during deletion workflows in load_balancer_service.go to prevent infinite Terminating states.
  • RULE 5: Cloud Credential Operator (CCO) Awareness. Gracefully degrade and report HTTP 403 Forbidden errors if assumed roles lack permissions in "manual mode" where dynamic IAM credentials are disabled.
  • RULE 6: Immutable HAProxy Template. Do not inject arbitrary, unsupported HAProxy directives into the base router template.

6. EXPLICIT NON-GOALS

  • Managing underlying cloud infrastructure subnets or legacy security groups.
  • Fixing application-level protocol downgrade failures (e.g., HTTP/2 to WebSocket).
  • Generating default TLS certificates for Envoy proxies.

@Thealisyed
Copy link
Copy Markdown
Contributor Author

Yes I agree @bentito. That would be the best approach not only for CIO but also CDO too. Having all our SME's discuss to ensure we capture to the best of our ability for the AGENTS.md file in each respective repo

@davidesalerno
Copy link
Copy Markdown
Contributor

Could it be useful to add a CLAUDE.md with a reference to the AGENTS.md?

I mean something like this.

cc @bentito @Miciah

@bentito
Copy link
Copy Markdown
Contributor

bentito commented Mar 27, 2026

Could it be useful to add a CLAUDE.md with a reference to the AGENTS.md?

I mean something like this.

AGENTS.md is a good choice because Claude respects it in the same way as the proprietary CLAUDE.md

@openshift-ci-robot
Copy link
Copy Markdown
Contributor

openshift-ci-robot commented Apr 1, 2026

@Thealisyed: This pull request references NE-2390 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.22.0" version, but no target version was set.

Details

In response to this:

Adding AGENTS.md file

Adding this AGENTS.md file will allow
all ai agents to index and refer to
this file for contextual awareness

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

Copy link
Copy Markdown

@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.

♻️ Duplicate comments (1)
AGENTS.md (1)

50-75: ⚠️ Potential issue | 🟡 Minor

Add language identifier to the fenced code block.

The code block displaying the project directory tree is missing a language identifier, triggering the MD040 markdown linting warning.

📝 Proposed fix
-```
+```text
 cluster-ingress-operator/
 ├── cmd/ingress-operator/        # Main entry point
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@AGENTS.md` around lines 50 - 75, The fenced code block showing the project
directory tree is missing a language identifier; update the opening fence from
``` to ```text so the block is explicitly marked as plain text (modify the
fenced block that contains the directory tree starting with
"cluster-ingress-operator/" in AGENTS.md).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@AGENTS.md`:
- Around line 50-75: The fenced code block showing the project directory tree is
missing a language identifier; update the opening fence from ``` to ```text so
the block is explicitly marked as plain text (modify the fenced block that
contains the directory tree starting with "cluster-ingress-operator/" in
AGENTS.md).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 68e3f04c-7281-46d7-a912-f3eb23ac96d9

📥 Commits

Reviewing files that changed from the base of the PR and between 76aebbe and 28f66b0.

📒 Files selected for processing (1)
  • AGENTS.md

@bentito
Copy link
Copy Markdown
Contributor

bentito commented Apr 1, 2026

I've added to the doc along the lines of my comment about needing to help orient an agent on CIO's place in the NIDS world.

Comments on whether that orientation seems correct and complete are very welcome.

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Apr 1, 2026

@Thealisyed: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-aws-operator-techpreview 28f66b0 link false /test e2e-aws-operator-techpreview

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@bentito
Copy link
Copy Markdown
Contributor

bentito commented Apr 6, 2026

/lgtm

I'd like to merge this and then have a team discussion about what's needed more broadly for agents to do well (better?) on all of our repos and move to a scenario where AGENTS.md is just a table of contents into a agentic dir with section-of-codebase/area-of-responsibilty specific instructions for each.

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Apr 6, 2026
@melvinjoseph86
Copy link
Copy Markdown

/verified later @mjoseph

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Apr 21, 2026
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

@melvinjoseph86: This PR has been marked to be verified later by @mjoseph.

Details

In response to this:

/verified later @mjoseph

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@davidesalerno
Copy link
Copy Markdown
Contributor

/approve

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Apr 21, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: davidesalerno

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 Apr 21, 2026
@openshift-merge-bot openshift-merge-bot Bot merged commit 1aec6b8 into openshift:master Apr 21, 2026
7 of 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. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. verified Signifies that the PR passed pre-merge verification criteria verified-later

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants