K8s: Register group and kinds to internal version to fix apply (#97184)
* K8s: Register group and kinds to internal version to fix apply
This commit is contained in:
@@ -64,6 +64,16 @@ func (b *appBuilder) InstallSchema(scheme *runtime.Scheme) error {
|
|||||||
for _, kind := range kinds {
|
for _, kind := range kinds {
|
||||||
scheme.AddKnownTypeWithName(gv.WithKind(kind.Kind()), kind.ZeroValue())
|
scheme.AddKnownTypeWithName(gv.WithKind(kind.Kind()), kind.ZeroValue())
|
||||||
scheme.AddKnownTypeWithName(gv.WithKind(kind.Kind()+"List"), kind.ZeroListValue())
|
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)
|
return scheme.SetVersionPriority(gv)
|
||||||
|
|||||||
Reference in New Issue
Block a user