Skip to content

v0.15.0

Compare
Choose a tag to compare
@github-actions github-actions released this 28 Mar 13:06
· 215 commits to main since this release
78768eb

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 has metav1.TypeMeta and metav1.ObjectMeta embedded, and all metadata can be access via ObjectMeta.
  • The resource.Object-implementing type's name is now the Kind's name.
  • Custom metadata is now set via generated GetX/SetX methods on the Object type. At rest in the type, it is stored in the Annotations map.
  • ExtraFields has been removed, as all supported kubernetes fields are now within the metadata. ExtraFields can still be used with GetCommonMetadata() and SetCommonMetadata(), however, for legacy support.
  • TypeScript generation of resource-type kinds now generates interfaces for each of Spec, Status, etc., and generates an Object 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 as BasicMetadataObject and SimpleObject have been replaced by UntypedObject, TypedSpecObject, TypedSpecStatusObject, and TypedObject.
  • List interface has been changed.
  • SimpleList has been replaced by TypedList and UntypedList
  • The various stores, which previously required a Schema now require a Kind
  • ClientGenerator.ClientFor now requires a Kind instead of a Schema

Other changes

Specific list of breaking changes to all other packages are as follows:

  • operator.KubernetesBasedInformer requires a resource.Kind instead of a resource.Schema
  • simple.WebhookConfig uses *resource.Kind instead of resource.Schema
  • simple.Operator.WatchKind, simple.Operator.ReconcileKind, simple.Operator.ValidateKind, and simple.Operator.MutateKind all now consume a resource.Kind instead of a resource.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

Changelog