Skip to content

Commit 0e64421

Browse files
authored
🤖 fix: register internal aggregation kinds for SSA conversion (#84)
## Summary Register `aggregation.coder.com` internal (`__internal`) kinds for `CoderWorkspace` and `CoderTemplate` in the aggregated apiserver scheme so SSA conversion can resolve hub types during API group install and request handling. ## Background After fixing the earlier structured-merge typed schema error, SSA progressed further but failed with: - `no kind "CoderTemplate" is registered for the internal version of group "aggregation.coder.com"` The aggregated scheme only registered `v1alpha1` kinds. Kubernetes generic apiserver conversion paths also require internal group registration. ## Implementation - Updated `internal/app/apiserverapp/apiserverapp.go`: - In `NewScheme()`, added `schema.GroupVersion{Group: aggregation.coder.com, Version: runtime.APIVersionInternal}`. - Registered internal known types via `scheme.AddKnownTypes(...)` for: - `CoderWorkspace` - `CoderWorkspaceList` - `CoderTemplate` - `CoderTemplateList` - Updated `internal/app/apiserverapp/apiserverapp_test.go`: - Extended `TestNewSchemeRegistersAggregationKinds` to assert both `v1alpha1` and `__internal` GVK recognition. ## Validation - `make verify-vendor` - `make test` - `make build` - `make lint` - `env GOFLAGS=-mod=vendor go test ./internal/app/apiserverapp/...` ## Risks Low risk. The change is limited to scheme registration and a focused unit test update in the aggregated apiserver package. No storage behavior or request logic changed. --- _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`_ <!-- mux-attribution: model=openai:gpt-5.3-codex thinking=xhigh costs=0.49 -->
1 parent 2272d9b commit 0e64421

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

‎internal/app/apiserverapp/apiserverapp.go‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,21 @@ func NewScheme() *runtime.Scheme {
150150
utilruntime.Must(metav1.AddMetaToScheme(scheme))
151151
utilruntime.Must(metainternalversion.AddToScheme(scheme))
152152
utilruntime.Must(aggregationv1alpha1.AddToScheme(scheme))
153+
154+
// Register aggregation types for the internal hub version so the generic API
155+
// server can convert SSA requests between v1alpha1 and __internal.
156+
aggregationInternalGroupVersion := schema.GroupVersion{
157+
Group: aggregationv1alpha1.SchemeGroupVersion.Group,
158+
Version: runtime.APIVersionInternal,
159+
}
160+
scheme.AddKnownTypes(
161+
aggregationInternalGroupVersion,
162+
&aggregationv1alpha1.CoderWorkspace{},
163+
&aggregationv1alpha1.CoderWorkspaceList{},
164+
&aggregationv1alpha1.CoderTemplate{},
165+
&aggregationv1alpha1.CoderTemplateList{},
166+
)
167+
153168
return scheme
154169
}
155170

‎internal/app/apiserverapp/apiserverapp_test.go‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212

1313
apierrors "k8s.io/apimachinery/pkg/api/errors"
1414
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
15+
"k8s.io/apimachinery/pkg/runtime"
1516
"k8s.io/apimachinery/pkg/runtime/schema"
1617
"k8s.io/apimachinery/pkg/runtime/serializer"
1718
"k8s.io/apimachinery/pkg/util/managedfields"
@@ -31,11 +32,20 @@ func TestNewSchemeRegistersAggregationKinds(t *testing.T) {
3132
t.Fatal("expected non-nil scheme")
3233
}
3334

35+
aggregationInternalGroupVersion := schema.GroupVersion{
36+
Group: aggregationv1alpha1.SchemeGroupVersion.Group,
37+
Version: runtime.APIVersionInternal,
38+
}
39+
3440
for _, gvk := range []schema.GroupVersionKind{
3541
aggregationv1alpha1.SchemeGroupVersion.WithKind("CoderWorkspace"),
3642
aggregationv1alpha1.SchemeGroupVersion.WithKind("CoderWorkspaceList"),
3743
aggregationv1alpha1.SchemeGroupVersion.WithKind("CoderTemplate"),
3844
aggregationv1alpha1.SchemeGroupVersion.WithKind("CoderTemplateList"),
45+
aggregationInternalGroupVersion.WithKind("CoderWorkspace"),
46+
aggregationInternalGroupVersion.WithKind("CoderWorkspaceList"),
47+
aggregationInternalGroupVersion.WithKind("CoderTemplate"),
48+
aggregationInternalGroupVersion.WithKind("CoderTemplateList"),
3949
} {
4050
if !scheme.Recognizes(gvk) {
4151
t.Fatalf("expected scheme to recognize %s", gvk.String())

0 commit comments

Comments
 (0)