Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merges the contents of the long running cloud-20 branch into main #238

Merged
merged 11 commits into from
Sep 19, 2024

Conversation

fantapop
Copy link
Collaborator

@fantapop fantapop commented Sep 18, 2024

This branch contains all of the cloud 2.0 commits which we'll now merge back into main. Updating to the latest SDK also caused a merge conflict due to the list minute decision to rename provisioned_vcpus to provisioned_virtual_cpus. That change was rebased into each of the commits in this list.

Additionally there is a commit on top to tag the provider release to 1.8.0.

Commit checklist

  • Changelog
  • Doc gen (make generate)
  • Integration test(s)
  • Acceptance test(s)
  • Example(s)

Copy link
Contributor

@andy-kimball andy-kimball left a comment

Choose a reason for hiding this comment

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

LGTM

@fantapop fantapop changed the title Cloud 2.0 Changes applied to latest SDK Merges the contents of the long running cloud-20 branch into main Sep 18, 2024
fantapop and others added 11 commits September 18, 2024 22:32
This update includes all the cloud 2.0 changes.
Use new plan types. Remove support for spend limits. Add support for
provisioned clusters. Adjust to use *int64 for usage limit fields rather
than int64.
Previously, the TF provider raised an error when the primary attribute was
specified in multiple regions, even when false in all but one region, e.g.:

  regions = [
    {
      name    = "eu-west-1"
      primary = true
    },
    {
      name    = "eu-west2"
      primary = false
    },
    {
      name    = "ap-south-1"
      primary = false
    },
  ]

This PR fixes that by adding some custom validation logic rather than using
the built-in config validators.

Fixes: CC-27160
Make the "plan" attribute on the "cluster" resource writable so that it
can be set by users who intend to upgrade/downgrade the plan. Keep the
attribute as computed so that the system will set the value if it is not
provided by the user.

Release note: Support upgrade of plans via changes to the "plan" attribute
on the "cluster" resource.
Rename the `provisioned_capacity` field to `provisioned_virtual_cpus`
and update all tests and examples to use the vCPUs unit rather than
request units by dividing by 500. This is part of the overall migration
to vCPUs for Cloud 2.0.
Add tests for downgrading from the STANDARD plan to the BASIC plan.
Previously, the Plan field was not passed to the CreateCluster API, even if
it was explicitly set by the user. This prevented the server from validating
the cluster configuration. For example, the server was not able to return
an error when Plan=BASIC and provisioned_virtual_cpus are set. The fix
is to pass the Plan field to CreateCluster if the user explicitly sets
it.
upgrade_type is now added for BASIC and STANDARD clusters.  It can be
used to dictate how the cluster handles major version upgrades.  Valid
values for upgrade_type are AUTOMATIC and MANUAL.  BASIC clusters
support only AUTOMATIC upgrades.
@fantapop
Copy link
Collaborator Author

There were 2 errors during the acceptance test runs. Both of which seem unrelated to this branch so I'm going to merge it down. It has now been rebased to use the tagged version of the cockroach-cloud-sdk-go (v3.0.0)

For posterity, the errors were:

*pgconn.PgError: failed to create user cockroach-user for cluster with ID 5926ca44-7340-49c8-82a2-ba4440e0cca1: retrying txn failed after 50 attempts. original error: ERROR: restart transaction: TransactionRetryWithProtoRefreshError: TransactionRetryError: retry txn (RETRY_SERIALIZABLE - failed preemptive refresh due to conflicting locks on /Tenant/1765/Table/4/2/202/0 [reason=wait_policy] - conflicting txn: meta={id=6e2e06e2 key=/Tenant/1765/Table/4/1/"cockroach-user-nopass"/0 iso=Serializable pri=0.11642794 epo=0 ts=1726709564.316920842,2 min=1726709563.656286716,0 seq=4}): "sql txn" meta={id=b01df34e key=/Tenant/1765/Table/4/1/"cockroach-user"/0 iso=Serializable pri=0.11642799 epo=42 ts=1726709564.353887001,2 min=1726709501.481762885,0 seq=51} lock=true stat=PENDING rts=1726709562.962337882,0 wto=false gul=1726709501.731762885,0 isn=1 (SQLSTATE 40001).

and

=== NAME TestAccMetricExportPrometheusConfigResource
metric_export_prometheus_config_resource_test.go:115: Error running post-test destroy, there may be dangling resources: exit status 1

    Error: Error deleting cluster
    
    Could not delete cluster: cannot delete locked cluster

@fantapop fantapop merged commit 2ed50d3 into main Sep 19, 2024
4 checks passed
@fantapop fantapop deleted the fantapop/cloud-20 branch September 19, 2024 05:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants