<div dir="ltr"><div>Just to be clear, I am extremely uncomfortable in giving the ASB any more powers. If you want a broker that can manipulate cluster resources, it needs to be completely separated from the standard ASB broker that handles user requests. A better approach will likely involve the user giving the ASB a token that it then uses to perform actions (i.e. the user must have the powers needed to perform those actions but the ASB itself does not).<br><br></div>Ryan is correct on the scoping of bindings and the escalation checks.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jan 31, 2018 at 1:44 PM, Ryan Hallisey <span dir="ltr"><<a href="mailto:rhallise@redhat.com" target="_blank">rhallise@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Following up on my original post. I found the reason the rolebinding<br>
was failing to create the cluster-admin role. My broker service<br>
account was not a cluster-admin. This makes sense since you shouldn't<br>
be able to elevate to higher permissions that you are. However,<br>
adding the cluster-admin role to apb does not provide cluster level<br>
access. Since we're creating a role binding, the apb is granted<br>
cluster-admin permissions within it's namespace. In order to access<br>
cluster level resources (anything outside it's namespace), we need to<br>
create a clusterrolebinding.<br>
<br>
Here's a writeup for adding a feature that will allow developers to<br>
have full access to the cluster:<br>
<a href="https://github.com/openshift/ansible-service-broker/issues/715" rel="noreferrer" target="_blank">https://github.com/openshift/<wbr>ansible-service-broker/issues/<wbr>715</a><br>
<span class="HOEnZb"><font color="#888888"><br>
-Ryan<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On Wed, Jan 31, 2018 at 11:20 AM, Ryan Hallisey <<a href="mailto:rhallise@redhat.com">rhallise@redhat.com</a>> wrote:<br>
> Thanks David, that's really good to know.<br>
><br>
><br>
> On Wed, Jan 31, 2018 at 9:13 AM, David Zager <<a href="mailto:dzager@redhat.com">dzager@redhat.com</a>> wrote:<br>
>> Ryan,<br>
>><br>
>> My understanding of wanting to run APBs with extra privileges from our<br>
>> broker is that this is a feature we would like to support down the line. As<br>
>> an aside, it seems worth pointing out that you can workaround this issue by<br>
>> using docker run like:<br>
>><br>
>> docker run --rm --net=host \<br>
>> -v $HOME/.kube:/opt/apb/.kube:z \<br>
>> -u $UID \<br>
>> ${APB_NAME} ${APB_ACTION:-'provision'} \<br>
>> --extra-vars "namespace=mycoolnamespace" \<br>
>> --extra-vars "etc=etc"<br>
>><br>
>><br>
>> Notes on this command:<br>
>><br>
>> You need to be using your host's network stack (--net=host)<br>
>> Passing your kube config allows the APB to run at your permission level (ie.<br>
>> if you are an cluster-admin you can do what you want).<br>
>> APB_NAME in this case would be kubevirt-apb<br>
>> You may or may not need the namespace argument, I just know that a lot of<br>
>> our existing APBs assume that the namespace already exists<br>
>><br>
>> I am a huge fan of the idea of using APBs to manage a cluster outside the<br>
>> service-catalog/service-broker context. However, I am also excited about<br>
>> pursuing the extra privileged APBs in our broker and how we will meet that<br>
>> use case, so this is not meant to take away from that discussion.<br>
>><br>
>> Thanks,<br>
>> David<br>
>><br>
>> On Wed, Jan 31, 2018 at 6:13 AM John Matthews <<a href="mailto:jmatthew@redhat.com">jmatthew@redhat.com</a>> wrote:<br>
>>><br>
>>> Mo,<br>
>>><br>
>>> Do you have any thoughts on the issue Ryan mentions below on being unable<br>
>>> to create a rolebinding that is cluster-admin?<br>
>>> For background, this is for enabling the Broker to deploy APBs that will<br>
>>> modify cluster infrastructure...not a typical application/service but<br>
>>> special APBs that require extra privileges.<br>
>>><br>
>>><br>
>>><br>
>>><br>
>>> On Tue, Jan 30, 2018 at 9:56 PM, Ryan Hallisey <<a href="mailto:rhallise@redhat.com">rhallise@redhat.com</a>><br>
>>> wrote:<br>
>>>><br>
>>>> Karim,<br>
>>>><br>
>>>> I think I have a workaround patch that will get provision working for<br>
>>>> the kubevirt-apb. Instructions for how to test it are in the commit<br>
>>>> message.<br>
>>>><br>
>>>><br>
>>>> <a href="https://github.com/rthallisey/ansible-service-broker/commit/f27e0538959c43d47d2ff80bba1e894f2249ad62" rel="noreferrer" target="_blank">https://github.com/rthallisey/<wbr>ansible-service-broker/commit/<wbr>f27e0538959c43d47d2ff80bba1e89<wbr>4f2249ad62</a><br>
>>>><br>
>>>> To summarize for folks what I think is happening. We need the apb to<br>
>>>> have the cluster-admin role so it can create cluster-roles. To do<br>
>>>> this, set sandbox_role: cluster-admin, auto_escalate: true, and make<br>
>>>> the asb user cluster-admin. Then when you provision, you'll hit this<br>
>>>> issue: <a href="https://github.com/openshift/ansible-service-broker/issues/711" rel="noreferrer" target="_blank">https://github.com/openshift/<wbr>ansible-service-broker/issues/<wbr>711</a>.<br>
>>>> The rolebinding fails to create with the error:<br>
>>>> <a href="http://rolebindings.rbac.authorization.k8s.io" rel="noreferrer" target="_blank">rolebindings.rbac.<wbr>authorization.k8s.io</a><br>
>>>> "apb-9c21c424-7091-4bc1-b5c5-<wbr>0caa08aeec39" is forbidden: attempt to<br>
>>>> grant extra privileges.<br>
>>>> It seems that we can't create a rolebinding that is cluster-admin.<br>
>>>> I'm still exploring for the reason why it fails, but my theory is that<br>
>>>> the cluster-admin role gives access outside the scope of a role so it<br>
>>>> requires a clusterrolebinding. With the clusterrolebinding created<br>
>>>> with cluster-admin permissions, I was able to create cluster-resources<br>
>>>> from the apb.<br>
>>>><br>
>>>> Thanks,<br>
>>>> -Ryan<br>
>>>><br>
>>>> ______________________________<wbr>_________________<br>
>>>> Ansible-service-broker mailing list<br>
>>>> <a href="mailto:Ansible-service-broker@redhat.com">Ansible-service-broker@redhat.<wbr>com</a><br>
>>>> <a href="https://www.redhat.com/mailman/listinfo/ansible-service-broker" rel="noreferrer" target="_blank">https://www.redhat.com/<wbr>mailman/listinfo/ansible-<wbr>service-broker</a><br>
>>><br>
>>><br>
>>> ______________________________<wbr>_________________<br>
>>> Ansible-service-broker mailing list<br>
>>> <a href="mailto:Ansible-service-broker@redhat.com">Ansible-service-broker@redhat.<wbr>com</a><br>
>>> <a href="https://www.redhat.com/mailman/listinfo/ansible-service-broker" rel="noreferrer" target="_blank">https://www.redhat.com/<wbr>mailman/listinfo/ansible-<wbr>service-broker</a><br>
>><br>
>><br>
>> ______________________________<wbr>_________________<br>
>> Ansible-service-broker mailing list<br>
>> <a href="mailto:Ansible-service-broker@redhat.com">Ansible-service-broker@redhat.<wbr>com</a><br>
>> <a href="https://www.redhat.com/mailman/listinfo/ansible-service-broker" rel="noreferrer" target="_blank">https://www.redhat.com/<wbr>mailman/listinfo/ansible-<wbr>service-broker</a><br>
>><br>
</div></div></blockquote></div><br></div>