community icon indicating copy to clipboard operation
community copied to clipboard

Creating new status fields for RDS DBInstance CRD

Open davirobin opened this issue 2 years ago • 18 comments

What Is Your Question? Is it possible to create new status fields for the RDS DBInstance CRD through ack-generate code generation?

What Is The Context For This Question? I am currently investigating the integration of Redhat Service Binding Operator (SBO) with ACK RDS, more specifically the DBInstance CRD, to enhance native binding. Going through the code-generator documentation and the community docs for determining status fields, there is a lot of material on how the custom code generator works using existing Create Operation’s Output shape. I need to create fields outside of the Output scope.

For example, to integrate the ACK RDS DBInstance with SBO I need to turn the DBInstance into a Provisioned Service via adding status.binding.name.

Any Additional Info? This question is separate, but adjacent to the ACK K8s Native Application Binding proposal. FieldExport allows the user to export fields from the status to secrets whereas I need to include a new field in status to point to an existing secret.

davirobin avatar May 10 '22 19:05 davirobin

This issue we have from the Crossplane team asks something similar: https://github.com/aws-controllers-k8s/community/issues/881

The current answer I have for you is that we currently don't have a configuration for the code-generator to create an arbitrarily shaped field. We do support creating custom lists or maps using existing AWS SDK shapes and for setting the shape of a field.

The problem with adding status.binding.name to the RDS CRDs is that it is only applicable to SBO. The team at Crossplane maintain their own separate set of CRDs for every service, and in that they inject new fields that are only applicable to them and then also write custom code to initialize those fields. I understand it's annoying to maintain your own code, but putting custom SBO code into ACK controllers makes for a confusing experience for those who aren't using SBO.

With that said, if you are interested in maintaining a set of the RDS CRDs which can integrate with SBO, we can work on a solution for getting fields into the right place with custom generator code.

RedbackThomson avatar May 10 '22 20:05 RedbackThomson

Yes, I am interested in maintaining the RDS CRDs which can integrate with SBO. I understand the cause for concern with adding the code as a new feature regarding the confusion for non-SBO users. This question was more about understanding how ack-generate creates its CR fields and being able to create custom fields locally or maintaining custom RDS CRDs and generator code.

davirobin avatar May 11 '22 18:05 davirobin

Okay cool. In that case, we still don't currently support adding arbitrary structs to the either the spec or status. This is mainly because our code-gen relies on using the AWS SDK models to build methods, so we kind of need an SDK model associated with everything. The way we support creating custom lists or maps is by creating a new SDK shape and injecting it into the model set before generation (see the code, here). I imagine this could be extended, whereby we accept arbitrary shapes either in the generator YAML file (maybe passed in through a file path) and take the same actions. This isn't supported out of the box at the moment, though.

RedbackThomson avatar May 12 '22 17:05 RedbackThomson

Something I think might be relevant to this conversation: .status.binding.name comes from a specification upstream of SBO, so this wouldn't just be applicable to only SBO. For instance, there's an implementation from VMWare for use with Tanzu (source here), and there's also a work-in-progress reference implementation of the specification.

sadlerap avatar May 12 '22 18:05 sadlerap

The FieldExport API provides native bindings for all kinds of developers. Both application development and infrastructure code can use FieldExport. However, it is a cumbersome solution for application development. Contrary to DevOps engineers who work with infrastructure code, application developers only require a minimal set of fields that is part of an AWS service. The application needs to connect to the service to perform its primary purpose. For example, database connectivity is the only requirement for application in the RDS service. The DBInstance custom resource part of RDS could become a Provisioned Service with a Secret resource containing all the fields required for database connectivity. Similar to RDS, other services can also provide Provisioned Service APIs.

Sometime back, I wrote a blog post about Service Binding spec focusing on Provisioned Service. Please read it here: https://muthukadan.net/kubernetes/binding/support-service-binding-specification-for-kubernetes/

baijum avatar Jul 21 '22 03:07 baijum

I have created a proof of concept support for Provisioned Service in the ACK RDS controller. The demo video is here: https://www.youtube.com/watch?v=AXXWv7N12JM I intend to demonstrate the end-user experience of the ACK RDS controller with support for Provisioned Service. If there is interest, I would be happy to work on a proposal to submit here: https://github.com/aws-controllers-k8s/community/tree/main/docs/design/proposals

baijum avatar Aug 29 '22 14:08 baijum

I have created a proof of concept support for Provisioned Service in the ACK RDS controller. The demo video is here: https://www.youtube.com/watch?v=AXXWv7N12JM I intend to demonstrate the end-user experience of the ACK RDS controller with support for Provisioned Service. If there is interest, I would be happy to work on a proposal to submit here: https://github.com/aws-controllers-k8s/community/tree/main/docs/design/proposals

This is awesome! Often we are only thinking about the experience for the DevOps teams that use and maintain these operators, so I'm glad you are able to understand how developers would interact with the final result. It'd be great to see a proposal. Before you submit one though, would you mind just summarising what those changes would be?

RedbackThomson avatar Sep 07 '22 18:09 RedbackThomson

It'd be great to see a proposal. Before you submit one though, would you mind just summarising what those changes would be?

I modified the generated code in the RDS controller for the POC. The changes are here: https://github.com/baijum/ack-rds-controller/commit/98da817f099022c5a1e49a0b2cedcf6bec171f57

  1. Updated the DBInstanceStatus to make the DBIntance a Provisioned Service (.status.binding.name attribute)
  2. Updated the ClusterRole with create and update permissions
  3. Updated the controller code to create the Secret resource To create a Secret resource, I have also modified the runtime package. In the runtime package, I updated the Reconciler interface with a new method with a signature like this: CreateSecret(context.Context, *corev1.Secret) error

I intended to demonstrate the developer experience if the DBInstance becomes a Provisioned Service.

Note: An alternative solution would be to use the Direct Secret Reference feature of the Service Binding Specification.

baijum avatar Sep 08 '22 06:09 baijum

I have sent a PR with proposal: #1539

baijum avatar Nov 09 '22 09:11 baijum

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close. If this issue is safe to close now please do so with /close. Provide feedback via https://github.com/aws-controllers-k8s/community. /lifecycle stale

ack-bot avatar Mar 14 '23 13:03 ack-bot

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close. If this issue is safe to close now please do so with /close. Provide feedback via https://github.com/aws-controllers-k8s/community. /lifecycle stale

ack-bot avatar Jun 13 '23 15:06 ack-bot

Stale issues rot after 60d of inactivity. Mark the issue as fresh with /remove-lifecycle rotten. Rotten issues close after an additional 60d of inactivity. If this issue is safe to close now please do so with /close. Provide feedback via https://github.com/aws-controllers-k8s/community. /lifecycle rotten

ack-bot avatar Aug 12 '23 16:08 ack-bot

Rotten issues close after 60d of inactivity. Reopen the issue with /reopen. Provide feedback via https://github.com/aws-controllers-k8s/community. /close

ack-bot avatar Oct 11 '23 17:10 ack-bot

@ack-bot: Closing this issue.

In response to this:

Rotten issues close after 60d of inactivity. Reopen the issue with /reopen. Provide feedback via https://github.com/aws-controllers-k8s/community. /close

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.

ack-prow[bot] avatar Oct 11 '23 17:10 ack-prow[bot]

Rotten issues close after 60d of inactivity. Reopen the issue with /reopen. Provide feedback via https://github.com/aws-controllers-k8s/community. /close

ack-bot avatar Dec 10 '23 18:12 ack-bot

@ack-bot: Closing this issue.

In response to this:

Rotten issues close after 60d of inactivity. Reopen the issue with /reopen. Provide feedback via https://github.com/aws-controllers-k8s/community. /close

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.

ack-prow[bot] avatar Dec 10 '23 18:12 ack-prow[bot]

Rotten issues close after 60d of inactivity. Reopen the issue with /reopen. Provide feedback via https://github.com/aws-controllers-k8s/community. /close

ack-bot avatar Feb 09 '24 07:02 ack-bot

@ack-bot: Closing this issue.

In response to this:

Rotten issues close after 60d of inactivity. Reopen the issue with /reopen. Provide feedback via https://github.com/aws-controllers-k8s/community. /close

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.

ack-prow[bot] avatar Feb 09 '24 07:02 ack-prow[bot]

Rotten issues close after 60d of inactivity. Reopen the issue with /reopen. Provide feedback via https://github.com/aws-controllers-k8s/community. /close

ack-bot avatar Apr 09 '24 12:04 ack-bot

@ack-bot: Closing this issue.

In response to this:

Rotten issues close after 60d of inactivity. Reopen the issue with /reopen. Provide feedback via https://github.com/aws-controllers-k8s/community. /close

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.

ack-prow[bot] avatar Apr 09 '24 12:04 ack-prow[bot]