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

[Integration][GCP] Added an alternative for retrieving quota project id #997

Merged
merged 9 commits into from
Sep 9, 2024

Conversation

mk-armah
Copy link
Member

@mk-armah mk-armah commented Sep 6, 2024

Description

What
This PR fixes a bug related to fetching the GCP project ID from service account credentials. Previously, the function would fail to retrieve the correct project ID when the quota_project_id key was missing from the credentials file.

Why
GCP configuration differs based on how the credentials are generated. When using gcloud auth application-default login, the project ID is stored under the quota_project_id key. However, when a service account key is generated from the console, the project ID is stored under the project_id key. This discrepancy caused the integration to fail in identifying the project ID when the credentials were generated from the console, impacting quota computation operations.

This bug affected users by causing failures in environments where quota_project_id was not available. The fix ensures that both configurations are supported, making the application more robust and reliable in different environments.

How

  • Introduced a mechanism to check for both project_id and quota_project_id keys in the credentials file.
  • Improved error handling to raise meaningful exceptions when credentials are missing or incomplete.

Type of change

Please leave one option from the following and delete the rest:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • New Integration (non-breaking change which adds a new integration)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Non-breaking change (fix of existing functionality that will not change current behavior)
  • Documentation (added/updated documentation)

All tests should be run against the port production environment(using a testing org).

Integration testing checklist

  • Integration able to create all default resources from scratch
  • Resync able to create entities
  • Resync able to update entities
  • Resync able to detect and delete entities
  • Resync finishes successfully
  • If new resource kind is added or updated in the integration, add example raw data, mapping and expected result to the examples folder in the integration directory.
  • If resource kind is updated, run the integration with the example data and check if the expected result is achieved
  • If new resource kind is added or updated, validate that live-events for that resource are working as expected
  • Docs PR link here

@mk-armah mk-armah requested a review from a team as a code owner September 6, 2024 09:39
Copy link
Member

@matan84 matan84 left a comment

Choose a reason for hiding this comment

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

requested changes

integrations/gcp/gcp_core/utils.py Show resolved Hide resolved
integrations/gcp/gcp_core/utils.py Outdated Show resolved Hide resolved
integrations/gcp/gcp_core/utils.py Outdated Show resolved Hide resolved
@github-actions github-actions bot added size/S and removed size/XS labels Sep 9, 2024
Copy link
Member

@matan84 matan84 left a comment

Choose a reason for hiding this comment

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

LGTM

@matan84 matan84 merged commit 1869a3e into main Sep 9, 2024
16 checks passed
@matan84 matan84 deleted the improvement/gcp branch September 9, 2024 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants