Skip to content

Merge ApiCapabilities into ApiResource #1036

@clux

Description

@clux

Our ApiResource is intentionally a subset of the upstream APIResource that lets us be able to use the type as a Resource. It has a special meaning as the DynamicType for Resource in the dynamic discovery cases.

ApiCapabilities is more the other part of that; the parts that is not essential to have to use the type with the api, but for helpful for detecting "what you can do with it".

However, the way we have split it is becoming harder to justify:

Thus, I think we should reduce the distance between the native Kubernetes types and do one of the following:

Option 1: Bundle capabilities as an optional field inside ApiResource

A least breaking change type thing.

Option 2: Merge fields from ApiCapabilities as optional fields inside ApiResource

The most breaking potential change. This needs additional breaking changes to flatten the methods on ApiCapabilities into ApiResource.

In both cases:

  • discovery goes from returning Vec<(ApiResource, ApiCapabilities)> to Vec<ApiResource>
  • ApiResource::erase can set whatever fields we don't need in the runtime to None.

And we would get the struct more in-line with the upstream type, while retaining their light-weight use (optional types does not have an extra memory overhead when they are None) as a DynamicType.

Doing the most breaking change (full merge) I think would be easier because it also helps solve the problem of where to put the upstream fields, and help get direction on things like #1002.

Metadata

Metadata

Assignees

Labels

coregeneric apimachinery style workquestionDirection unclear; possibly a bug, possibly could be improved.

Type

No type

Projects

Status

Blocked

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions