2

I'm confused with the following response.

what's the meaning of "apiVersion": "v1",???

I'm expecting the apiVersion to be v1beta1.

$ curl http://127.0.0.1:8080/apis/batch/v1beta1
{
  "kind": "APIResourceList",
  "apiVersion": "v1",
  "groupVersion": "batch/v1beta1",
  "resources": [
    {
      "name": "cronjobs",
      "singularName": "",
      "namespaced": true,
      "kind": "CronJob",
      "verbs": [
        "create",
        "delete",
        "deletecollection",
        "get",
        "list",
        "patch",
        "update",
        "watch"
      ],
      "shortNames": [
        "cj"
      ],
      "categories": [
        "all"
      ],
      "storageVersionHash": "h/JlFAZkyyY="
    },
    {
      "name": "cronjobs/status",
      "singularName": "",
      "namespaced": true,
      "kind": "CronJob",
      "verbs": [
        "get",
        "patch",
        "update"
      ]
    }
  ]
}controlplane $
ooocamel
  • 33
  • 5

2 Answers2

0

You are getting confused by the output format. The actual output is metav1.APIResourceList:

// APIResourceList is a list of APIResource, it is used to expose the name of the
// resources supported in a specific group and version, and if the resource
// is namespaced.
type APIResourceList struct {
    TypeMeta `json:",inline"`
    // groupVersion is the group and version this APIResourceList is for.
    GroupVersion string `json:"groupVersion" protobuf:"bytes,1,opt,name=groupVersion"`
    // resources contains the name of the resources and if they are namespaced.
    APIResources []APIResource `json:"resources" protobuf:"bytes,2,rep,name=resources"`
}

In the example:

  "kind": "APIResourceList",
  "apiVersion": "v1",

is APIResourceList.TypeMeta, it says kind APIResourceList belongs to version v1. The latter part i.e.:

  "groupVersion": "batch/v1beta1",
  "resources": [
...

says that corresponding resources belong to groupVersion batch/v1beta1.

Hope it is clearer now.

VIAGC
  • 639
  • 6
  • 14