Skip to content
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

Dynamic resource references #1576

Open
a-hilaly opened this issue Dec 6, 2022 · 9 comments
Open

Dynamic resource references #1576

a-hilaly opened this issue Dec 6, 2022 · 9 comments
Labels
area/code-generation Issues or PRs as related to controllers or docs code generation area/runtime Issues or PRs as related to controller runtime, common reconciliation logic, etc help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature.

Comments

@a-hilaly
Copy link
Member

a-hilaly commented Dec 6, 2022

The ACK ecosystem currently supports referencing resources from the same or different GVKs within a static implementation. For example, you can reference an s3::bucket in a lambda::function object. However, this implementation does not allow for the referencing of multiple resource types.

Ideally, we would like to expand this feature to support the referencing of any object managed by ACK controllers. This would allow for resources like AWS EventBridge Rule targets to reference a wide range of resources, such as sns::topic and sqs::queue.

The ACK ecosystem's current ability to reference resources is a new feature that was developed in response to a recent problem. @embano1 and I will continue exploring and working on a design document for this feature, which will involve refactoring the original resource reference implementation to allow for the referencing of multiple resource types. This will require moving the generation logic to the code-generator/pkg/generate package and switching to the k8s dynamic client.

@a-hilaly a-hilaly added area/code-generation Issues or PRs as related to controllers or docs code generation area/runtime Issues or PRs as related to controller runtime, common reconciliation logic, etc needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. kind/feature Categorizes issue or PR as related to a new feature. labels Dec 6, 2022
@a-hilaly
Copy link
Member Author

a-hilaly commented Dec 6, 2022

@embano1
Copy link
Member

embano1 commented Dec 6, 2022

+1 to simplify the code base (eventually) using dynamic client and make it easier to compose resources using TypedLocalObjectReferences.

For example, as an EventBridge controller user I want to reference an SQS queue as a target which is also managed by ACK:

apiVersion: eventbridge.services.k8s.aws/v1alpha1
kind: Rule
metadata:
  name: rule-01
  namespace: namespace-01
spec:
  name: rule-01
  eventPattern: "{\"detail-type\":\"testevent\"}"
  # keep as is
  eventBusRef:
    name: eventbus-01
  # allows by arn and TypedLocalObjectReference
  targets:
    - id: someResourceFromArn
      arn: arn:aws:1234567890:someresource
    - id: queueFromRef
      objectRef:
        apiGroup: sqs.services.k8s.aws/v1alpha1
        kind: Queue
        name: queue-01

To be discussed: do we allow cross-namespace resource references (ObjectReference) or resources must be within the same namespace? I can see use cases for both.

Alternative approaches: in Knative we use duck typing on Kubernetes resources in references. E.g. we could create an Arnable reference object which is any Kubernetes object with a set arn in status:

status:
  ackResourceMetadata:
    arn: <arn>

@jaypipes
Copy link
Collaborator

jaypipes commented Dec 7, 2022

@a-hilaly @embano1 @RedbackThomson @jljaco I think it's probably a good idea to just use the dynamic client anyway for everything... that way we can remove the need to include in the go.mod file the referenced controller libs.

@embano1
Copy link
Member

embano1 commented Dec 7, 2022

Yup, will help with a lot of imports and deps! Kinda feels like generics :-p

@jljaco jljaco added help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. priority/backlog Higher priority than priority/awaiting-more-evidence. triage/needs-information Indicates an issue needs more information in order to work on it. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Feb 1, 2023
@jljaco
Copy link
Contributor

jljaco commented Feb 1, 2023

After some discussion, @RedbackThomson and I would like to see a more full-fledged design proposal for this feature before we can potentially slate it for future work.

@a-hilaly @jaypipes @embano1 anyone have bandwidth to come up with a more detailed proposal?

@embano1
Copy link
Member

embano1 commented Feb 1, 2023

Happy to assist as EventBridge is going to benefit a lot from this and I brought this up with @a-hilaly based on my experience with Knative, but can't sign up for owning this AI.

@jaypipes
Copy link
Collaborator

jaypipes commented Feb 1, 2023

After some discussion, @RedbackThomson and I would like to see a more full-fledged design proposal for this feature before we can potentially slate it for future work.

@a-hilaly @jaypipes @embano1 anyone have bandwidth to come up with a more detailed proposal?

@jljaco apologies, I don't have bandwidth to work on this one right now

@ack-bot
Copy link
Collaborator

ack-bot commented May 2, 2023

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-prow ack-prow bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 2, 2023
@a-hilaly a-hilaly removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 2, 2023
@ack-bot
Copy link
Collaborator

ack-bot commented Oct 29, 2023

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-prow ack-prow bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Oct 29, 2023
@a-hilaly a-hilaly removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Oct 29, 2023
@a-hilaly a-hilaly removed priority/backlog Higher priority than priority/awaiting-more-evidence. triage/needs-information Indicates an issue needs more information in order to work on it. labels Feb 19, 2024
@a-hilaly a-hilaly pinned this issue Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/code-generation Issues or PRs as related to controllers or docs code generation area/runtime Issues or PRs as related to controller runtime, common reconciliation logic, etc help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

No branches or pull requests

5 participants