ves-io-schema-k8s_cluster_role_binding-API-Create

Examples of creating k8sclusterrole_binding

Usecase:

Create role-binding-1

Request using vesctl:

vesctl configuration create k8s_cluster_role_binding -i k8s_cluster_role_binding.yaml

where file k8sclusterrolebinding.yaml has following contents (k8sclusterrolebinding.CreateRequest):

metadata:
  name: role-binding-1
  namespace: system
spec:
  k8sClusterRole:
    name: k8s-cluster-role-1
    namespace: system
  subjects:
  - user: user1@example.com

vesctl yaml response:

metadata:
  annotations: {}
  labels: {}
  name: role-binding-1
  namespace: system
spec:
  k8sClusterRole:
    name: k8s-cluster-role-1
    namespace: system
    tenant: acmecorp
  subjects:
  - user: user1@example.com
systemMetadata:
  creationTimestamp: "2021-08-25T09:03:13.720485019Z"
  creatorClass: examplesvc
  creatorId: examplesvc
  finalizers: []
  tenant: acmecorp
  uid: a9b7fc08-500d-4c0c-853d-d662f6d96b3b

Request using curl:

curl -X 'POST' -d '{"metadata":{"name":"role-binding-1","namespace":"system"},"spec":{"k8sClusterRole":{"namespace":"system","name":"k8s-cluster-role-1"},"subjects":[{"user":"user1@example.com"}]}}' -H 'Content-Type: application/json' -H 'X-Volterra-Useragent: v1/pgm=_tmp_go-build970361017_b001_apidocs.test/host=docker-desktop' 'https://acmecorp.console.ves.volterra.io/api/config/namespaces/system/k8s_cluster_role_bindings'

curl response:

HTTP/1.1 200 OK
Content-Length: 792
Content-Type: application/json
Date: Wed, 25 Aug 2021 09:03:13 GMT
Vary: Accept-Encoding

{
  "metadata": {
    "name": "role-binding-1",
    "namespace": "system",
    "labels": {
    },
    "annotations": {
    },
    "description": "",
    "disable": false
  },
  "system_metadata": {
    "uid": "a9b7fc08-500d-4c0c-853d-d662f6d96b3b",
    "creation_timestamp": "2021-08-25T09:03:13.720485019Z",
    "deletion_timestamp": null,
    "modification_timestamp": null,
    "initializers": null,
    "finalizers": [
    ],
    "tenant": "acmecorp",
    "creator_class": "examplesvc",
    "creator_id": "examplesvc",
    "object_index": 0,
    "owner_view": null
  },
  "spec": {
    "k8s_cluster_role": {
      "tenant": "acmecorp",
      "namespace": "system",
      "name": "k8s-cluster-role-1"
    },
    "subjects": [
      {
        "user": "user1@example.com"
      }
    ]
  }
}