Skip to content

Commit 57f12dc

Browse files
authored
Merge pull request #4867 from mbarnes/mbarnes/ARO-27472
Accept any API version on the operations endpoint
2 parents 9c99280 + 98e6dc0 commit 57f12dc

2 files changed

Lines changed: 14 additions & 5 deletions

File tree

pkg/frontend/frontend.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,16 @@ func (f *frontend) chiAuthenticatedRoutes(router chi.Router) {
446446

447447
r.Put("/subscriptions/{subscriptionId}", f.putSubscription)
448448

449-
r.With(f.apiVersionMiddleware.ValidateAPIVersion).Get("/providers/{resourceProviderNamespace}/operations", f.getOperations)
449+
// Do not validate the API version on the operations endpoint. ARM will only route
450+
// registered API versions to this service, but that may be an ARO-HCP version that
451+
// this service does not recognize.
452+
//
453+
// The operations endpoint response must be identical across all API versions within
454+
// this provider namespace regardless of which service the API version is meant for.
455+
// To accomplish this, ARM uses a FanOut routing type for this endpoint. The request
456+
// is "fanned out" to an ARO Classic and an ARO-HCP endpoint. Each service responds
457+
// with its own set of operations, and ARM aggregates them for us.
458+
r.Get("/providers/{resourceProviderNamespace}/operations", f.getOperations)
450459
}
451460

452461
func notFound(w http.ResponseWriter, r *http.Request) {

pkg/frontend/operations_get_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ func TestGetOperations(t *testing.T) {
4444
wantResponse: allOperations,
4545
},
4646
{
47-
name: "api does not exist",
48-
apiVersion: "invalid",
49-
wantStatusCode: http.StatusBadRequest,
50-
wantError: "400: InvalidResourceType: : The resource type '' could not be found in the namespace 'microsoft.redhatopenshift' for api version 'invalid'.",
47+
name: "unrecognized API version still returns operations",
48+
apiVersion: "2025-12-23-preview", // this is an ARO-HCP version
49+
wantStatusCode: http.StatusOK,
50+
wantResponse: allOperations,
5151
},
5252
} {
5353
t.Run(tt.name, func(t *testing.T) {

0 commit comments

Comments
 (0)