Operator of Operator for multi stack

20 views
Skip to first unread message

Dharun T

unread,
Jul 6, 2022, 7:30:32 AM7/6/22
to Operator Framework
Hi,

I'm new to the operator SDK, I have a need to build an operator for an application which consist of cassandra , & kafka.

I see in the best practices (https://sdk.operatorframework.io/docs/best-practices/best-practices/) that I should be creating operator of operators for multiple stacks.

I don't find any example, Can you please help me?

Thanks,
Dharun


Camila Macedo

unread,
Jul 6, 2022, 10:30:15 AM7/6/22
to Dharun T, Operator Framework
Hi Dharun, 

Welcome. Following the comments inline. 

I see in the best practices (https://sdk.operatorframework.io/docs/best-practices/best-practices/) that I should be creating operator of operators for multiple stacks.

The docs say that you should NOT create an Operator that manages/install other Operators. It is better clarified here: https://sdk.operatorframework.io/docs/best-practices/common-recommendation/#ideally-operators-does-not-manage-other-operators. The recommendation is to use OLM dep to configure that your Operator depends on other Operators. You will find the links with examples in the doc shared above. 

I'm new to the operator SDK,
 
However, since you are new, I'd like to recommend you do the following steps before start develops your solution: 

c) If things are not clear after that, might look at the blog that can help you out (10 min): which is a summarized/simplified overview of the Golang tutorial : https://dev4devs.com/2020/08/16/how-to-getting-started-develop-go-operators-from-scratch-with-sdk-1-0/

I hope that helps out.

Cheers, 

CAMILA MACEDO

SR. SOFTWARE ENGINEER 

RED HAT Operator framework

Red Hat UK

She / Her / Hers

IM: cmacedo

I respect your work-life balance. Therefore there is no need to answer this email out of your office hours.





--
You received this message because you are subscribed to the Google Groups "Operator Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to operator-framew...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/operator-framework/6fa83f98-2ade-4381-a5c6-fd1df39fbad6n%40googlegroups.com.

Guangya Liu

unread,
Jul 6, 2022, 10:33:32 AM7/6/22
to Dharun T, Operator Framework
Hi Dharun, there is an open source project named as ODLM at https://github.com/IBM/operand-deployment-lifecycle-manager which is a meta operator, you can check if this helps. Thanks!

Dharun T

unread,
Jul 6, 2022, 11:16:11 PM7/6/22
to Operator Framework
Hi,

I have already created operator for cassandra as statefulset.

Is it possible to deploy another statefulset within the same reconciler ?

Thanks

Camila Macedo

unread,
Jul 7, 2022, 4:38:41 AM7/7/22
to Dharun T, Operator Framework
Hi Dharun T,

I have already created operator for cassandra as statefulset.
Is it possible to deploy another statefulset within the same reconciler ?

So, you have Operator A ( responsible to manage Operand Cassandra) and you have another Operator B that to work requires to have Operator A ( Cassandra ) installed. 

Could you please let us know why you want your Operator project B(which depends on Cassandra) to do some reconciliation of Operator A?  Why not leave Operator A(Cassandra), responsible for managing Cassandra, to do that? 

Why would you like to give Operator B a responsibility outside its domain (is Operator B responsible to manage Cassandra? I do not think so, you have an Operator to do that)? 

(PS.: It seems hurt concepts such as encapsulation, the Single Responsibility Principle, and Cohesion. Damaging these concepts may cause unexpected side effects, and increase the difficulty of extending, reusing, or maintaining the operator.) 

Why not define that to use Operator B you need to have installed Operator A ( Cassandra ) via the OLM Dependency resolution (https://olm.operatorframework.io/docs/concepts/olm-architecture/dependency-resolution/#declaring-dependencies)? 

Do you need to do anything on Operator B (the one that depends on Cassandra ) when a CR of a CRD is defined/owned by Operator A (Cassandra) is applied on the cluster that is outside of the Cassandra domain of responsibility? If so, why the reconciliation should be precisely the same? 

OR 

Are you looking to make sure that to use Operator B, you need to have all that was done in Operator A (Cassandra) when the CR for this CRD was applied on the cluster? 

Cheers, 

CAMILA MACEDO

SR. SOFTWARE ENGINEER 

RED HAT Operator framework

Red Hat UK

She / Her / Hers

IM: cmacedo

I respect your work-life balance. So, you don't need to answer this email out of your office hours.





On Thu, Jul 7, 2022 at 4:16 AM Dharun T <dhar...@gmail.com> wrote:
Hi,

I have already created operator for cassandra as statefulset.

Is it possible to deploy another statefulset within the same reconciler ?

Thanks

On Wednesday, 6 July, 2022 at 8:03:32 pm UTC+5:30 gyli...@gmail.com wrote:
Hi Dharun, there is an open source project named as ODLM at https://github.com/IBM/operand-deployment-lifecycle-manager which is a meta operator, you can check if this helps. Thanks!

On Wed, Jul 6, 2022 at 7:30 AM Dharun T <dhar...@gmail.com> wrote:
Hi,

I'm new to the operator SDK, I have a need to build an operator for an application which consist of cassandra , & kafka.

I see in the best practices (https://sdk.operatorframework.io/docs/best-practices/best-practices/) that I should be creating operator of operators for multiple stacks.

I don't find any example, Can you please help me?

Thanks,
Dharun


--
You received this message because you are subscribed to the Google Groups "Operator Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to operator-framew...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/operator-framework/6fa83f98-2ade-4381-a5c6-fd1df39fbad6n%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Operator Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to operator-framew...@googlegroups.com.

Camila Macedo

unread,
Jul 7, 2022, 4:45:56 AM7/7/22
to Dharun T, Operator Framework
Just a small correction, ensure that you check the docs versioned with v0.18.z in the olm docs website: 


Because the latest docs ( master ) show how to configure OLM dependency in your package with the FBC catalog and the pipelines such as to publish on RedHat Community[1] or OperatorHub[2] do not provide options to authors working with FBC yet. 


Cheers, 

CAMILA MACEDO

SR. SOFTWARE ENGINEER 

RED HAT Operator framework

Red Hat UK

She / Her / Hers

IM: cmacedo

I respect your work-life balance. Therefore there is no need to answer this email out of your office hours.




Dharun T

unread,
Jul 8, 2022, 12:13:13 AM7/8/22
to Operator Framework
Hello Camila,

I'm looking for this " Are you looking to make sure that to use Operator B, you need to have all that was done in Operator A (Cassandra) when the CR for this CRD was applied on the cluster?"

Operator A - Cassandra.
Operator B - Kafka.
Operator C- Application that connects Cassandra & kafka.

I need to make sure that cassandra and the kafka are up and running before the applications starts.

Thanks,
Dharun

Camila Macedo

unread,
Jul 8, 2022, 5:56:39 AM7/8/22
to Dharun T, Operator Framework
Hi Dharun, 

I need to make sure that cassandra and the kafka are up and running before the applications starts.

Then, you do not need to do the same reconciliation. 

So, you need your Operator C able to get/list/watch/update external types so that you can, for example, check their status. It seems like very similar to how you use a Deployment Kind, for example, which is not defined and owned by the project itself. However, the main difference is that all core-type schemes are added by default to the manager when any third-party/external type is not. Also, when you init the manager would be nice to ensure that the API exists on the cluster. 
Note that you could also create a controller to reconcile core types or external types see an old Kubebuilder doc(Using an External Type)[3] that speaks about it. However, unfortunately, the tools currently do not handle external types. See the issue: https://github.com/kubernetes-sigs/kubebuilder/issues/1999.

So, suppose you want a controller to reconcile an external type (a Kind not defined/owned by the project). In that case, you can use the create api [Options] command to scaffold. But you will need to manually update the files to achieve the goal. You will find further info in the issue shared to better know what is required to be changed.  

I hope that helps you out.


CAMILA MACEDO

SR. SOFTWARE ENGINEER 

RED HAT Operator framework

Red Hat UK

She / Her / Hers

IM: cmacedo

I respect your work-life balance. Therefore there is no need to answer this email out of your office hours.





Reply all
Reply to author
Forward
0 new messages