kube-rs / k8s-pb

Playing with Kubernetes protobufs
Apache License 2.0
19 stars 6 forks source link

Move codegen to a separate crate and use improved transform #5

Closed kazk closed 3 years ago

kazk commented 3 years ago

@clux Decided to push to a new branch just in case I messed something up while rebasing. This is #1 cleaned up + loading the new transformed.json in codegen. Should be much easier for us to work from here.


With the new transform.jq, Pod looks like this:

{
  "api.core.v1.Pod": {
    "name": "pods",
    "namespaced": true,
    "apiGroupVersion": "v1",
    "group": "",
    "version": "v1",
    "kind": "Pod",
    "proto": "api.core.v1.Pod",
    "rust": "api::core::v1::Pod",
    "metadata": "apimachinery::pkg::apis::meta::v1::ObjectMeta",
    "spec": "api::core::v1::PodSpec",
    "status": "api::core::v1::PodStatus",
    "condition": "api::core::v1::PodCondition",
    "scopedVerbs": {
      "all": [
        "list"
      ],
      "namespaced": [
        "create",
        "delete",
        "deletecollection",
        "get",
        "list",
        "patch",
        "update"
      ]
    },
    "paths": [
      "/api/v1/pods",
      "/api/v1/namespaces/{namespace}/pods",
      "/api/v1/namespaces/{namespace}/pods/{name}"
    ],
    "subresources": [
      {
        "name": "attach",
        "scopedVerbs": {
          "namespaced": [
            "connect"
          ]
        },
        "paths": [
          "/api/v1/namespaces/{namespace}/pods/{name}/attach"
        ]
      },
      {
        "name": "binding",
        "scopedVerbs": {
          "namespaced": [
            "create"
          ]
        },
        "paths": [
          "/api/v1/namespaces/{namespace}/pods/{name}/binding"
        ]
      },
      {
        "name": "ephemeralcontainers",
        "scopedVerbs": {
          "namespaced": [
            "get",
            "patch",
            "update"
          ]
        },
        "paths": [
          "/api/v1/namespaces/{namespace}/pods/{name}/ephemeralcontainers"
        ]
      },
      {
        "name": "eviction",
        "scopedVerbs": {
          "namespaced": [
            "create"
          ]
        },
        "paths": [
          "/api/v1/namespaces/{namespace}/pods/{name}/eviction"
        ]
      },
      {
        "name": "exec",
        "scopedVerbs": {
          "namespaced": [
            "connect"
          ]
        },
        "paths": [
          "/api/v1/namespaces/{namespace}/pods/{name}/exec"
        ]
      },
      {
        "name": "log",
        "scopedVerbs": {
          "namespaced": [
            "get"
          ]
        },
        "paths": [
          "/api/v1/namespaces/{namespace}/pods/{name}/log"
        ]
      },
      {
        "name": "portforward",
        "scopedVerbs": {
          "namespaced": [
            "connect"
          ]
        },
        "paths": [
          "/api/v1/namespaces/{namespace}/pods/{name}/portforward"
        ]
      },
      {
        "name": "proxy",
        "scopedVerbs": {
          "namespaced": [
            "connect"
          ]
        },
        "paths": [
          "/api/v1/namespaces/{namespace}/pods/{name}/proxy",
          "/api/v1/namespaces/{namespace}/pods/{name}/proxy/{path}"
        ]
      },
      {
        "name": "status",
        "scopedVerbs": {
          "namespaced": [
            "get",
            "patch",
            "update"
          ]
        },
        "paths": [
          "/api/v1/namespaces/{namespace}/pods/{name}/status"
        ]
      }
    ]
  }
}