infrastructure-as-types icon indicating copy to clipboard operation
infrastructure-as-types copied to clipboard

Generate DSL similar to k8s-kotlin-dsl based on OpenAPI defs?

Open PawelLipski opened this issue 4 years ago • 1 comments

Asked by @pawelprazak :

How difficult would it be to generate a DSL automatically based on OpenAPI (see iat-openapi sbt module)? https://github.com/fkorotkov/k8s-kotlin-dsl#complete-deployment-example

PawelLipski avatar Aug 06 '20 14:08 PawelLipski

Description of the task by @pawelprazak: The idea is to provide easy to use DLS for Kubernetes API, similiar to what's here for Kotlin: https://github.com/fkorotkov/k8s-kotlin-dsl#complete-deployment-example.

Notes:

  • Skuber as in GuestBook example is not good enough.
  • Java API is unusable
  • OpenAPI auto generated API as in kubernetes/client/openapi/api is also hard to use.
  • Using ZIO would be a good call
  • K8s uses metadata of objects to call API paths. https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#objects So it's possible to create path using metadata for example: /apis/${group}/${version}/namespaces/${namespace}/{kind plural}/[${name}]
  • Writing our own generator should be easier then forking https://github.com/OpenAPITools/openapi-generator
  • Use scala HTTP and Json library: Sttp + circe
  • Important support for K8s Custom Resources

For more information ask @pawelprazak.

Gryfit avatar Aug 20 '20 09:08 Gryfit