<p>From what I understood is that you want add deploy a configMap and a Deployment based on some API calls every time you need to add a new customer?</p>
<p>Basically you need a CD Pipeline that triggers a deployment based on new customer added. The trigger can be an API Call or a webhook from your software where you add a new customer. It should support sending an API call with details required in those ConfigMaps and Deployments. Now with the details of API Call you'd need to pass those parameters to a Values.yaml of Helm Chart which then goes and deploys to your selected cluster.</p>
<p>If you don't have a CD, you can use Azure Devops or ArgoCD. Both of these support trigger based on API Calls. Then setup the pipeline with connection to your cluster. In Azure Devops, you'd have to create a service connection and in ArgoCD register your cluster. Also, Helm Chart is the easiest way to deploy k8s manifests to it'd be preferable if you did it via that. ArgoCD would limit you to k8s only. You can go with Azure Devops for support for all. I'd have said Jenkins but managing that is a pain in the back. If that is not an issue you can try that too.</p>

CC BY-SA 4.0
2021-08-11T11:38:07.410Z
Hi @Anti21, Thank you for the answer!

We use gitlab as our CI/CD platform and the CD can be triggered via api calls, I think our biggest problem is about where can we store customer specific info and monolith config (shared and specific) so we can easily retrieve it during the CD process. I'm not sure it's possible to do that with ConfigMaps because I'm just starting with k8s. I've searched a bit and maybe a json in a git repo would solve the problem, or an entry in some config management database.
Leonardo Cavalcante
CC BY-SA 4.0
2021-08-10T16:09:25.357Z
2021-08-10T18:45:22.257Z
2021-08-10T18:45:22.257Z
Anti21
<p>Look into a workflow engine like <a href="https://argoproj.github.io/argo-workflows/" rel="nofollow noreferrer">Argo Workflows</a>.</p>
<p>I have seen similar setups. Consider all the steps required to onboard a new client as a workflow.</p>
<p>A workflow engine would then read this particular set of steps (a workflow-template) and performs the tasks as required (a run/workflow).</p>
<p>Since you mentioned going into k8s you might look into this or a non-k8s workflow engine as required. While the workflows itself might run on k8s containers, the steps can be for any environment.</p>
<p>I used Argo Workflows to setup the templates. A dedicated setup for the Devops/SRE teams should fit your use case perfectly. You can also automate other step-wise processes and deploy them too.</p>
<p>Advantages:-</p>
<ul>
<li><p>Argo Workflows provides a UI/CLI approach to trigger workflows.
Additionally it has a <a href="https://argoproj.github.io/argo-workflows/events/" rel="nofollow noreferrer">Events/Webhooks</a> support for triggering
workflows as well.</p>
</li>
<li><p>Support for multiple <a href="https://argoproj.github.io/argo-workflows/configure-artifact-repository/#configuring-your-artifact-repository" rel="nofollow noreferrer">artifact-repositories</a>, data sources to read/write your client configurations.</p>
</li>
<li><p>RBAC/SSO support which can help you permission your workflows and who can run them.</p>
</li>
<li><p>System where you can control the execution steps/environment and the user just has to provide the inputs to your workflows and have permissions to run the same. This reduced a lot of manual intervention and troubleshooting due to steps going wrong during each try and saved us a lot of time.</p>
</li>
<li><p>Logs are easily available along with the outputs of the workflows as artifacts.</p>
</li>
<li><p>Workflows can be versioned.The workflows are yaml files which can be versioned and released, hence maintained as code.</p>
</li>
<li><p>Workflows can be deployed using the CD tools of your choice.(ArgoCD).</p>
</li>
</ul>
<p>Disadvantages:-</p>
<ul>
<li>Maybe an overkill for just one workflow.Try deploying multiple templates.</li>
</ul>

CC BY-SA 4.0
2021-08-15T19:26:51.717Z
2021-08-15T19:26:51.717Z
rohatgisanat
<p>I don't know how to explain this problem better, but I'll try to explain it clearly:</p>
<ul>
<li>Where I work our customers are companies, with lots of users</li>
<li>We offer a SaaS solution for them to manage stuff</li>
<li>For every customer, there are around 50 right now, we create a vhost in one of our machines, a database in some of our database VMs and we configure the dotenv files for this application, potentially creating more VMs or database machines (nowadays this happens less frequently)</li>
<li>The SaaS allows us to configure the same application to serve multiple clients by doing a multi-tenant setup with multiple environment files</li>
</ul>
<p>The problem:
The whole process of creating vhost, configuring stuff, etc. is manual. We know how to automate this setup with ansible + terraform by creating application VMs and infrastructure for every customer or creating a HA environment with every application dotenv on a shared application, and we even have the option to migrate this to k8s. However, the most valuable thing to us would be to be able to add, to whichever solution we choose, extra customers based on API calls or some sort of automation.</p>
<p>If you're on k8s world, I think this would be equivalent to add a new ConfigMap to every customer based on some sort of automation, alongside deployments for these customers.</p>

<kubernetes><ansible><terraform><automation><distributed-systems>
Dynamic environments per client, which is the best approach, if any?
Leonardo Cavalcante
# Dynamic environments per client, which is the best approach, if any?

(Asked by: username_0 on 2021-08-10)

I don't know how to explain this problem better, but I'll try to explain it clearly:

* Where I work our customers are companies, with lots of users
* We offer a SaaS solution for them to manage stuff
* For every customer, there are around 50 right now, we create a vhost in one of our machines, a database in some of our database VMs and we configure the dotenv files for this application, potentially creating more VMs or database machines (nowadays this happens less frequently)
* The SaaS allows us to configure the same application to serve multiple clients by doing a multi-tenant setup with multiple environment files

The problem:
The whole process of creating vhost, configuring stuff, etc. is manual. We know how to automate this setup with ansible + terraform by creating application VMs and infrastructure for every customer or creating a HA environment with every application dotenv on a shared application, and we even have the option to migrate this to k8s. However, the most valuable thing to us would be to be able to add, to whichever solution we choose, extra customers based on API calls or some sort of automation.

If you're on k8s world, I think this would be equivalent to add a new ConfigMap to every customer based on some sort of automation, alongside deployments for these customers.

**Tags:** kubernetes, ansible, terraform, automation, distributed-systems


---

## 2 answers

### Answer by username_1 on 2021-08-10. Score: 1

From what I understood is that you want add deploy a configMap and a Deployment based on some API calls every time you need to add a new customer?

Basically you need a CD Pipeline that triggers a deployment based on new customer added. The trigger can be an API Call or a webhook from your software where you add a new customer. It should support sending an API call with details required in those ConfigMaps and Deployments. Now with the details of API Call you'd need to pass those parameters to a Values.yaml of Helm Chart which then goes and deploys to your selected cluster.

If you don't have a CD, you can use Azure Devops or ArgoCD. Both of these support trigger based on API Calls. Then setup the pipeline with connection to your cluster. In Azure Devops, you'd have to create a service connection and in ArgoCD register your cluster. Also, Helm Chart is the easiest way to deploy k8s manifests to it'd be preferable if you did it via that. ArgoCD would limit you to k8s only. You can go with Azure Devops for support for all. I'd have said Jenkins but managing that is a pain in the back. If that is not an issue you can try that too.

> **Comments:**
> **username_0**: Hi @username_1, Thank you for the answer!  We use gitlab as our CI/CD platform and the CD can be triggered via api calls, I think our biggest problem is about where can we store customer specific info and monolith config (shared and specific) so we can easily retrieve it during the CD process. I'm not sure it's possible to do that with ConfigMaps because I'm just starting with k8s. I've searched a bit and maybe a json in a git repo would solve the problem, or an entry in some config management database.  

---

### Answer by username_2 on 2021-08-15. Score: 0

Look into a workflow engine like [Argo Workflows](https://argoproj.github.io/argo-workflows/).

I have seen similar setups. Consider all the steps required to onboard a new client as a workflow.

A workflow engine would then read this particular set of steps (a workflow-template) and performs the tasks as required (a run/workflow).

Since you mentioned going into k8s you might look into this or a non-k8s workflow engine as required. While the workflows itself might run on k8s containers, the steps can be for any environment.

I used Argo Workflows to setup the templates. A dedicated setup for the Devops/SRE teams should fit your use case perfectly. You can also automate other step-wise processes and deploy them too.

Advantages:-

* Argo Workflows provides a UI/CLI approach to trigger workflows.
  Additionally it has a [Events/Webhooks](https://argoproj.github.io/argo-workflows/events/) support for triggering
  workflows as well.
* Support for multiple [artifact-repositories](https://argoproj.github.io/argo-workflows/configure-artifact-repository/#configuring-your-artifact-repository), data sources to read/write your client configurations.
* RBAC/SSO support which can help you permission your workflows and who can run them.
* System where you can control the execution steps/environment and the user just has to provide the inputs to your workflows and have permissions to run the same. This reduced a lot of manual intervention and troubleshooting due to steps going wrong during each try and saved us a lot of time.
* Logs are easily available along with the outputs of the workflows as artifacts.
* Workflows can be versioned.The workflows are yaml files which can be versioned and released, hence maintained as code.
* Workflows can be deployed using the CD tools of your choice.(ArgoCD).

Disadvantages:-

* Maybe an overkill for just one workflow.Try deploying multiple templates.


---

