Skip to content
This repository has been archived by the owner on Nov 18, 2019. It is now read-only.

Commit

Permalink
Use app-{InstanceID} as instance name when no svcinstance found. (#50)
Browse files Browse the repository at this point in the history
Cloud Foundry doesn't use service instance, so app-{InstanceID}
will be used instead.

xref: #46

Signed-off-by: Tamal Saha <tamal@appscode.com>
  • Loading branch information
tamalsaha committed Mar 14, 2019
1 parent 58b036c commit 3bdb79c
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions pkg/broker/broker.go
Expand Up @@ -73,13 +73,18 @@ func (b *Broker) Provision(request *osb.ProvisionRequest, c *broker.RequestConte
if err != nil {
return nil, err
}
for _, svcinstance := range svcinstances.Items {
if svcinstance.Spec.ExternalID == request.InstanceID {
curProvisionInfo.InstanceName = svcinstance.Name
if len(svcinstances.Items) == 0 {
curProvisionInfo.InstanceName = "app-" + request.InstanceID
} else {
for _, svcinstance := range svcinstances.Items {
if svcinstance.Spec.ExternalID == request.InstanceID {
curProvisionInfo.InstanceName = svcinstance.Name
}
}

if curProvisionInfo.InstanceName == "" {
return nil, errors.Errorf("failed get name of ServiceInstance %s/%s", namespace, request.InstanceID)
}
}
if curProvisionInfo.InstanceName == "" {
return nil, errors.Errorf("failed get name of ServiceInstance %s/%s", namespace, request.InstanceID)
}

// Check to see if this is the same instance
Expand Down

0 comments on commit 3bdb79c

Please sign in to comment.