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] [AWS] | Added support to choose specific regions to query resources from #1099

Merged
merged 30 commits into from
Nov 4, 2024

Conversation

mk-armah
Copy link
Member

@mk-armah mk-armah commented Oct 24, 2024

Description

What:

  • Added the option to query resources based on specific regions by introducing the regionPolicy in the selector field.
  • Introduced a new environment variable, maximumConcurrentAccount, to control the maximum number of concurrent accounts to sync.

Why:

  • To provide users the flexibility to specify which regions to query resources from, thereby reducing unnecessary calls for resources in regions the credentials don't have access to.
  • To improve performance by controlling the number of concurrent account syncs.

How:

  • Updated the selector field to support the regionPolicy for querying resources from specific regions.
  • Added logic to enforce the maximumConcurrentAccount variable, which limits the number of accounts synced concurrently.

Type of change

  • 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).

Core testing checklist

  • Integration able to create all default resources from scratch
  • Resync finishes successfully
  • Resync able to create entities
  • Resync able to update entities
  • Resync able to detect and delete entities
  • Scheduled resync able to abort existing resync and start a new one
  • Tested with at least 2 integrations from scratch
  • Tested with Kafka and Polling event listeners
  • Tested deletion of entities that don't pass the selector

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

Preflight checklist

  • Handled rate limiting
  • Handled pagination
  • Implemented the code in async
  • Support Multi account

Screenshots

Include screenshots from your environment showing how the resources of the integration will look.

API Documentation

Provide links to the API documentation used for this integration.

@mk-armah mk-armah requested a review from a team as a code owner October 24, 2024 18:06
Copy link
Contributor

@Tankilevitch Tankilevitch left a comment

Choose a reason for hiding this comment

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

Nice one!

@github-actions github-actions bot added size/L and removed size/M labels Oct 26, 2024
)
return fastapi.Response(status_code=status.HTTP_200_OK)
else:
logger.exception("Failed to describe resource")
Copy link
Contributor

Choose a reason for hiding this comment

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

which resource? add log containing more context about the resource, region etc.

@@ -46,16 +53,23 @@ def is_server_error(e: Exception) -> bool:


def get_matching_kinds_and_blueprints_from_config(
Copy link
Contributor

Choose a reason for hiding this comment

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

can we test it? with the new expected behavior?

Copy link
Contributor

@Tankilevitch Tankilevitch left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@Tankilevitch Tankilevitch left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines 232 to 234
logger.warning(
f"Skipping resyncing {kind} resource in region {region} in account {account_id}; {error.response['Error']['Message']}"
)
Copy link
Contributor

Choose a reason for hiding this comment

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

how the error will look like? if we know that its resource not found, can't we provide more accurate log? I also think that its a info rather than a warning

Copy link
Member Author

Choose a reason for hiding this comment

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

The error message has info about the identifier of the resource which can support debugging..

Copy link
Member Author

Choose a reason for hiding this comment

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

Skipping resyncing AWS::EC2::Instance resource in region eu-north-1 in account 213138413742; Resource of type 'AWS::EC2::Instance' with identifier 'i-0dfe65a174b846790' was not found

@Tankilevitch Tankilevitch merged commit bc4c19b into main Nov 4, 2024
18 checks passed
@Tankilevitch Tankilevitch deleted the improvement-aws branch November 4, 2024 19:46
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