acorn-io / mongodb-atlas

0 stars 2 forks source link

Should error out when trying to deploy service with clusterName that already exits. #14

Closed sangee2004 closed 11 months ago

sangee2004 commented 11 months ago

Steps to reproduce the problem:

  1. Deploy Atlas Mongodb service (and consuming app) with cluster name mytest1 - acorn run . --clusterName test1
  2. Deploy Atlas Mongodb service (and consuming app) with same cluster name mytest1 - acorn run . --clusterName test1 This succeeds and the service get the same cluster that was created in step1.

Expected Behavior: Deploying Atlas Mongodb service with the same clusterName should fail since there is an existing DB cluster with the same name

lucj commented 11 months ago

Shouldn't this be the default behavior ? I mean if we run a service referencing an existing cluster that one should be used instead of creating a new one. What do you think ?

lucj commented 11 months ago

After a chat with @cloudnautique I understand is a use case which needs to be handle 👍

cloudnautique commented 11 months ago

The behavior has changed now, the following should now be true

  1. If you set the cluster name, the cluster must already exist in Atlas.
  2. If you set the cluster name to a cluster managed by another Acorn it will error.
  3. If you set the cluster name to a cluster that exists, but wasn't created by another Acorn it will be used.
cloudnautique commented 11 months ago

Additionally, launching 2 acorns with no clustername's set will result in 2 successfully deployed uniquely named clusters.

sangee2004 commented 11 months ago
  1. Deploy Service with clusterName that does not exist. Service fails to deploy with error - "cluster sangee doesn't exist in atlas, need to create cluster in Atlas first , 3 failed attempts"
  2. Deploy Service with clusterName that already exists and is managed by another acorn - "cluster hello1-acorn-sangee2004-77f38f72a693 exists, but provisioned by another Acorn" 3.Deploy Service with clusterName that already exists (and not managed by acorn) . Service deployment succeeds.