openshift/openshift-restclient-python

Unable to create RoleBinding using Dynamic Client API

saurabhkothari opened this issue · 4 comments

I am referring to https://github.com/openshift/openshift-restclient-python#create
I have successfully created namespace and resource quota using the same method.
I have also tried different versions of
v1_rolebinding.create(role_binding_body, example)
v1_rolebinding.create(role_binding_body)
v1_rolebinding.create(body=role_binding_body, namespace=example)

Error:
for attr, _ in six.iteritems(obj.openapi_types)
AttributeError: 'set' object has no attribute 'openapi_types'

k8s_client = client.ApiClient(kubeConfig)
dyn_client = DynamicClient(k8s_client)
v1_rolebinding= dyn_client.resources.get(api_version='rbac.authorization.k8s.io/v1', kind='RoleBinding')

role_binding_body = {
            "metadata": {
                "name": "example",
                "namespace": "example"
            },
            "subjects": [{"kind": "User", "name": "example"}],
            "roleRef": {"kind": "ClusterRole", "name": "admin"}
        }

        # Create the RoleBinding in the user's namespace
        v1_rolebinding.create(role_binding_body, example)

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

Stale issues rot after 30d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle rotten
/remove-lifecycle stale

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.

/close

@openshift-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.