community icon indicating copy to clipboard operation
community copied to clipboard

Creating SNS subscription with SQS Protocol

Open rj425 opened this issue 2 years ago • 21 comments

I have a SNS topic and SQS queue. I would like to have my SQS queue subscribed to SNS topic. I have looked at the list of CRDs that SQS and SNS controller offer. But i am unable to find the right CRD that can help me do so.

What have i tried so far:

  • I created a subscription object from the AWS console to understand the configuration changes that takes place in the policy. I tried to make these exact changes to SQS policy using SQS controller. The policy gets changed successfully but there is no SNS subscription.
  • I have looked at the PlatformApplication and PlatformEndpoint CRDs in SNS controller, but i fail to understand if these two CRDs are the solution. If that is the case, can you point me to the documentation that explains it well.

Thanks you.

rj425 avatar Sep 28 '22 12:09 rj425

Currently we are not able to regenerate the sns-controller/sqs-controller and any new resource because of the problems mentioned in https://github.com/aws-controllers-k8s/community/issues/1292

a-hilaly avatar Nov 02 '22 18:11 a-hilaly

Hi @A-Hilaly, issue #1292 is now closed. Would you be able to regenerate the SNS controller resources at this point? We need to create SNS subscriptions as well, and are blocked until that is added.

jessebye avatar Jan 04 '23 23:01 jessebye

Hi @jessebye the sns-controller have been regenerated and a new release v0.0.4 was released? currently it doesn't support Subscriptions but we can definitely open an issue and give it a shot.

a-hilaly avatar Jan 05 '23 18:01 a-hilaly

@jessebye I just checked the API and i don't see a CreateSubscription API Call, however there is a Subscribe call that is related to SNS Endpoint and SNS Topics, is this the operation you'd like to see supported?

a-hilaly avatar Jan 05 '23 18:01 a-hilaly

Hi @A-Hilaly , thanks for the update! Yes, Subscribe would be the operation we want to support. Also probably ConfirmSubscription so we can confirm the subscription after creating it. Thank you 😀

jessebye avatar Jan 05 '23 18:01 jessebye

Hi @A-Hilaly , thanks for the update! Yes, Subscribe would be the operation we want to support. Also probably ConfirmSubscription so we can confirm the subscription after creating it. Thank you grinning

@jessebye @A-Hilaly I suppose we could try to create a Subscription resource and have Subscribe be the Create call and Unsubscribe be the Delete call. We would use the GetSubscriptionAttributes and SetSubscriptionAttributes calls for the Update code path.

This would come with a caveat, though:

We would only support creating Subscription resources to endpoints in the same AWS account. The reason for this is because the requirement for the endpoint owner to call ConfirmSubscription when receiving a Subscribe call from an account other than the endpoint's owner is antithetical to the way that Kubernetes controllers work to reconcile the state of an owned resource. In the case of Subscribing to a different account's Endpoint, the subscription isn't actually owned by the calling account.

@jessebye would you be cool with the above behaviour?

jaypipes avatar Jan 06 '23 19:01 jaypipes

@jaypipes sounds reasonable to me! Thanks!

jessebye avatar Jan 06 '23 20:01 jessebye

@jaypipes @A-Hilaly Is there anything I can do to help move this along? This is blocking our team's progress on some initiatives that use SNS. I'd be glad to contribute if that would be helpful!

jessebye avatar Feb 10 '23 05:02 jessebye

@jaypipes @A-Hilaly Is there anything I can do to help move this along? This is blocking our team's progress on some initiatives that use SNS. I'd be glad to contribute if that would be helpful!

Working on this right now, @jessebye! :) Just got done adding FIFOTopic and other new attributes to the controller. Adding support for Subscription resource now...

jaypipes avatar Feb 10 '23 15:02 jaypipes

#1292

Hi Jay, it's been a little bit more than a month and I know you're pretty much busy implementing all the stuff we ask, but, can you give an update on the implementation status?

matheushent avatar Mar 15 '23 11:03 matheushent

@matheushent I've made great progress on it. Should have something pushed by end of today.

jaypipes avatar Mar 15 '23 12:03 jaypipes

@jaypipes awesome mate, do you have the PR or branch so I can follow?

matheushent avatar Mar 15 '23 13:03 matheushent

@matheushent yup! here it is: https://github.com/jaypipes/ack-sns-controller/tree/subscription

I'm working on e2e tests and debugging failures :)

jaypipes avatar Mar 15 '23 13:03 jaypipes

@matheushent @jessebye @rj425 OK all, I have support for SNS Subscriptions in a PR here:

https://github.com/aws-controllers-k8s/sns-controller/pull/26

Hoping to get that merged today and work on support for changing Subscription Attributes and setting tags on Subscription resources.

jaypipes avatar Apr 01 '23 10:04 jaypipes

@matheushent @jessebye @rj425 Release v0.0.11 contains support for Subscription resources. Please do check it out.

jaypipes avatar Apr 03 '23 12:04 jaypipes

Would something like EndpointRef be possible with the Subscription resource? Would maybe be a QoL improvement when working with Topic resource and SQS Queue resource.

logand22 avatar Apr 11 '23 18:04 logand22

Would something like EndpointRef be possible with the Subscription resource? Would maybe be a QoL improvement when working with Topic resource and SQS Queue resource.

@logand22 which specific field on Subscription resources do you want to add resource reference ability?

jaypipes avatar May 03 '23 14:05 jaypipes

@jaypipes My particular use case would be to allow you to use resource reference with different endpoints. For instance, creating a subscription between SNS + SQS when running both the sns + sqs controllers. I can do it today using the ARN, but it would be a quality of life improvement to use the SQS Queue resource name.

logand22 avatar May 04 '23 14:05 logand22

Issues go stale after 180d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 60d 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 Oct 31 '23 17:10 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 Dec 30 '23 18:12 ack-bot

Issues go stale after 180d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 60d 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 28 '24 02:06 ack-bot