-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support objects for user-provided services credentials #3140
Conversation
Previously Korifi supported plain `map[string]string` for UPSI credentials. This deviates from the CF API spec where credentials can be arbitrary objects. As credentials are stored in secrets which are glorified `map[string][]byte` we had to change the way we store the credentials object: * We marshal the credentials object into a byte array and store it under the `crdentials` key in the secret. We no longer use a secret key per every credentials value. The `CFServiceInstance.Spec.SecretName` references that credentials secret. * We introduce `CFServiceInstance.Status.Credentials` and `CFServiceInstance.Status.CredentialsObservedVersion` that aremanaged by the `CFServiceInstance` controller. Once the controller reconciles the service instance, it sets the secret name and its resource version into the new status fields. * The CFServiceBindingController reconciles the CFServiceInstance credentials secret into the flat format that is then used for the servicebinding.io binding. In case of a json object value to a key, the value is represented as a json string. * Existing bindings are not affected when upgrading Korifi. However, once the user updates the service instance credentials, the binding secret is rebuilt which causes statefulset restart. Further updates to the credentials will not cause additional restarts. * We have created ADR 16 documenting how this works fixes #2900 Co-authored-by: Danail Branekov <[email protected]>
I think this looks like it should work, but I'm wondering if we have any automated tests that push an app that actually uses servicebindings.io bindings? Like a Java Spring app that uses https://github.com/spring-cloud/spring-cloud-bindings. There are some important keys in there like the name of the binding and especially the https://github.com/cloudfoundry-samples/spring-music is one I've used to validate service bindings are working. |
Hey @tcdowney, thanks for taking a look, we just validated that spring-music works with this change. We thought it might be useful to deploy spring-music on the acceptance cluster, but realised that we are already deploying postfacto which is consuming a database as well. This should be good enough, right? If you think that spring boot is an important use case we might drop in a chore to deploy spring-music next to postfacto. |
Cool thank you for manually validating Spring Music! I think a chore would be good because Spring apps are one of the few app types that automatically get Cloud Native Service Binding support through https://github.com/spring-cloud/spring-cloud-bindings so we can be sure we're still creating them in a way that apps can use. I don't think Postfacto is the best example cause I don't think we're actually even using service bindings for it. I think we're just constructing |
Adopt PR #3140 This PR deals with user-provided service instance credentials which is somehow related to managed services credentials Co-authored-by: Danail Branekov <[email protected]>
Is there a related GitHub Issue?
#2900
What is this change about?
Previously Korifi supported plain
map[string]string
for UPSIcredentials. This deviates from the CF API spec where credentials can be
arbitrary objects.
As credentials are stored in secrets which are glorified
map[string][]byte
we had to change the way we store the credentialsobject:
the
crdentials
key in the secret. We no longer use a secret key perevery credentials value. The
CFServiceInstance.Spec.SecretName
references that credentials secret.
CFServiceInstance.Status.Credentials
andCFServiceInstance.Status.CredentialsObservedVersion
that aremanagedby the
CFServiceInstance
controller. Once the controllerreconciles the service instance, it sets the secret name and its
resource version into the new status fields.
credentials secret into the flat format that is then used for the
servicebinding.io binding. In case of a json object value to a key,
the value is represented as a json string.
once the user updates the service instance credentials, the binding
secret is rebuilt which causes statefulset restart. Further updates to
the credentials will not cause additional restarts.
Does this PR introduce a breaking change?
No
Acceptance Steps
See #2900
Tag your pair, your PM, and/or team
@cloudfoundry/wg-cf-on-k8s