Skip to content

Commit

Permalink
apiserver: add WatchEvent as unversioned object (#82)
Browse files Browse the repository at this point in the history
borrowed from
https://github.com/kubernetes/apiextensions-apiserver/blob/a1e0ff9923b68731a7735f1c4168b6b3d0bd1027/pkg/apiserver/apiserver.go#L57

I'm not sure if this was leading to any
user-visible problems, but it was leading
to odd logs and weird serialization of
watch events.

Signed-off-by: Nick Santos <[email protected]>
  • Loading branch information
nicks authored Oct 19, 2024
1 parent a3d4d41 commit 8c141db
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions pkg/server/apiserver/apiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,21 @@ import (
func NewScheme() *runtime.Scheme {
scheme := runtime.NewScheme()

// we need to add the options to empty v1
// TODO fix the server code to avoid this
metav1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"})
// Loosely adapted from
// https://github.com/kubernetes/apiextensions-apiserver/blob/a1e0ff9923b68731a7735f1c4168b6b3d0bd1027/pkg/apiserver/apiserver.go#L57
//
// Whitelist the unversioned API types
// for any apiserver.

unversioned := schema.GroupVersion{
Group: "",
Version: "v1",
}
metav1.AddToGroupVersion(scheme, unversioned)

// TODO: keep the generic API server from wanting this
unversioned := schema.GroupVersion{Group: "", Version: "v1"}
scheme.AddUnversionedTypes(unversioned,
&metav1.Status{},
&metav1.WatchEvent{},
&metav1.APIVersions{},
&metav1.APIGroupList{},
&metav1.APIGroup{},
Expand Down

0 comments on commit 8c141db

Please sign in to comment.