<div dir="ltr">Many thanks for your help and the trick. I have changed the code to generate a UUID<div>and that works<br><div><br></div><div><div>// Generate UUID ottherwise binding will fail if we use same id as the instanceName, bidingName</div><div>UUID := string(uuid.NewUUID())</div><div><br></div><div>log.Infof("Let's generate a secret containing the parameters to be used by the application")</div><div>bind(serviceCatalogClient,NS,<wbr>INSTANCE_NAME,EXTERNAL_ID,<wbr>INSTANCE_NAME,UUID,nil,nil)</div></div><div><br></div><div>Additional question</div><div><br></div><div>Do you know which API should I use to mount the secret of the binding into a deploymentConfig/Pod - similar to what the OpenShift UI offers [1] ?</div><div><br></div><div>[1] <a href="https://www.dropbox.com/s/45rbk9htvaiqrt4/Screenshot%202018-08-28%2006.57.34.png?dl=0">https://www.dropbox.com/s/45rbk9htvaiqrt4/Screenshot%202018-08-28%2006.57.34.png?dl=0</a></div><div class="gmail_extra"><div><div class="gmail-m_-4008995933554145910gmail_signature"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div style="color:rgb(0,0,0);font-family:overpass,sans-serif;font-size:10px"><div></div></div></div></div></div></div></div></div></div></div></div>
<br><div class="gmail_quote">On Mon, Aug 27, 2018 at 10:39 PM,  <span dir="ltr"><<a href="mailto:jesusr@redhat.com" target="_blank">jesusr@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Charles,<br>
<br>
I haven't found the fix yet, but I did see a pattern. I was able to<br>
recreate the problem using the commands you defined below, as well as<br>
with a script I have to create binds.<br>
<br>
The pattern is that the very first bind request returns an error *IF*<br>
the bind id is the same as the instance id because of the secret<br>
created during the provision call. Subsequent calls seem to work even<br>
if they have the same id.<br>
<br>
I'm still trying to track down why that first one is failing while the<br>
others work fine.<br>
<br>
One short term solution is to use a different uuid for the binding that<br>
is not the same as the instance id.<br>
<br>
<br>
<a href="https://github.com/snowdrop/k8s-supervisor/blob/master/pkg/catalog/bind.go#L37" rel="noreferrer" target="_blank">https://github.com/snowdrop/k8<wbr>s-supervisor/blob/master/pkg/<wbr>catalog/bind.go#L37</a><br>
<br>
Sincerely,<br>
jesus<br>
<div><div class="gmail-m_-4008995933554145910h5"><br>
On Mon, 2018-08-27 at 20:31 +0200, Charles Moulliard wrote:<br>
> - You can reproduce the error if you git clone my project within your<br>
> $GOPATH folder<br>
>   git clone <a href="https://github.com/snowdrop/k8s-supervisor.git" rel="noreferrer" target="_blank">https://github.com/snowdrop/k8<wbr>s-supervisor.git</a> or go get<br>
> ...<br>
> - Next run this command with openshift 3.10 + ASB broker running and<br>
> namespace `crud` created<br>
>   go run *.go catalog create<br>
> <br>
> Remark : minishift has been started as such -> <a href="https://goo.gl/b3mcZQ" rel="noreferrer" target="_blank">https://goo.gl/b3mcZQ</a><br>
> <br>
> On Mon, Aug 27, 2018 at 6:33 PM, Charles Moulliard <<br>
> <a href="mailto:cmoullia@redhat.com" target="_blank">cmoullia@redhat.com</a>><br>
> wrote:<br>
> <br>
> > Hi,<br>
> > <br>
> > I'm using golang kubernetes service catalog API to create a service<br>
> > instance using openshift automation service broker<br>
> > <br>
> > Code to create the service [1]<br>
> > To do the binding [2]<br>
> > <br>
> > The service instance is well created but when I do the binding I<br>
> > get an<br>
> > error reporing that secret already exists<br>
> > <br>
> > svcat describe bindings my-postgresql-db<br>
> > <br>
> >   Name:        my-postgresql-db<br>
> > <br>
> > <br>
> > <br>
> >   Namespace:   crud<br>
> > <br>
> > <br>
> > <br>
> >   Status:      Failed - ServiceBroker returned failure; bind<br>
> > operation<br>
> > will not be retried: Status: 400; ErrorMessage: <nil>; Description:<br>
> > secrets<br>
> > "a7c00676-4398-11e8-842f-0ed5f<wbr>89f718b" already exists;<br>
> > ResponseError:<br>
> > <nil> @ 2018-08-27 16:27:28 +0000 UTC<br>
> >   Secret:      my-postgresql-db-credentials<br>
> > <br>
> > <br>
> > <br>
> >   Instance:    my-postgresql-db<br>
> > <br>
> > <br>
> > <br>
> > <br>
> > Question: What should I do to resolve the issue ?<br>
> > <br>
> > [1] <a href="https://goo.gl/36n2U4" rel="noreferrer" target="_blank">https://goo.gl/36n2U4</a><br>
> > [2] <a href="https://goo.gl/CzTpjP" rel="noreferrer" target="_blank">https://goo.gl/CzTpjP</a><br>
> > <br>
> > Regards<br>
> > <br>
> > Charles<br>
> > <br>
> <br>
</div></div>> ______________________________<wbr>_________________<br>
> Ansible-service-broker mailing list<br>
> <a href="mailto:Ansible-service-broker@redhat.com" target="_blank">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/mailman<wbr>/listinfo/ansible-service-<wbr>broker</a><br>
<br>
<br>
______________________________<wbr>_________________<br>
Ansible-service-broker mailing list<br>
<a href="mailto:Ansible-service-broker@redhat.com" target="_blank">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/mailman<wbr>/listinfo/ansible-service-<wbr>broker</a><br>
</blockquote></div><br></div></div></div>