k8s-api go types


Its nice to have it all in a single package.

|-- pkg
|   `-- v1_20

Want to contritube a k8s version?

  1. Get a schema from a specific k8s release branch

curl https://raw.githubusercontent.com/kubernetes/kubernetes/release-$version/api/openapi-spec/swagger.json > definitions.json
  1. Use go-swagger to generate the models.
swagger generate model --struct-tags='json,yaml' -f ./definitions.json
  1. Update pkg name to k8s release version. Example: package v1_20.
  2. Add a struct called All, with all structs.
grep -ohR "\w*IoK8s\w*" . | uniq | sed -r 's/(.*)/\1 \1/' | pbcopy // Gets all struct names, removes duplicates, and duplicates struct to add inside the All struct
  1. Create a PR : )


View Github