Skip to content

Feat/support alibabacloud#60

Merged
tianmu2023 merged 20 commits intoantgroup:mainfrom
j3ttt:feat/support-alibabacloud
Aug 4, 2025
Merged

Feat/support alibabacloud#60
tianmu2023 merged 20 commits intoantgroup:mainfrom
j3ttt:feat/support-alibabacloud

Conversation

@j3ttt
Copy link
Collaborator

@j3ttt j3ttt commented Aug 4, 2025

Thank you for your contribution to CloudRec!

What About:

  • Server (java)
  • Collector (go)
  • Rule (opa)

Description:

Implement 3 new ALiCLoud resource collectors:

  • ACS::DTS::Instance
  • ACS::ECI::ContainerGroup
  • ACS::ECI::ImageCache

Summary by Sourcery

Add support for new Alibaba Cloud resource collectors and enhance Alibabacloud service initialization

New Features:

  • Add DTS Instance collector to fetch migration jobs and details
  • Add ECI ContainerGroup collector to fetch container group details
  • Add ECI ImageCache collector to fetch image cache details

Enhancements:

  • Register DTS and ECI clients and resource types in services, constants, and platform configuration
  • Refactor ACK cluster collector to include associated resources via describeClusterResources

Chores:

  • Capitalize Huawei Cloud Collector agent name in deployment configuration

@gemini-code-assist
Copy link
Contributor

Important

Installation incomplete: to start using Gemini Code Assist, please ask the organization owner(s) to visit the Gemini Code Assist Admin Console and sign the Terms of Services.

@sourcery-ai
Copy link

sourcery-ai bot commented Aug 4, 2025

Reviewer's Guide

This PR adds support for Alibaba Cloud by introducing new collectors for DTS instances, ECI container groups, and ECI image caches; initializes DTS, ECI, and Eflo service clients; enhances the ACK cluster collector to include associated resources; and updates platform configuration, constants, and minor configuration fixes.

ER diagram for new Alibaba Cloud resource types

erDiagram
    DTS_INSTANCE ||--o{ DTSInstanceDetail : has
    ECI_CONTAINER_GROUP ||--o{ ECIContainerGroupDetail : has
    ECI_IMAGE_CACHE ||--o{ ECIImageCacheDetail : has

    DTSInstanceDetail {
        string MigrationJobID
        string MigrationJobName
    }
    ECIContainerGroupDetail {
        string ContainerGroupId
        string ContainerGroupName
    }
    ECIImageCacheDetail {
        string ImageCacheId
        string ImageCacheName
    }
Loading

Class diagram for new Alibaba Cloud resource collectors (DTS, ECI)

classDiagram
    class Services {
        +DTS: dts.Client
        +ECI: eci.Client
        +Eflo: eflo.Client
    }
    class DTSInstanceDetail {
        +MigrationJob: dts.MigrationJob
        +MigrationJobDetail: dts.DescribeMigrationJobDetailResponse
    }
    class ECIContainerGroupDetail {
        +ContainerGroup: eci.DescribeContainerGroupsContainerGroup0
    }
    class ECIImageCacheDetail {
        +ImageCache: eci.DescribeImageCachesImageCache0
    }
    Services --> "1" dts.Client : uses
    Services --> "1" eci.Client : uses
    Services --> "1" eflo.Client : uses
    DTSInstanceDetail --> dts.MigrationJob
    DTSInstanceDetail --> dts.DescribeMigrationJobDetailResponse
    ECIContainerGroupDetail --> eci.DescribeContainerGroupsContainerGroup0
    ECIImageCacheDetail --> eci.DescribeImageCachesImageCache0
Loading

Class diagram for enhanced ACK cluster detail collection

classDiagram
    class Detail {
        +Cluster: cs20151215.DescribeClustersV1ResponseBodyClusters
        +AssociatedResource: cs20151215.DescribeClusterResourcesResponseBody[]
    }
    Detail --> cs20151215.DescribeClustersV1ResponseBodyClusters
    Detail --> cs20151215.DescribeClusterResourcesResponseBody
Loading

File-Level Changes

Change Details Files
Add new Alibaba Cloud DTS and ECI resource collectors
  • Created DTS instance collector with detail fetch logic
  • Created ECI container group and image cache collectors
  • Registered new resources in platform configuration
  • Defined corresponding resource constants
collector/alicloud/collector/dts/instance.go
collector/alicloud/collector/eci/container_group.go
collector/alicloud/collector/eci/image_cache.go
collector/alicloud/platform/platform_config.go
collector/alicloud/collector/constant.go
Initialize DTS, ECI, and Eflo service clients
  • Imported dts and eci SDK packages
  • Added DTS, ECI, and Eflo fields to Services struct
  • Initialized clients in InitServices based on resource types
collector/alicloud/collector/services.go
Enhance ACK cluster detail collection to include associated resources
  • Extended Detail struct to include AssociatedResource field
  • Implemented describeClusterResources helper
  • Updated GetClusterDetail to fetch and attach associated resources
collector/alicloud/collector/ack/cluster.go
Fix Huawei Cloud collector agent name capitalization
  • Updated AgentName value for consistency
collector/hws/deploy_hws/config.yaml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @j3ttt - I've reviewed your changes - here's some feedback:

  • The new DTS and ECI collectors list resources via Describe* calls without pagination support, so they may miss additional pages; consider implementing paging logic to fetch all results.
  • You’ve added Eflo client fields, imports, and constants but left its initialization commented out and no collectors implemented; either fully implement Eflo support or remove these placeholders to avoid confusion and potential runtime errors.
  • The added constants for resource types contain spaces (e.g., "DTS Instance"), which may be inconsistent with other identifiers and complicate lookups—consider aligning naming conventions with existing resource keys.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The new DTS and ECI collectors list resources via Describe* calls without pagination support, so they may miss additional pages; consider implementing paging logic to fetch all results.
- You’ve added Eflo client fields, imports, and constants but left its initialization commented out and no collectors implemented; either fully implement Eflo support or remove these placeholders to avoid confusion and potential runtime errors.
- The added constants for resource types contain spaces (e.g., "DTS Instance"), which may be inconsistent with other identifiers and complicate lookups—consider aligning naming conventions with existing resource keys.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@j3ttt
Copy link
Collaborator Author

j3ttt commented Aug 4, 2025

The new DTS and ECI collectors list resources via Describe* calls without pagination support

@j3ttt j3ttt marked this pull request as draft August 4, 2025 07:07
@j3ttt j3ttt marked this pull request as ready for review August 4, 2025 09:30
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @j3ttt - I've reviewed your changes - here's some feedback:

  • In InitServices, group and deduplicate the DTS and ECI client initializations so each client is initialized only once instead of in separate cases.
  • Standardize resource type names (e.g., “ECI ContainerGroup”, “ECI ImageCache”) to ensure consistent spacing and casing across all collectors.
  • Extract the repetitive pagination and error-handling loops in the DTS, ECI, and ACK collectors into a shared helper to reduce boilerplate and improve maintainability.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In InitServices, group and deduplicate the DTS and ECI client initializations so each client is initialized only once instead of in separate cases.
- Standardize resource type names (e.g., “ECI ContainerGroup”, “ECI ImageCache”) to ensure consistent spacing and casing across all collectors.
- Extract the repetitive pagination and error-handling loops in the DTS, ECI, and ACK collectors into a shared helper to reduce boilerplate and improve maintainability.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@j3ttt j3ttt requested a review from tianmu2023 August 4, 2025 09:39
@tianmu2023 tianmu2023 merged commit 1dd3f74 into antgroup:main Aug 4, 2025
1 check passed
@gemini-code-assist
Copy link
Contributor

Important

Installation incomplete: to start using Gemini Code Assist, please ask the organization owner(s) to visit the Gemini Code Assist Admin Console and sign the Terms of Services.

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