ves-io-schema-k8s_cluster_role-API-Replace

Examples of replacing k8s_cluster_role

Usecase:

Replace k8s-cluster-role-1 to modify rule

Request using vesctl:

vesctl configuration replace k8s_cluster_role -i k8s_cluster_role.yaml

where file k8s_cluster_role.yaml has following contents (k8s_cluster_role.ReplaceRequest):

RequestJSON:

{
    "metadata": {
        "name": "k8s-cluster-role-1",
        "namespace": "system"
    },
    "spec": {
        "policy_rule_list": {
            "policy_rule": [
                {
                    "resource_list": {
                        "api_groups": [
                            "rbac.authorization.k8s.io"
                        ],
                        "resource_types": [
                            "role"
                        ],
                        "resource_instances": [
                            "ResourceAll"
                        ],
                        "verbs": [
                            "use"
                        ]
                    }
                }
            ]
        }
    }
}

vesctl yaml response: None

Request using curl:

curl -X 'PUT' -d '{"metadata":{"name":"k8s-cluster-role-1","namespace":"system"},"spec":{"policy_rule_list":{"policy_rule":[{"resource_list":{"api_groups":["rbac.authorization.k8s.io"],"resource_types":["role"],"resource_instances":["ResourceAll"],"verbs":["use"]}}]}}}' -H 'X-Volterra-Useragent: v1/pgm=_tmp_go-build243329498_b001_apidocs.test/host=docker-desktop' 'https://acmecorp.console.ves.volterra.io/api/config/namespaces/system/k8s_cluster_roles/k8s-cluster-role-1'

curl response:

HTTP/1.1 200 OK
Content-Length: 4
Content-Type: application/json
Date: Fri, 23 Sep 2022 13:12:42 GMT
Vary: Accept-Encoding

{

}