Make ExternalSecret a provisioned service#2263
Conversation
There was a problem hiding this comment.
Greetings!
Thank you for contributing to this project!
If this is your first time contributing, please make
sure to read the Developer and Contributing Process guides.
Please also mind and follow our Code of Conduct.
Useful commands:
make fmt: Formats the codemake check-diff: Ensures the branch is cleanmake reviewable: Ensures a PR is ready for review
The unit tests pass, but I don't have environments/credentails for e2e tests. I didn't add a unit test because there wasn't a clean obvious place to add a test. A pointer is appreciated.
I'm unable to run the |
|
hi @scothis ! Do you have any documentation for Service Binding project? |
|
@gusfcarvalho yes, we do. There are both a human friendly overview of the provisioned service and the formal spec. There is also a reference implementation of the spec. |
We're currently running our CI with golangci-lint 1.49.0 and golang 1.19. If you use them you should be able to run |
|
I would like to discuss this PR in a community meeting, if we can - more on the 'integrating with non-vanilla k8s projects', as this is something that we didn't do until now (like e.g. integrating with bitnami/sealedsecrets). Having said that, I really see no issue with a single status field (although from the spec it looks like we would need to add more things? 🤔) In any case we can make sure the PR is ready to be merged when we get to the community meeting to discuss it. |
That seems ok at first glance but does not seem sustainable in the long run, regarding having to review new similar inclusions and to document every new inclusion so people know the integration exists... It is somewhat "worse" than our provider situation because at least providers are adding new self-contained and explicit functionalities to the project. In this case, it feels a bit off. Maybe some status fields and how they are updated/or how they work could also be abstracted away, pluginazable and offered as extension points? |
|
Agree with discussing at next community meeting though +1 |
👍
This PR covers everything required by the spec for a provisioned service. There are a couple recommendations that are left unaddressed. They are:
I'm still hitting an error with the docs target |
External Secrets Operator (ESO) is a way to synthesize Kubernetes Secrets from secure data stores. There is a PR that adds provisioned service support to ExternalSecret resources. This sample is intended to facilitate the conversation between the Service Bindings and External Secrets communities. This PR should not be merged unless and until the update PR lands. Refs external-secrets/external-secrets#2263 Signed-off-by: Scott Andrews <andrewssc@vmware.com>
|
I created a sample that shows service bindings consuming an external secret. |
|
I made progress with The golangci-lint 1.49.0 ended up being comically bad consuming >100GB of RAM before being killed by the OS. The latest version ( |
6e000a5 to
d296c10
Compare
|
@gusfcarvalho I added the ability to suppress the service binding cluster role |
|
@scothis we just bumped the linter to 1.52 and fixed the linting issues. I'm running the pipeline to see if any other issues appear |
|
for the test case, this block here is similar to what you want to do. Basically add a test definition where tc.checkCondition validates that status.binding.name is the same as spec.target.name (if set), or if it is equals to metadata.name if the spec.target.name is not set :) I also don't think you need a tc.checkExternalSecret in your case. |
d296c10 to
662f346
Compare
|
The helm test failure also exists on main. |
|
added a PR to fix it @scothis. As soon as we get pipeline clear there I'll merge it. Sorry for that bad experience 😢 |
|
BTW, as part of this PR, because we update CRDs, you'll probably need to bump the helm test snapshots. This can be done with |
The Service Binding for Kubernetes project (servicebinding.io) is a spec to make it easier for workloads to consume services. At runtime, the ServiceBinding resource references a service resources and workload resource to connect to the service. The Secret for a service is projected into a workload resource at a well known path. Services can advertise the name of the Secret representing the service on it's status at `.status.binding.name`. Hosting the name of a Secret at this location is the Provisioned Service duck type. It has the effect of decoupling the logical consumption of a service from the physical Secret holding state. Using ServiceBindings with ExternalSecrets today requires the user to directly know and reference the Secret created by the ExternalSecret as the service reference. This PR adds the name of the Secret to the status of the ExternalSecret at a well known location where it is be discovered by a ServiceBinding. With this change, user can reference an ExternalSecret from a ServiceBinding. A ClusterRole is also added with a well known label for the ServiceBinding controller to have permission to watch ExternalSecrets and read the binding Secret. ClusterExternalSecret was not modified as ServiceBindings are limited to the scope of a single namespace. Signed-off-by: Scott Andrews <andrewssc@vmware.com>
662f346 to
26f0e2e
Compare
|
Kudos, SonarCloud Quality Gate passed!
|
|
@gusfcarvalho rebasing on main was sufficient to fix the failing test for me locally, we'll see what CI says. It looks like only CRD tested is SecretStore. There are no tests for RBAC either. |
|
I'm approving, after the rebase we can just merge. |
|
/approve |
|
Awesome stuff, thanks for this ❤️ |
|
Thanks for the support to get this landed. |
External Secrets Operator (ESO) is a way to synthesize Kubernetes Secrets from secure data stores. There is a PR that adds provisioned service support to ExternalSecret resources. This sample is intended to facilitate the conversation between the Service Bindings and External Secrets communities. This PR should not be merged unless and until the update PR lands. Refs external-secrets/external-secrets#2263 Signed-off-by: Scott Andrews <andrewssc@vmware.com>








Problem Statement
The Service Binding for Kubernetes project is a spec to make it easier for workloads to consume services. At runtime, the ServiceBinding resource references a service resources and workload resource to connect to the service. The Secret for a service is projected into a workload resource at a well known path.
Services can advertise the name of the Secret representing the service on it's status at
.status.binding.name. Hosting the name of a Secret at this location is the Provisioned Service duck type. It has the effect of decoupling the logical consumption of a service from the physical Secret holding state.Using ServiceBindings with ExternalSecrets today requires the user to directly know and reference the Secret created by the ExternalSecret as the service reference. Ideally, a user of both ServiceBindings and ExternalSecrets can reference the ExternalSecret resource directly from the ServiceBinding.
The Service Binding community is backed by IBM, RedHat and VMware.
Proposed Changes
This PR adds the name of the Secret to the status of the ExternalSecret at a well known location where it is be discovered by a ServiceBinding. With this change, user can reference an ExternalSecret from a ServiceBinding. There is no runtime dependency on ServiceBindings; this change enables the Service Binding runtime to consume ExternalSecrets.
A ClusterRole is also added with a well known label for the ServiceBinding controller to have permission to watch ExternalSecrets and read the binding Secret.
ClusterExternalSecret was not modified as ServiceBindings are limited to the scope of a single namespace.
Checklist
git commit --signoffmake testmake reviewable