Skip to content

Make generated Go types implement runtime.Object and provide package-level AddToSchemes #143

Description

@adamwg

What problem are you facing?

When writing Go functions using the kubebuilder Go structs from providers, it's possible to add add API types to a runtime.Scheme, which avoids the need to set the APIVersion and Kind fields. This depends on the types implementing runtime.Object.

Our generated Go schemas don't implement runtime.Object, and we don't provide AddToScheme helpers in the generated packages. This means users have to specify APIVersion and Kind for each composed resource, and it's also not possible to use the generated types with k8s ecosystem libraries that work with runtime.Objects.

Slack ref: https://crossplane.slack.com/archives/CEG3T90A1/p1782299819029779

How could Crossplane help solve your problem?

Generate the necessary methods to make our generated Go types implement runtime.Object, and generate AddToScheme helpers in each generated package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions