From 94330559711956410d65913b01931871ef9b3547 Mon Sep 17 00:00:00 2001 From: Thomas Kosiewski Date: Fri, 13 Feb 2026 17:49:24 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=96=20fix:=20register=20internal=20agg?= =?UTF-8?q?regation=20kinds=20for=20SSA=20conversion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Register CoderWorkspace/CoderTemplate kinds for aggregation.coder.com internal hub version in aggregated apiserver scheme setup. Also extend the NewScheme unit test to assert both v1alpha1 and __internal registrations so SSA conversion regressions are caught. --- _Generated with [`mux`](https://github.com/coder/mux) • Model: `openai:gpt-5.3-codex` • Thinking: `xhigh`_ _Generated with `mux` • Model: `openai:gpt-5.3-codex` • Thinking: `xhigh` • Cost: `$0.49`_ --- internal/app/apiserverapp/apiserverapp.go | 15 +++++++++++++++ internal/app/apiserverapp/apiserverapp_test.go | 10 ++++++++++ 2 files changed, 25 insertions(+) diff --git a/internal/app/apiserverapp/apiserverapp.go b/internal/app/apiserverapp/apiserverapp.go index 055b6acd..6ba30741 100644 --- a/internal/app/apiserverapp/apiserverapp.go +++ b/internal/app/apiserverapp/apiserverapp.go @@ -150,6 +150,21 @@ func NewScheme() *runtime.Scheme { utilruntime.Must(metav1.AddMetaToScheme(scheme)) utilruntime.Must(metainternalversion.AddToScheme(scheme)) utilruntime.Must(aggregationv1alpha1.AddToScheme(scheme)) + + // Register aggregation types for the internal hub version so the generic API + // server can convert SSA requests between v1alpha1 and __internal. + aggregationInternalGroupVersion := schema.GroupVersion{ + Group: aggregationv1alpha1.SchemeGroupVersion.Group, + Version: runtime.APIVersionInternal, + } + scheme.AddKnownTypes( + aggregationInternalGroupVersion, + &aggregationv1alpha1.CoderWorkspace{}, + &aggregationv1alpha1.CoderWorkspaceList{}, + &aggregationv1alpha1.CoderTemplate{}, + &aggregationv1alpha1.CoderTemplateList{}, + ) + return scheme } diff --git a/internal/app/apiserverapp/apiserverapp_test.go b/internal/app/apiserverapp/apiserverapp_test.go index dae8cc33..d0083ab3 100644 --- a/internal/app/apiserverapp/apiserverapp_test.go +++ b/internal/app/apiserverapp/apiserverapp_test.go @@ -12,6 +12,7 @@ import ( apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/serializer" "k8s.io/apimachinery/pkg/util/managedfields" @@ -31,11 +32,20 @@ func TestNewSchemeRegistersAggregationKinds(t *testing.T) { t.Fatal("expected non-nil scheme") } + aggregationInternalGroupVersion := schema.GroupVersion{ + Group: aggregationv1alpha1.SchemeGroupVersion.Group, + Version: runtime.APIVersionInternal, + } + for _, gvk := range []schema.GroupVersionKind{ aggregationv1alpha1.SchemeGroupVersion.WithKind("CoderWorkspace"), aggregationv1alpha1.SchemeGroupVersion.WithKind("CoderWorkspaceList"), aggregationv1alpha1.SchemeGroupVersion.WithKind("CoderTemplate"), aggregationv1alpha1.SchemeGroupVersion.WithKind("CoderTemplateList"), + aggregationInternalGroupVersion.WithKind("CoderWorkspace"), + aggregationInternalGroupVersion.WithKind("CoderWorkspaceList"), + aggregationInternalGroupVersion.WithKind("CoderTemplate"), + aggregationInternalGroupVersion.WithKind("CoderTemplateList"), } { if !scheme.Recognizes(gvk) { t.Fatalf("expected scheme to recognize %s", gvk.String())