<p>I need to deploy several containers to a Kubernetes cluster. The objetive is automating the deployment of Kafka, Kafka Connect, PostgreSQL, and others. Some of them already provide a Helm operator that we could use. So my question is, can we somehow use those helm operators inside our operator? If so, what would be the best approach?</p>
<p>The only method I can think of so far is calling the helm setup console commands from within a deployment app.
Another approach, without using those helm files, would be implementing the functionality of each operator in my own operator, which doesn't seem to make much sense since what I need was already developed and is public.</p>
<p>I'm very new to operator development so please excuse me if this is a silly question.</p>
<p><strong>Edit</strong>:
The main purpose of the operator is to deploy X databases. Along with that we would like to have a single operator/bundle that deploys the whole system right away. Does it even make sense to use an operator to bundle, even if we have additional tasks for some of the containers? With this, the user would specify in the yaml file:</p>
<pre><code>databases
  - type: &quot;postgres&quot;
    name: &quot;users&quot;
  - type: &quot;postgres&quot;
    name: &quot;purchases&quot;
</code></pre>
<p>and 2 PostgreSQL databases would be created. Those databases could then be mentioned in other yaml files or further down in the same yaml file. Case on hands: the information from the databases will be pulled by Debezium (another container), so Debezium needs to know their addresses. So the operator should create a service and associate the service address with the database name.</p>
<p>This is part of an ETL system. The idea is that the operator would allow an easy deployment of the whole system by taking care of most of the configuration.
With this in mind, we were thinking if it wasn't possible to pick on existing Helm operators (or another kind of operator) and deploy them with small modifications to the configurations such as different ports for different databases.</p>
<p>But after reading F1ko's reply I gained new perspectives. Perhaps this is not possible with an operator as initially expected?</p>
<p><strong>Edit2</strong>: Clarification of edit1.</p>

KON
<p>Just for clarification purposes:</p>
<ul>
<li><p>Helm is a package manager with which you can install an application onto the cluster in a bundled matter: it basically provides you with all the necessary YAMLs, such as ConfigMaps, Services, Deployments, and whatever else is needed to get the desired application up and running in a proper way.</p>
</li>
<li><p>An Operator is essentially a controller. In Kubernetes, there are lots of different controllers that define the &quot;logic&quot; whenever you do something (e.g. the replication-controller adds more replicates of a Pod if you decide to increment the <code>replicas</code> field). There simply are too many controllers to list them all and have running individually, that's why they are compiled into a single binary known as the kube-controller-manager.
Custom-built controllers are called operators for easier distinction. These operators simply watch over the state of certain &quot;things&quot; and are going to perform an action if needed. Most of the time these &quot;things&quot; are going to be CustomResources (CRs) which are essentially new Kubernetes objects that were introduced to the cluster by applying CustomResourceDefinitions (CRDs).</p>
</li>
</ul>
<p>With that being said, it is not uncommon to use helm to deploy operators, however, try to avoid the term &quot;helm operator&quot; as it is actually referring to a very specific operator and may lead to confusion in the future: <a href="https://github.com/fluxcd/helm-operator" rel="nofollow noreferrer">https://github.com/fluxcd/helm-operator</a></p>
<blockquote>
<p>So my question is, can we somehow use those helm operators inside our operator?</p>
</blockquote>
<p>Although you may build your own operator with the <a href="https://github.com/operator-framework/operator-sdk" rel="nofollow noreferrer">operator-sdk</a> which then lets you deploy or trigger certain events from other operators (e.g. by editing their CRDs) there is no reason to do so.</p>
<blockquote>
<p>The only method I can think of so far is calling the helm setup console commands from within a deployment app.</p>
</blockquote>
<p>Most likely what you are looking for is a proper CI/CD workflow.
Simply commit the helm chart and <a href="https://helm.sh/docs/chart_template_guide/values_files/" rel="nofollow noreferrer"><code>values.yaml</code></a> files that you are using during <code>helm install</code> inside a <a href="https://git-scm.com/" rel="nofollow noreferrer">Git</a> repository and have a CI/CD tool (such as <a href="https://docs.gitlab.com/ee/ci/" rel="nofollow noreferrer">GitLab</a>) deploy them to your cluster every time you make a new commit.</p>
<p><strong>Update:</strong> As the other edited his question and left a comment i decided to update this post:</p>
<blockquote>
<p>The main purpose of the operator is to deploy X databases. Along with that we would like to have a single operator/bundle that deploys the whole system right away.</p>
</blockquote>
<blockquote>
<p>Do you think it makes sense to bundle operators together in another operator, as one would do with Helm?</p>
</blockquote>
<p>No it does not make sense at all. That's exactly what helm is there for. With helm you can bundle stuff, you can even bundle multiple helm charts together which may be what you are actually looking for. You can have one helm chart that passes the needed values down to the actual operator helm charts and therefore use something like the service-name in multiple locations.</p>
<blockquote>
<p>In the case of operators inside operators, is it still necessary to configure every sub-operator individually when configuring the operator?</p>
</blockquote>
<p>As mentioned above, it does not make any sense to do it like that, it is just an over-engineered approach. However, if you truly want to go with the operator approach there are basically two approaches you could take:</p>
<ul>
<li>Write an operator that configures the other operators by changing their CRs, ConfigMaps etc. ; with this this approach you will have a <em>somewhat</em> lightweight operator, however you will have to ensure it is compatible at all times with all the different operators you want it to interfere with (when they change to a new <code>apiVersion</code> with breaking changes, introduce new CRs or anything of that kind, you will have to adapt again).</li>
<li>Extract the entire logic from the existing operators into your operator (i.e. rebuild something that already already exists); with this approach you will have a big monolithic application that will be huge pain to maintain as you will continuously have to update your code whenever there is an update in the upstream operator</li>
</ul>
<p>Hopefully it is clear by now that building your own operator for &quot;operating&quot; other operators comes with lot of painful dependencies and should not be the way to go.</p>
<blockquote>
<p>Is it possible to deploy different configurations of images? Such as databases configured with different ports?</p>
</blockquote>
<p>Good operators and helm charts let you do that out of the box, either via a respective CR / ConfigMap or a <code>values.yaml</code> file, however, that now depends on what solutions you are going to use. So in general the answer is: yes, it is possible if supported.</p>
