rancher / dashboard

The Rancher UI
https://rancher.com
Apache License 2.0
450 stars 256 forks source link

Generate distributed model interfaces for K8S #6724

Open cnotv opened 2 years ago

cnotv commented 2 years ago

Description

Create model interfaces out of existing official library kubernetes-client which is based on classes.

Content

K8S does not have any DefinitelyTyped public and official model for the TS world. To overcome this lack we may take advantage of the existing K8S classes to be abstracted with an existing extension or create a fn node script to loop files and methods to generate the interface.

The model may be convenient to be a distributed type .d.ts.

This may be considered a step for the main TS milestone https://github.com/rancher/dashboard/issues/5254

cnotv commented 1 year ago

Types updated with K8S release-1.25.

As a side node, our models have internal computation as extension of the expected data, as defined in the TS class and test issue.

cnotv commented 1 year ago

As models are not matching between k8s, Rancher and the dashboard, we discard this idea.

cnotv commented 11 months ago

As it seems like we'll still need to create a type for the fetched data to keep separated from our models, we'll probably still have to define a way to deal with this.