v0.15.0
What's Changed
This release refactors the resource.Object
interface to be composed of the kubernetes runtime.Object
, schema.ObjectKind
, and metav1.Object
interfaces, with additional methods for use by the grafana-app-sdk. It also expands upon resource.Schema
with the resource.Kind
type, which includes (de)serialization logic based on byte encoding (moved out from resource.Object.Unmarshal
). The resource.List
interface has also been changed similarly to the resource.Object
, now being comprised of runtime.Object
, schema.ObjectKind
, and metav1.ListObject
.
The Simple/Basic objects are now resource.UntypedObject
and resource.TypedObject
/reosurce.TypedSpecObject
/resource.TypedSpecStatusObject
. Likewise, the simple list has been split into resource.UntypedList
and resource.TypedList
.
All other changes in this release flow out of these changes: codegen is updated to satisfy the new interfaces, and generate a Kind
and Codec
for JSON-encoding of the Kind
. k8s
has been updated to use the resource.Kind
/resource.Codec
for its marshal and unmarshal logic to/from JSON bytes. The operator
package accepts resource.Kind
in some places where it used to accept resource.Schema
.
Codegen Changes
Specific list of breaking changes to codegen are as follows:
- The
Metadata
object is still generated, but is deprecated, and only used for thema unmarshal. - The
resource.Object
-implementing type now hasmetav1.TypeMeta
andmetav1.ObjectMeta
embedded, and all metadata can be access viaObjectMeta
. - The
resource.Object
-implementing type's name is now the Kind's name. - Custom metadata is now set via generated
GetX
/SetX
methods on theObject
type. At rest in the type, it is stored in theAnnotations
map. ExtraFields
has been removed, as all supported kubernetes fields are now within the metadata.ExtraFields
can still be used withGetCommonMetadata()
andSetCommonMetadata()
, however, for legacy support.- TypeScript generation of
resource
-type kinds now generates interfaces for each ofSpec
,Status
, etc., and generates anObject
interface that contains them, and the kubernetes metadata, the same way the go codegen behaves.model
-type TypeScript codegen is unchanged.
You can view all codegen changes by looking at the diff to the diff to codegen/testing/golden_generated
in this PR.
resource
Changes
Specific list of breaking changes to the resource
package are as follows:
Object
interface has been changed. New codegen will automatically implement it.- Simple
Object
implementations such asBasicMetadataObject
andSimpleObject
have been replaced byUntypedObject
,TypedSpecObject
,TypedSpecStatusObject
, andTypedObject
. List
interface has been changed.SimpleList
has been replaced byTypedList
andUntypedList
- The various stores, which previously required a
Schema
now require aKind
ClientGenerator.ClientFor
now requires aKind
instead of aSchema
Other changes
Specific list of breaking changes to all other packages are as follows:
operator.KubernetesBasedInformer
requires aresource.Kind
instead of aresource.Schema
simple.WebhookConfig
uses*resource.Kind
instead ofresource.Schema
simple.Operator.WatchKind
,simple.Operator.ReconcileKind
,simple.Operator.ValidateKind
, andsimple.Operator.MutateKind
all now consume aresource.Kind
instead of aresource.Schema
Commits
- Refactor of the Object interface to be a superset of the kubernetes interfaces, introduce Kinds by @IfSentient in #200
- Implement New resource.Kind and resource.Object in Other Packages by @IfSentient in #207
- [Kind/Object Refactor] Codegen Updates by @IfSentient in #211
- Update tutorial based on changes to Object interface and codegen. by @IfSentient in #214
- [Kind/Object Refactor] Misc Final Fixes by @IfSentient in #216
- Bump the all group with 6 updates by @dependabot in #220
Full Changelog: v0.14.14...v0.15.0