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-02-22T15:44:04.868118600Z"
  creatorClass: examplesvc
  creatorId: examplesvc
  finalizers: []
  tenant: acmecorp
  uid: 723e8d54-e0a4-445c-9164-d684194a3375

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-build817539475_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: Mon, 22 Feb 2021 15:44:04 GMT
Vary: Accept-Encoding

{
  "metadata": {
    "name": "role-binding-1",
    "namespace": "system",
    "labels": {
    },
    "annotations": {
    },
    "description": "",
    "disable": false
  },
  "system_metadata": {
    "uid": "723e8d54-e0a4-445c-9164-d684194a3375",
    "creation_timestamp": "2021-02-22T15:44:04.868118600Z",
    "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"
      }
    ]
  }
}