K8s: Register group and kinds to internal version to fix apply (#97184)

* K8s: Register group and kinds to internal version to fix apply
pull/97233/head
Karl Persson 8 months ago committed by GitHub
parent 14b49a0f61
commit 7b25804b55
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 10
      pkg/services/apiserver/builder/runner/builder.go

@ -64,6 +64,16 @@ func (b *appBuilder) InstallSchema(scheme *runtime.Scheme) error {
for _, kind := range kinds {
scheme.AddKnownTypeWithName(gv.WithKind(kind.Kind()), kind.ZeroValue())
scheme.AddKnownTypeWithName(gv.WithKind(kind.Kind()+"List"), kind.ZeroListValue())
// Link this group to the internal representation.
// This is used for server-side-apply (PATCH), and avoids the error:
// "no kind is registered for the type"
gvInternal := schema.GroupVersion{
Group: gv.Group,
Version: runtime.APIVersionInternal,
}
scheme.AddKnownTypeWithName(gvInternal.WithKind(kind.Kind()), kind.ZeroValue())
scheme.AddKnownTypeWithName(gvInternal.WithKind(kind.Kind()+"List"), kind.ZeroListValue())
}
}
return scheme.SetVersionPriority(gv)

Loading…
Cancel
Save