Skip to content
This repository has been archived by the owner on Feb 16, 2021. It is now read-only.

Added support for M2 and M5 #52

Merged
merged 5 commits into from
Aug 28, 2019

Conversation

mrgunior
Copy link
Contributor

@mrgunior mrgunior commented Aug 22, 2019

I currently hardcoded the TENANT provider in the catalog. This means users are able to see M2 and M5 plan sizes under TENANT in the marketplace. Apart from that just a simple check in instance_operations.go. Users are now able to create M2 or M5 clusters.

These are the only parameters users have access to for M2 and M5 clusters:

"providerSettings": {
   "providerName": "TENANT",
   "backingProviderName": "AWS",
   "instanceSizeName": "M2",
   "regionName": "EU_WEST_1"
}

The only 3 parameters that can be changed here are:

  • backingProviderName
  • regionName
  • instanceSizeName

Everything else are required to keep their current value as specified by the docs

@mrgunior mrgunior changed the title Added hardcoded templates for SHARED and a simply if check for them Added support for M2 and M5 Aug 22, 2019
@mrgunior mrgunior requested review from rodrigovalin and BenElgar and removed request for rodrigovalin August 22, 2019 10:36
Copy link
Contributor

@BenElgar BenElgar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I would rather use TENANT, to be consistent with the API.

What happens if someone specifies parameters that aren't included in those three?

pkg/broker/instance_operations.go Outdated Show resolved Hide resolved
pkg/broker/catalog.go Outdated Show resolved Hide resolved
pkg/broker/instance_operations.go Outdated Show resolved Hide resolved
pkg/broker/catalog.go Outdated Show resolved Hide resolved
pkg/broker/catalog.go Outdated Show resolved Hide resolved
@mrgunior
Copy link
Contributor Author

mrgunior commented Aug 22, 2019

I think I would rather use TENANT, to be consistent with the API.

What happens if someone specifies parameters that aren't included in those three?

M2 and M5 clusters are very strict.
you can't wiggle yourself out and just leave parameters out, the minimum are all required and work together. Leaving any of them out will just return a failure from atlas by default.

Error in most cases this:

{
    "description": "atlas error: [MISSING_ATTRIBUTE] The required attribute <the-parameter-you-forgot> was not specified."
}

or simply:

{
    "description": "atlas error: [INVALID_JSON_ATTRIBUTE] Received JSON for the providerSettings attribute does not match expected format."
}

pkg/broker/instance_operations.go Outdated Show resolved Hide resolved
pkg/broker/catalog.go Outdated Show resolved Hide resolved
@BenElgar
Copy link
Contributor

I'm still not clear on what happens if a user adds parameters that aren't applicable to a service instance. Say that a user applies the following service instance:

---
apiVersion: servicecatalog.k8s.io/v1beta1
kind: ServiceInstance
metadata:
  name: atlas-cluster-instance
spec:
  clusterServiceClassExternalName: mongodb-atlas-tenant
  clusterServicePlanExternalName: M2
  parameters:
    cluster:
      providerSettings:
        regionName: "EU_CENTRAL_1"
        diskTypeName: "P4"   # not applicable for the M2
        backupEnabled: true  # not applicable for the M2

Will they successfully provision a cluster that doesn't have those settings set? Will they get an error? If so, how will the error be displayed to the user? What happens if they specify a bad region?

@mrgunior
Copy link
Contributor Author

mrgunior commented Aug 23, 2019

We'll use your CRD for this realtime example

apiVersion: servicecatalog.k8s.io/v1beta1
kind: ServiceInstance
metadata:
  name: atlas-cluster-instance
spec:
  clusterServiceClassExternalName: mongodb-atlas-tenant
  clusterServicePlanExternalName: M2
  parameters:
    cluster:
      providerSettings:
        regionName: "EU_CENTRAL_1"
        diskTypeName: "P4"   # not applicable for the M2
        backupEnabled: true  # not applicable for the M2

No new provision get's created. Currently what the user sees when using kubernetes is simply:

  1. serviceinstance.servicecatalog.k8s.io/atlas-cluster-instance created, of course it really depends what parameter is missing or wrong. In these cases you'll see an error directly.
  2. when executing this kubectl get serviceinstances -n atlas we get the following under status:
    ProvisionRequestInFlight, afterwards OrphanMitigation, and then OrphanMitigationSuccessful.

Which basically means according to this link, To mitigate orphaned Service Instances and Service Bindings, the Platform SHOULD attempt to delete resources it cannot be sure were successfully created, and SHOULD keep trying to delete them until the Service Broker responds with a success.

Now for a correct provision with all of the correct values per parameter:

  1. We still get serviceinstance.servicecatalog.k8s.io/atlas-cluster-instance created
  2. But now, we get the following on status: Provisioning as expected. If we were to head to Atlas we can see it there being provisioned.

Now for the last question :

What happens if they specify a bad region?

I believe it might hang, but i'm not so certain. Will check this.
It fails.

@mrgunior mrgunior merged commit 64105e8 into master Aug 28, 2019
@mrgunior mrgunior deleted the CLOUDP-48055-Add-support-for-M2-and-M5-sizes branch August 28, 2019 10:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants