Repository navigation
refactor(gcpcommon,caik8s): extract shared CAI task library to gcpcommon and refactor caik8s - #1011
Merged
Merged
Conversation
kyasbal
requested review from
K53,
RyuSA,
jyane,
kkuchima and
renamoo
as code owners
September 16, 2026 04:31
Contributor
There was a problem hiding this comment.
Code Review
This pull request refactors the Cloud Asset Inventory (CAI) pipeline by consolidating common fetching, log conversion, grouping, ingesting, and timeline mapping logic into a generic CAITaskSuite under gcpcommon. Specific implementations for Kubernetes cluster resources and GKE resources in caik8s are updated to use this new generic suite, significantly reducing code duplication. The review feedback correctly suggests retrieving the APIClientCallOptionsInjectorTaskID dependency using coretask.GetTaskResultOptional instead of coretask.GetTaskResult in cai_task_suite.go to maintain backwards-compatibility with lightweight unit test fixtures that do not mock the injector.
…mon and refactor caik8s Extract a shared Cloud Asset Inventory (CAI) task definition library layer into pkg/task/inspection/googlecloud/gcpcommon to consolidate duplicated pipeline code between Kubernetes cluster resources (k8s.io/*, apps.k8s.io/*) and GKE cluster/nodepool resources (container.googleapis.com/Cluster, NodePool): - Introduce CAITaskSuite, CAIFetcher, CAITimelineStagingStore, and generic CAI body extraction helpers in gcpcommon. - Refactor caik8s and caik8s/impl onto gcpcommon without backward compatibility shims or dead wrappers. - Unify resource identity helpers and task IDs (ClusterResourceTaskIDs, GKEResourceTaskIDs). - Enforce GKE cluster name validation on node pool identities and expand table-driven unit tests across gcpcommon and caik8s.
kyasbal
force-pushed
the
push-zppyovoyuytx
branch
from
September 16, 2026 05:28
d6c469d to
72b6f4a
Compare
Merged
via the queue into
GoogleCloudPlatform:main
with commit Sep 16, 2026
06fb618
17 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR extracts a shared Cloud Asset Inventory (CAI) task definition library layer into
pkg/task/inspection/googlecloud/gcpcommonand refactors the Kubernetes cluster resources (k8s.io/*,apps.k8s.io/*) and GKE cluster/nodepool resources (container.googleapis.com/Cluster,NodePool) pipelines inpkg/task/inspection/googlecloud/caik8sonto the shared layer.Key Changes
gcpcommon):CAITaskSuite,CAIFetcher,CAITimelineStagingStore, and generic CAI body extraction helpers (cai_types.go,cai_fetcher.go,cai_extractor.go,cai_timeline_staging.go,cai_task_suite.go).caik8s&caik8s/impl):gcpcommon.CAITaskSuitewithout retaining legacy shims, wrappers, or dead code.ClusterResourceTaskIDsandGKEResourceTaskIDs.identity_gke_resource.go), enforcing non-empty cluster names on node pool identities.gcpcommonandcaik8s/implcovering suite registration, active asset extraction, log ingestion, timeline mapping, error handling, and identity parsing.