-
Notifications
You must be signed in to change notification settings - Fork 267
Service Binding Specification for Kubernetes #1539
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
Conversation
Signed-off-by: Baiju Muthukadan <[email protected]>
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: baijum The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @baijum, cool idea! I like this proposal. Couple inline questions/comments for you to think about.
docs/design/proposals/provisioned-service/provisioned-service.md
Outdated
Show resolved
Hide resolved
// Binding exposes the Secret for Service Binding to conform the Provisioned Service | ||
// as per the Service Binding Specification for Kubernetes. | ||
// Ref. https://github.com/servicebinding/spec#provisioned-service | ||
Binding *ServiceBindingSecretReference `json:"binding,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We would want to place this field within the Status.ACKResourceMetadata
subfield. That way, it won't conflict with any resources that might have a Binding
field already in their status...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Service Binding Specification expects the Provisioned Service (e.g., DBInstance
) to point to the Secret resource from .status.binding.name
attribute. I think we can confirm if that field is not conflicting with any existing fields.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@baijum the problem is that the Status
and Spec
fields for all ACK resources are automatically generated by looking at the AWS service API's model definition. We don't know if there are APIs that have a Binding
field in any Create operation's Output shape. If there were, that would conflict with this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we check if the.status.binding.name
attribute exists for any API? Also is it possible to reserve this field for service binding, so that it will not conflict in the future?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could do this, sure, but the problem is we cannot predict the future. Since ACK CRDs are generated from the upstream API models, what happens if an upstream service API adds a Binding field in the future? This is why we place these kinds of fields into Status.ACKResourceMetadata
to ensure that we don't conflict.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have created a proposal to the spec here: servicebinding/spec#223
Let me know if creating a Secret resource with the same name as that of DBInstance
resource (or any other service) would be acceptable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@baijum I left a comment in the other PR. I would be OK with a separate reconciler (ala the FieldExportReconciler
we already have in ACK) that would create/manage Secret resources like servicebinding.io expects.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 with Jay's comment here. This functionality seems similar enough to FieldExport
, in that it accesses CRD fields and outputs into a Secret
, that I believe it could simply be handled by that reconciler. In fact, we could add this feature by simply adding an optional field within the FieldExport
CRD that provides an alternative to from.path
, instead being from.bindingSpecification: true/false
(name TBD). This would sidestep the need to reserve the .status.binding
field.
|
||
Since a Secret resource needs to be created, updated, and deleted, the | ||
ClusterRole requires "*create",* "*update", and "delete"* permissions. | ||
Currently, this permission is not set in the existing controllers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current ClusterRole
allows getting, patching, listing and watching Secret resources. Why would we need to add Create and Delete permissions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Service Binding Specification expects the Provisioned Service (e.g., DBInstance
) to point to a Secret resource with all values required for connectivity from the application. In the case of DBInstance
, the corresponding controller needs to ensure the presence of the Secret resource. To create a Secret, Create
permission is required. Similarly when the DBInstance
is getting deleted, cleaning up the corresponding Secret resource would be good. Hence the Delete
permission.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@baijum how does the controller know what the Secret's name will be?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The DBInstance
controller generates the Secret. For example, the name could be the same as the DBInstance
name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
DBInstance
controller generates the Secret. For example, the name could be the same as theDBInstance
name.
@baijum ACK's approach is generally to give that power to the Kubernetes user, which is why the separate reconciler in ACK processes FieldExport
CRs that allow the Kubernetes user to specify the name of the Secret or ConfigMap to export fields into.
|**Field** | **Value** | **Remarks** | ||
|-----------|--------------------------|------------------------------- | ||
|type | postgresql/mysql | Based on Spec.Engine | ||
|provider | aws | | ||
|host | Status.Endpoint.Address | | ||
|port | Status.Endpoint.Port | | ||
|username | Spec.MasterUsername | | ||
|password | | Based on Spec.MasterUserPassword | ||
|database | Spec.Engine? | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are the above fields intended to be populated as keys within a Secret?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the keys will change depending on the service. The above keys are examples that can be used with a relational database.
Co-authored-by: Jay Pipes <[email protected]>
There are real world Services where the resource schema is auto-generated and no controll over what fields may get added to the status. See this discussion in ACK project. aws-controllers-k8s/community#1539 (comment) Signed-off-by: Baiju Muthukadan <[email protected]>
// Binding exposes the Secret for Service Binding to conform the Provisioned Service | ||
// as per the Service Binding Specification for Kubernetes. | ||
// Ref. https://github.com/servicebinding/spec#provisioned-service | ||
Binding *ServiceBindingSecretReference `json:"binding,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 with Jay's comment here. This functionality seems similar enough to FieldExport
, in that it accesses CRD fields and outputs into a Secret
, that I believe it could simply be handled by that reconciler. In fact, we could add this feature by simply adding an optional field within the FieldExport
CRD that provides an alternative to from.path
, instead being from.bindingSpecification: true/false
(name TBD). This would sidestep the need to reserve the .status.binding
field.
### Implementation | ||
|
||
Since the API changes required for various custom resources are | ||
standard, and they can be generated for all controllers. However, the | ||
changes for each of these controllers can be implemented gradually. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This implementation doesn't really touch on how we know which fields are required for the binding specification? I imagine that each of the bindings will need to be manually crafted. It would be good to have a section that describes how controller maintainers can add new bindings and how they know what the spec should be.
I am closing this proposal as FieldExport can be used as a solution for the problem. |
@baijum I see you have closed this PR. Do you have an example for the ACK community with how FieldExport could implement the service binding spec? |
As I explained here: https://gist.github.com/baijum/96158408eaf544f692acfad42f2b49df
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: baijum The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Issues go stale after 180d of inactivity. |
Stale issues rot after 60d of inactivity. |
Rotten issues close after 60d of inactivity. |
@ack-bot: Closed this PR. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Signed-off-by: Baiju Muthukadan [email protected]
Issue #1289 , if available:
Description of changes:
Proposal to add support for Service Binding Specification for Kubernetes
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.