After discussing this with David Martin we think the following process should work: During bind We want to store the name of the binding secret in our config map because it links back to the serviceBinding object. In order to trigger 'unbind' we need to be able to delete the serviceBinding object. Luckily the name of the binding secret is the same as the pod and we can easily retrieve it in Ansible with
Add this to the secret that we create for the sidecar:
... |
stringData: |
bindingSecretName: "{{ lookup('env','POD_NAME') }}" |
...
|
Then in the sidecar, when the configMap is created, save this field too. User deletes variant in UPS
- User deletes a variant in UPS
- The UPS sidecar runs a loop to check all the configmaps every minute or so
- For every config map it makes a request to UPS to check if the respective variant still exists.
- If the variant doesn't exist in UPS anymore then we have to delete the configmap and the binding.
- Get the name of the binding secret from the config map (bindingSecretName)
- Get the property 'ownerReferences[0].name' from the binding secret: this contains the name of the serviceBinding object.
- Delete the service binding object. This will trigger the unbind playbook.
- Delete the config map.
- Done.
|