-
Notifications
You must be signed in to change notification settings - Fork 91
Closed
Description
What happened
- cf create service sample-service sample-plan myinstance
- cf bind service myapp myinstance
- cf bind service myapp myinstance --binding-name mybinding
The last command returns an unexpected error saying that binding with such guid already exists
The same thing happens when I try to create two service keys for the same instance:
- cf create-service-key myinstance mykey-1
- cf create-service-key myinstance mykey-2
The second command fails
What was supposed to happen
No error should have occurred. According to cf docs it is possible to create named bindings as well as multiple service keys for the same service instance
Dev Notes
- The error occurs because we are not taking the binding display name into account when validating the binding creation. This means that we can only ever create a single service binding (no matter if type is "app" or "key")
- This is how bining uniqueness is established right now:
korifi/controllers/api/v1alpha1/cfservicebinding_types.go
Lines 120 to 122 in 252831e
func (b CFServiceBinding) UniqueName() string { return fmt.Sprintf("sb::%s::%s::%s", b.Spec.AppRef.Name, b.Spec.Service.Namespace, b.Spec.Service.Name) } - The correct thing to do is to also take the binding name into account
- We should also introduce a migration that would fix uniqueness contstraints for existing bindings from older deployments
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Type
Projects
Status
✅ Done