Skip to content

Conversation

@xueli181114
Copy link
Contributor

@xueli181114 xueli181114 commented Dec 9, 2025

Summary by CodeRabbit

  • New Features

    • Optional imageTag parameter (env-sourced, default v1.0.0)
    • Added support for an exists operator in conditions
    • Preconditions now capture fields (clusterName/phase/generation) and use timeout/retry with exponential backoff
  • Refactor

    • Config model and resource layout redesigned (Param/Resource/Post shape changes)
    • Resources simplified: Secret removed, Namespace-focused discovery and a validation job introduced
    • Post processing: params → payloads; status payloads restructured (adapter + conditions)
  • Documentation

    • Updated docs and references to Adapter Config Template MVP and status endpoint path changes

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 9, 2025

Walkthrough

The PR converts the adapter config to an MVP schema: adds an optional imageTag env-sourced param and removes the mandatory hyperfleetApiToken; changes API paths to include /api/hyperfleet/ prefixes; replaces response extraction with capture-based preconditions that include timeout/retry/backoff semantics; restructures resources (removes Secret/ConfigMap/extra Deployments, replaces with Namespace and a validation Job resource, adjusts discovery to cluster-scoped); renames post paramspayloads and updates status reporting to POST to /statuses without Authorization header and with CEL-safe field access.

Sequence Diagram(s)

mermaid
sequenceDiagram
participant Adapter
participant HyperFleetAPI as HyperFleet API
participant K8sAPI as Kubernetes API
Note over Adapter,HyperFleetAPI: Precondition: fetch clusterStatus (capture clusterPhase,generationId)
Adapter->>HyperFleetAPI: GET /api/hyperfleet/v1/clusters/{clusterId} (timeout/retry/backoff)
HyperFleetAPI-->>Adapter: 200 {clusterPhase, generationId, ...}
alt clusterPhase == NotReady
Note over Adapter,K8sAPI: Create cluster-scoped resources
Adapter->>K8sAPI: Create Namespace (name from capture.clusterName)
K8sAPI-->>Adapter: 201 Created
Adapter->>K8sAPI: Create/Apply validation Job manifest (recreateOnChange)
K8sAPI-->>Adapter: 201/200
end
Note over Adapter,HyperFleetAPI: Post status payloads (no auth header)
Adapter->>HyperFleetAPI: POST /api/hyperfleet/v1/clusters/{clusterId}/statuses (payloads, timeout/retry)
HyperFleetAPI-->>Adapter: 200/202

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Review hotspots:
    • hyperfleet/components/adapter/framework/adapter-config-template-MVP.yaml (params, preconditions, resources, post/payloads)
    • adapter-frame-design.md (public type/name changes: ParameterConfig→ParamConfig, new ResourceConfig, discovery changes)
    • adapter-integration-tests.md (test fixtures, endpoints, and status assertions)
    • adapter-deployment.md and adapter-status-contract.md (endpoint and docs updates)
  • Pay attention to: CEL optional-access usage, capture vs extract semantics, retry/backoff semantics alignment, and discovery/namespace label selector correctness.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main objective: updating adapter-config-template to reflect the latest implementation, which is the core focus across multiple documentation files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

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: 3

Caution

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

⚠️ Outside diff range comments (2)
hyperfleet/components/adapter/framework/adapter-config-template-MVP.yaml (1)

75-97: Template appears to be missing imageTag param referenced by the PR summary
Under spec.params (Lines 75-97), I don’t see the optional env-sourced imageTag. If the implementation expects it (or other docs reference it), please add it here to keep the template “latest”.

hyperfleet/components/adapter/framework/adapter-frame-design.md (1)

381-385: Auth/token guidance conflicts with MVP status reporting (no Authorization header / token removed)
This section still states “Token from HYPERFLEET_API_TOKEN … (for Authorization header)” (Lines 384-385). If auth is explicitly post-MVP/future, label it as such; otherwise update/remove to match the MVP contract/template.

🧹 Nitpick comments (2)
hyperfleet/components/adapter/framework/adapter-status-contract.md (1)

9-10: Link target is a YAML, not a doc—consider renaming link text for clarity
“Adapter Config Template MVP” points to a YAML file; consider “Adapter Config Template (MVP YAML)” to set expectations.

hyperfleet/components/adapter/framework/adapter-config-template-MVP.yaml (1)

164-232: observed_time format may diverge from examples (UTC “Z” vs numeric offset)
{{ now | date "2006-01-02T15:04:05Z07:00" }} yields RFC3339 (good), but not necessarily a ...Z suffix like other examples. If you want normalized UTC to match docs/contracts, consider formatting in UTC (or clearly state offsets are expected).

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 438a2e8 and 8d1549b.

📒 Files selected for processing (6)
  • hyperfleet/components/adapter/framework/adapter-config-template-MVP.yaml (6 hunks)
  • hyperfleet/components/adapter/framework/adapter-deployment.md (2 hunks)
  • hyperfleet/components/adapter/framework/adapter-design-decisions.md (3 hunks)
  • hyperfleet/components/adapter/framework/adapter-frame-design.md (9 hunks)
  • hyperfleet/components/adapter/framework/adapter-integration-tests.md (3 hunks)
  • hyperfleet/components/adapter/framework/adapter-status-contract.md (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • hyperfleet/components/adapter/framework/adapter-deployment.md
  • hyperfleet/components/adapter/framework/adapter-design-decisions.md
🧰 Additional context used
🪛 markdownlint-cli2 (0.18.1)
hyperfleet/components/adapter/framework/adapter-frame-design.md

111-111: Spaces inside emphasis markers

(MD037, no-space-in-emphasis)

🔇 Additional comments (3)
hyperfleet/components/adapter/framework/adapter-config-template-MVP.yaml (2)

26-33: Nice addition: explicit CEL optional chaining guidance
Examples using ?. and .orValue() will prevent lots of “missing field” failures in templates.


106-126: Precondition gating semantics: double-check clusterPhase == NotReady is intended
Template now blocks unless clusterPhase equals NotReady (Lines 123-126). If adapters are supposed to act during Provisioning/Installing (common in the other docs), this example will be misleading.

hyperfleet/components/adapter/framework/adapter-frame-design.md (1)

109-115: Config model update summary reads clean and matches MVP direction
The Config / ParamConfig / PreconditionConfig / ResourceConfig / PostConfig bullets are a helpful quick map.

- `PreconditionConfig`: Defines API calls and conditions for resource creation
- `PostConfig`: Defines status evaluation and reporting logic
- `Config`: Root configuration structure matching adapter-config-template-MVP.yaml
- `ParamConfig`: Defines parameter extraction rules (env.* or event.* sources)
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix markdownlint MD037 (spaces inside emphasis)
Static analysis flags spacing inside emphasis markers at Line 111; please adjust formatting to satisfy markdownlint.

🧰 Tools
🪛 markdownlint-cli2 (0.18.1)

111-111: Spaces inside emphasis markers

(MD037, no-space-in-emphasis)

🤖 Prompt for AI Agents
In hyperfleet/components/adapter/framework/adapter-frame-design.md around line
111, markdownlint MD037 reports spaces inside emphasis markers; edit line 111 to
remove any spaces immediately inside the emphasis markers (e.g., change "*
ParamConfig *" to "*ParamConfig*" or replace with inline code backticks without
extra spaces like `ParamConfig`) so there are no spaces between the emphasis
delimiters and the text.

Comment on lines 99 to 104
**API Endpoints to Mock**:
- `GET /api/v1/clusters/{clusterId}` - Return cluster object
- `GET /api/v1/clusters/{clusterId}/statuses` - Return existing status or 404
- `POST /api/v1/clusters/{clusterId}/statuses` - Create status
- `PATCH /api/v1/clusters/{clusterId}/statuses/{statusId}` - Update status
- `GET /api/hyperfleet/v1/clusters/{clusterId}` - Return cluster object
- `GET /api/hyperfleet/v1/clusters/{clusterId}/statuses` - Return existing status or 404
- `POST /api/hyperfleet/v1/clusters/{clusterId}/statuses` - Create/upsert status
- `PATCH /api/hyperfleet/v1/clusters/{clusterId}/statuses/{statusId}` - Update status

Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Doc still contains stale /api/v1/... assertion paths—should be /api/hyperfleet/v1/...
You updated the mocked endpoints list to /api/hyperfleet/v1/... (Lines 100-103), but several assertion snippets still use /api/v1/clusters/... (e.g., Line 524, 559, 709). These should be aligned to avoid copy/paste test bugs.

Also applies to: 521-528, 556-563, 706-713

🤖 Prompt for AI Agents
In hyperfleet/components/adapter/framework/adapter-integration-tests.md around
lines 99-104 and in the assertion snippets at 521-528, 556-563, 706-713 (also
specific occurrences at ~524, ~559, ~709), there are stale paths using
/api/v1/clusters/... while the mocked endpoints use /api/hyperfleet/v1/...;
update all assertion URLs to use /api/hyperfleet/v1/... (search for any
remaining /api/v1/clusters and replace with /api/hyperfleet/v1/clusters), run a
quick grep to ensure no other occurrences remain, and keep the path segments and
parameter placeholders identical to existing mock definitions.

Comment on lines +18 to 20
**Base URL**: `{hyperfleetApiBaseUrl}/api/hyperfleet/{hyperfleetApiVersion}/clusters/{clusterId}/statuses`

**Method**:
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Doc is inconsistent with MVP: post.parameters + Authorization header + old endpoint examples remain
You updated the base URL (Line 18), but later sections still reference post.parameters.build (Line 529), include an Authorization: Bearer {hyperfleetApiToken} header (Lines 612-615), and show an example request path POST /api/v1/... (Line 625) instead of /api/hyperfleet/{version}/.... This will mislead adapter authors.

Also applies to: 525-605, 608-665


## Post-MVP Enhancements

### KEDA Autoscaling
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need to sketch future ideas here?
There are other ways like using prometheus for getting the pending messages.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That comes to my mind when I working on the helm charts deployment. How about keeping it for further reference? I won't say it's a decision, just some idea we can have in the further enhancement.

@rh-amarin
Copy link
Collaborator

/lgtm

@rh-amarin rh-amarin merged commit c3db098 into openshift-hyperfleet:main Dec 15, 2025
1 check passed
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.

2 participants