Skip to content

HYPERFLEET-978 - feat: (1/2) Add PUT command for internal status endpoints …#36

Open
ma-hill wants to merge 1 commit intoopenshift-hyperfleet:mainfrom
ma-hill:HYPERFLEET-978
Open

HYPERFLEET-978 - feat: (1/2) Add PUT command for internal status endpoints …#36
ma-hill wants to merge 1 commit intoopenshift-hyperfleet:mainfrom
ma-hill:HYPERFLEET-978

Conversation

@ma-hill
Copy link
Copy Markdown

@ma-hill ma-hill commented Apr 30, 2026

Summary

This change adds the PUT endpoint to the api-spec, which handles the idempotent upserts of statuses coming from the adapter.

Changes in Step 1 of 2:

Endpoints Added to API spec

  • PUT /api/hyperfleet/v1/clusters/{cluster_id}/statuses
  • PUT /api/hyperfleet/v1/clusters/{cluster_id}/nodepools/{nodepool_id}/statuses
  • POST endpoints were not removed in this change, will make a subsequent change once other components are updated.

Update version from 1.0.8 --> 1.0.9

Test Plan

  • npm build:all
  • Format tsp files
  • Deployed to a development cluster and verified (if Helm/config changes)

Jira Issue

Summary by CodeRabbit

  • New Features

    • Added new PUT endpoints for creating or updating adapter statuses for both cluster and nodepool resources, enabling upsert operations with proper error handling (400/404/409 responses).
  • Documentation

    • Updated API documentation to reflect that internal status write operations now use PUT instead of POST.
  • Version Update

    • Bumped API version to 1.0.9.

@openshift-ci openshift-ci Bot requested a review from crizzo71 April 30, 2026 20:09
@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Apr 30, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign ciaranroche for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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 requested a review from rh-amarin April 30, 2026 20:09
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 30, 2026

Walkthrough

This PR updates the API from version 1.0.8 to 1.0.9 across specification and service definition files. New PUT endpoints are added for adapter status upsert operations: putClusterStatuses and putNodePoolStatuses at the cluster and nodepool levels in the internal API service. Both endpoints accept AdapterStatusCreateRequest and return CreatedResponse & AdapterStatus with standardized error responses. Duplicate BadRequestResponse declarations in existing POST endpoints are removed, and documentation is updated to reflect the changed HTTP method for internal status operations.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding PUT endpoints for internal status operations as part of the API spec update (version bump from 1.0.8 to 1.0.9).
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ 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.

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 `@services/statuses-internal.tsp`:
- Around line 61-62: The NodePoolStatusesInternal interface is missing the
authentication decorator and exposes putNodePoolStatuses without the same guard
as ClusterStatusesInternal; add the `@useAuth`(HyperFleet.BearerAuth) decorator
above the NodePoolStatusesInternal interface declaration so that the
putNodePoolStatuses operation (and any other methods on
NodePoolStatusesInternal) are protected by the same auth guard as
ClusterStatusesInternal.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: 0b891817-811c-493a-8739-d54617787301

📥 Commits

Reviewing files that changed from the base of the PR and between 31fbfe1 and 8705836.

📒 Files selected for processing (7)
  • README.md
  • main.tsp
  • schemas/core/openapi.yaml
  • schemas/core/swagger.yaml
  • schemas/gcp/openapi.yaml
  • schemas/gcp/swagger.yaml
  • services/statuses-internal.tsp

Comment on lines 61 to +62
@route("/clusters/{cluster_id}/nodepools/{nodepool_id}/statuses")
interface NodePoolStatusesInternal{

interface NodePoolStatusesInternal {
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 | 🟠 Major | ⚡ Quick win

Add auth to NodePoolStatusesInternal before shipping new PUT write endpoint.

NodePoolStatusesInternal is missing @useAuth(HyperFleet.BearerAuth) (Line 62), so the new putNodePoolStatuses operation (Line 88-Line 104) is currently exposed without the same auth guard used by ClusterStatusesInternal. This expands unauthenticated write surface for adapter statuses.

Suggested fix
 `@route`("/clusters/{cluster_id}/nodepools/{nodepool_id}/statuses")
+@useAuth(HyperFleet.BearerAuth)
 interface NodePoolStatusesInternal {

Also applies to: 88-104

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@services/statuses-internal.tsp` around lines 61 - 62, The
NodePoolStatusesInternal interface is missing the authentication decorator and
exposes putNodePoolStatuses without the same guard as ClusterStatusesInternal;
add the `@useAuth`(HyperFleet.BearerAuth) decorator above the
NodePoolStatusesInternal interface declaration so that the putNodePoolStatuses
operation (and any other methods on NodePoolStatusesInternal) are protected by
the same auth guard as ClusterStatusesInternal.

Comment thread README.md
- **`services/clusters.tsp`** - Cluster resource endpoints
- **`services/statuses.tsp`** - Status resource endpoints (GET only - public API)
- **`services/statuses-internal.tsp`** - Status write endpoints (POST - internal API, see below)
- **`services/statuses-internal.tsp`** - Status write endpoints (PUT - internal API, see below)
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.

Since the file still contains POST endpoints, we should add it here too. Maybe we can update this in step 2 when the POST is actually removed. Wdyt?

Suggested change
- **`services/statuses-internal.tsp`** - Status write endpoints (PUT - internal API, see below)
- **`services/statuses-internal.tsp`** - Status write endpoints (POST/PUT - internal API, see below)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Gotcha, ya that makes sense.

@path nodepool_id: string,
@path cluster_id: string,

@path nodepool_id: string,
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.

nit: Missing JSDoc description

Suggested change
@path nodepool_id: string,
/**
* NodePool ID
*/
@path nodepool_id: string,

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Will add :)

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