Skip to content

BigQueryConnectionConnection resourceID requires UUID format but the API does not #3140

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

Closed
3 tasks done
dionborsboom opened this issue Nov 8, 2024 · 2 comments · Fixed by #3153
Closed
3 tasks done
Labels
bug Something isn't working

Comments

@dionborsboom
Copy link

Checklist

Bug Description

Resource: BigQueryConnectionConnection
CRD: bigqueryconnection.cnrm.cloud.google.com/v1alpha1

The spec.resourceID field must be in UUID format. When applying a value that does not have a UUID field the resource will end up in UpdateFailed state with the following message: Update call failed: spec.resourceID should be in a UUID format, got manual-connection

Im not sure why the spec.resourceID must be in UUID format. According to the CRD, the resourceID maps to the connectionId in the API:

resourceID:
  description: The BigQuery ConnectionID. This is a server-generated
    ID in the UUID format. If not provided, ConfigConnector will create
    a new Connection and store the UUID in `status.serviceGeneratedID`
    field.
  type: string

Looking at the Bigquery Connection API, the connectionId does not require UUID format: https://cloud.google.com/bigquery/docs/reference/bigqueryconnection/rest/v1/projects.locations.connections/create

Looking at the API response from a manually created bigquery connection, UUID format is not required:

bq mk --connection --location=EU --project_id=myproject \
    --connection_type=CLOUD_RESOURCE manual-connection
Connection _projectnumber_.eu.manual-connection successfully created
bq show --connection my-project.EU.manual-connection

                name                 friendlyName   description    Last modified         type        hasCredential                                            properties                                           
 ---------------------------------- -------------- ------------- ----------------- ---------------- --------------- ---------------------------------------------------------------------------------------------- 
  _projectnumber_.eu.manual-connection                                08 Nov 15:08:39   CLOUD_RESOURCE   False           {"serviceAccountId": "bqcx-_projectnumber_-m5sk@gcp-sa-bigquery-condel.iam.gserviceaccount.com"}

This prevents the acquisition of existing Bigquery Connections being managed by config connector.

Additional Diagnostic Information

none

Kubernetes Cluster Version

v1.30.3-gke.1969001

Config Connector Version

1.123.1

Config Connector Mode

namespaced mode (default)

Log Output

No response

Steps to reproduce the issue

Create a bigquery connection manually:

bq mk --connection --location=EU --project_id=my-project \
    --connection_type=CLOUD_RESOURCE manual-connection

Apply the YAML below to acquire management of this resource

YAML snippets

---
apiVersion: bigqueryconnection.cnrm.cloud.google.com/v1alpha1
kind: BigQueryConnectionConnection
metadata:
  name: manual
spec:
  resourceID: manual-connection
  location: EU
  friendlyName: manual-connection
  cloudResource: {}
@dionborsboom dionborsboom added the bug Something isn't working label Nov 8, 2024
@jingyih
Copy link
Collaborator

jingyih commented Nov 8, 2024

Yes, it looks like the API accepts a user-provided connection ID. If not provided, the API will generate a UUID.

Thank you for reporting this bug!

@yuwenma
Copy link
Collaborator

yuwenma commented Nov 11, 2024

Thank you for reporting, @dionborsboom. You are right, the v1alpha1 BQCC does not support the acquiring use for a non-UUID connection ID ( the UUID check is for the default behavior where the BigQuery GCP server assigns a UUID to the connection object as connection ID if the user does not specify one).

We're adding support for user-specified Connection IDs in upcoming releases. We're aiming 1.125 (where the BQCC resource is planned to promote to Beta), or 1.126 at the latest. Thanks again for the report—it's really helpful!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants