mongodb / mongodb-atlas-kubernetes

MongoDB Atlas Kubernetes Operator - Manage your MongoDB Atlas clusters from Kubernetes
http://www.mongodb.com/cloud/atlas
Apache License 2.0
149 stars 76 forks source link

Error when updating cluster autoscaling #126

Closed matheusca closed 3 years ago

matheusca commented 3 years ago

Hi!

I'm using mongodb-atlas-operator:0.3.0

When updating cluster autoscaling, I'm getting an error.

The first initial atlas cluster configuration was:

apiVersion: atlas.mongodb.com/v1
kind: AtlasCluster
metadata:
  annotations:
    app.aioros.io/revision: 32392083902832
  labels:
    app: chitauri-web-mongodb-platform
  name: service-name
  namespace: mongodb-atlas-system
spec:
  autoScaling:
    compute:
      enabled: true
      scaleDownEnabled: true
  clusterType: REPLICASET
  name: service-name
  projectRef:
    name: development
  providerBackupEnabled: true
  providerSettings:
    autoScaling:
      compute:
        maxInstanceSize: M40
        minInstanceSize: M30
    instanceSizeName: M30
    providerName: GCP
  replicationSpecs:
    - numShards: 1
      regionsConfig:
        EASTERN_US:
          analyticsNodes: 0
          electableNodes: 1
          priority: 6
          readOnlyNodes: 0
        SOUTH_AMERICA_EAST_1:
          analyticsNodes: 0
          electableNodes: 2
          priority: 7
          readOnlyNodes: 0
      zoneName: Zone 1

But when changing to:

apiVersion: atlas.mongodb.com/v1
kind: AtlasCluster
metadata:
  annotations:
    app.aioros.io/revision: 32392083902832
  labels:
    app: chitauri-web-mongodb-platform
  name: service-name
  namespace: mongodb-atlas-system
spec:
  autoScaling:
    compute:
      enabled: true
      scaleDownEnabled: true
  clusterType: REPLICASET
  name: service-name
  projectRef:
    name: development
  providerBackupEnabled: true
  providerSettings:
    autoScaling:
      compute:
        maxInstanceSize: M50
        minInstanceSize: M40
    instanceSizeName: M40
    providerName: GCP
  replicationSpecs:
    - numShards: 1
      regionsConfig:
        EASTERN_US:
          analyticsNodes: 0
          electableNodes: 1
          priority: 6
          readOnlyNodes: 0
        SOUTH_AMERICA_EAST_1:
          analyticsNodes: 0
          electableNodes: 2
          priority: 7
          readOnlyNodes: 0
      zoneName: Zone 1

I got this error in mongodb-atlas-operator:

2021-02-22T17:32:35.688Z        INFO    controllers.AtlasCluster        Status update   {"atlascluster": "mongodb-atlas-system/service-name", "lastCondition": {"type":"ClusterReady","status":"False","lastTransitionTime":null,"reason":"Clust
erNotUpdatedInAtlas","message":"PATCH https://cloud.mongodb.com/api/atlas/v1.0/groups/<my-group>/clusters/service-name: 400 (request \"INVALID_CLUSTER_CONFIGURATION\") The specified cluster configuration is not valid."}}

Note that I've updated providerSettings.autoScaling.maxInstanceSize, providerSettings.autoScaling.minInstanceSize and providerSettings.instanceSizeName.

Any thoughts? Thanks

antonlisovenko commented 3 years ago

Thanks for your detailed report @matheusca

A couple of questions:

matheusca commented 3 years ago

@antonlisovenko I've tried to using the same atlas API, passing just the parameters changed and it works.

I will try one parameter at a time and post here more information

antonlisovenko commented 3 years ago

thanks @matheusca , have created the internal ticket to track this issue

antonlisovenko commented 3 years ago

The issue should be fixed in the latest 0.4.0 release. Feel free to reopen the ticket if the problem still occurs