Skip to content

Resources are not scoped #194

@clux

Description

@clux

Currently people can instantiate any type of k8s_openapi::Resource and use it with Api::namespaced or Api::all, however, each resource only really works in one Scope.

So it's not a good pattern to have people figure out what is the correct scope, then only later getting an obscure 405 when picking it wrong like in #191 .

It would be useful if k8s_openapi::Resource also told us if the scope was cluster or namespaced, as it would avoid us having to either hardcode objects that are allowed to be used in this scope (we already do a bit of that in https://github.com/clux/kube-rs/blob/06f7b5cc7004ff3c6e23000747140171f03014c8/kube/src/api/resource.rs#L45-L50 )

It would also probably be better to rename Api::all to Api::cluster to signify that this is a scope selector not a --all-namespaces equivalent.

Metadata

Metadata

Assignees

Labels

apiApi abstraction relatedcoregeneric apimachinery style work

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions