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

[Question] Consuming From another Operator #50

Open
salaboy opened this issue May 27, 2019 · 2 comments

Comments

Projects
None yet
2 participants
@salaboy
Copy link

commented May 27, 2019

Describe the problem:

The problem is, I have two

@Operator(forKind = ServiceA.class, prefix = "salaboy.org")

and

@Operator(forKind = ServiceB.class, prefix = "salaboy.org")

From Service A onAdd(ServiceA serviceA) I want get check all the instances of ServiceB.
It feels to me that then I need to register manually a Fabric8 Kube APIs watch on a Custom Resource, which push me to do all the manual handling instead of reusing the ServiceB operator.

Steps to reproduce:

Observed Results:

  • What happened? This could be a description, log output, etc.

Expected Results:

It will be great if the AbstractOperator provide a client for fetching those resources. By a Client I mean:

private NonNamespaceOperation<ServiceA, ServiceAList, DoneableServiceA, Resource<ServiceA, DoneableServiceA>> serviceACRDClient;

If this exists.. maybe some pointers to the docs would help

@jkremser

This comment has been minimized.

Copy link
Member

commented May 27, 2019

do I get it right that you want to be notified in onAdd(A a) when Bs are being "CRUDed"? Or you just need a way to read all the Bs from that onAdd(A a) method, because there is some 1:n relationship between A and B?

For the latter use-case the AbstractOperator.getDesiredSet() could work. However, I like your suggestion to expose that crd client to provide even more flexibility. Would that be something you would like to implement and send PR?

@salaboy

This comment has been minimized.

Copy link
Author

commented May 27, 2019

@Jiri-Kremser thanks for the response and yes... I was looking for that exact use case "you just need a way to read all the Bs from that onAdd(A a) method, because there is some 1:n relationship between A and B?"

It will be great to add Spring Boot support for auto configs.. so I can auto wire one Operator into another and then do List as = operatorA.getResources();

I can create a PR.. but the main problem that I see is the leaking of the Fabric8 types to the consume. I like the way that you guys abstracted all the Doneable things from the Fabric8 client.. I would like to keep it that way..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.