Skip to content

Fix error when provision DuoCore to User namespace

Problem

This is exposed by a provision failure https://gitlab.com/gitlab-org/customers-gitlab-com/-/issues/13073+

Reason

I think the error is due to provision DuoCore addon triggered validation error on Gitlab side, refer to comment and another comment

UserNamespace does not support base plan today. However, historically there were legacy UserNamespace which were already provisioned some paid base plan.

The UserNamespace was provisioned to `gold` plan in year 2020
 #<GitlabSubscriptions::SubscriptionHistory:0x00007f907063b688
  id: 132068,
  gitlab_subscription_created_at: Fri, 11 Oct 2019 17:46:22.800992000 UTC +00:00,
  gitlab_subscription_updated_at: Wed, 20 May 2020 23:25:47.927772000 UTC +00:00,
  start_date: Fri, 29 Nov 2019,
  end_date: nil,
  trial_ends_on: nil,
  namespace_id: 6275415,
  hosted_plan_id: 34,
  max_seats_used: 0,
  seats: 0,
  trial: false,
  change_type: "gitlab_subscription_updated",
  gitlab_subscription_id: 3677587,
  created_at: Mon, 08 Jun 2020 17:17:21.011802000 UTC +00:00,
  trial_starts_on: nil,
  auto_renew: true,
  trial_extension_type: nil,
  seats_in_use: nil>,
 #<GitlabSubscriptions::SubscriptionHistory:0x00007f907063b408
  id: 132088,
  gitlab_subscription_created_at: Fri, 11 Oct 2019 17:46:22.800992000 UTC +00:00,
  gitlab_subscription_updated_at: Mon, 08 Jun 2020 17:17:21.011252000 UTC +00:00,
  start_date: Mon, 08 Jun 2020,
  end_date: Wed, 08 Jul 2020,
  trial_ends_on: Wed, 08 Jul 2020,
  namespace_id: 6275415,
  hosted_plan_id: 4,
  max_seats_used: 0,
  seats: 0,
  trial: true,
  change_type: "gitlab_subscription_updated",
  gitlab_subscription_id: 3677587,
  created_at: Mon, 08 Jun 2020 18:00:18.600755000 UTC +00:00,
  trial_starts_on: Mon, 08 Jun 2020,
  auto_renew: nil,
  trial_extension_type: nil,
  seats_in_use: nil>,

[ gprd ] production> Plan.find(4)
=> #<Plan:0x00007f9070640de0 id: 4, created_at: Mon, 14 Aug 2017 21:50:57.313690000 UTC +00:00, updated_at: Mon, 14 Aug 2017 21:50:57.313690000 UTC +00:00, name: "gold", title: "[FILTERED]">

Later, the plan was changed to bronze, and then premium.

Today Usernamespace is allowed to purchase compute minutes. When such an UserNamespace(already on paid plan) purchase more ComputeMinutes, during the provision, it will generate provision params including:

  • base plan ☑️ It seems Gitlab does not raise error here. I guess it is ONLY CDot disallowed the purchase of paid plan on UserNamespace? 🤔
  • Duo core Here Gitlab raises error due to namespace validation failure
  • Compute minutes ComputeMinutes is provisioned correctly.

BTW: there is another place we think may trigger Gitlab side error: https://gitlab.com/gitlab-org/customers-gitlab-com/-/issues/13073#note_2520005440.

I think this is related to duo_nano_features_enabled setting where update! is being used. As it was a new Subscription, we want to update the duo core settings and provision Duo Core. However, the UserNamespace is invalid and not supported, so we should return that message back to CDot.

The fix are the same.

Proposal

After more discussion, we prefer an easier and quick solution for this issue: skip DuoCore provision in Gitlab AddOnPurchases::GitlabCom::ProvisionService

BTW: we have other issues to perform some validation for UserNamespace in CDot provision params generator, but those require more work. So we won't handle them in this issue:

Edited by Qingyu Zhao