Skip to content

feat(inspection): add NodeNameDiscoveryTask for k8snode and k8scontainer log parsers - #860

Merged
kyasbal merged 1 commit into
GoogleCloudPlatform:mainfrom
kyasbal:push-lrwyltyrunqs
Aug 4, 2026
Merged

feat(inspection): add NodeNameDiscoveryTask for k8snode and k8scontainer log parsers#860
kyasbal merged 1 commit into
GoogleCloudPlatform:mainfrom
kyasbal:push-lrwyltyrunqs

Conversation

@kyasbal

@kyasbal kyasbal commented Aug 3, 2026

Copy link
Copy Markdown
Member

Summary

Compute Engine API log parser (googlecloudlogcomputeapiaudit) and Serial Port log parser (googlecloudlogserialport) depend on the node name inventory (NodeNameInventoryTask) to query logs for relevant nodes/instances.

Previously, only Kubernetes audit logs (commonlogk8saudit_impl.NodeNameDiscoveryTask) were capable of discovering node names. This PR adds new NodeNameDiscoveryTask implementations to googlecloudlogk8snode and googlecloudlogk8scontainer so that node names can also be discovered from Node logs and Container log labels, ensuring complete node name coverage even when audit logs are absent.

Key Changes

  • pkg/task/inspection/googlecloudlogk8snode:
    • Defined NodeNameDiscoveryTaskID and implemented NodeNameDiscoveryTask to extract node names from K8sNodeLogCommonFieldSet.NodeName.
    • Added NodeNameDiscoveryTaskID.Ref() to TailTask dependencies to ensure the discovery task is automatically included in the inspection DAG when node logs are inspected.
    • Added unit tests (nodename_discovery_task_test.go).
  • pkg/task/inspection/googlecloudlogk8scontainer:
    • Defined NodeNameDiscoveryTaskID and implemented NodeNameDiscoveryTask to extract node names from GCPContainerLogNodeNameLabelFieldSet.NodeName (labels."compute.googleapis.com/resource_name").
    • Added NodeNameDiscoveryTaskID.Ref() to TailTask dependencies to ensure the discovery task is automatically included in the inspection DAG when container logs are inspected.
    • Added unit tests (nodename_discovery_task_test.go).
  • pkg/task/inspection/googlecloudlogcomputeapiaudit & googlecloudlogserialport:
    • Updated dry-run query placeholder comments from -- instance name filters to be determined after audit log query to -- instance name filters to be determined after node name discovery.

Verification

  • Added unit tests for new NodeNameDiscoveryTask implementations:
    • go test ./pkg/task/inspection/googlecloudlogk8snode/impl -run TestNodeNameDiscoveryTask -> PASS
    • go test ./pkg/task/inspection/googlecloudlogk8scontainer/impl -run TestNodeNameDiscoveryTask -> PASS
  • Verified dry-run query generation tests:
    • go test ./pkg/task/inspection/googlecloudlogcomputeapiaudit/impl -run TestGenerateComputeAPIQuery -> PASS
    • go test ./pkg/task/inspection/googlecloudlogserialport/impl -run TestGenerateSerialPortQuery -> PASS
  • Ran full backend regression tests and style checks:
    • make build-go -> PASS
    • make test-go -> PASS
    • make pre-commit -> PASS (no linter/formatting issues)

…ner log parsers

- Add NodeNameDiscoveryTask for googlecloudlogk8snode to discover node names from K8sNodeLogCommonFieldSet.NodeName
- Add NodeNameDiscoveryTask for googlecloudlogk8scontainer to discover node names from GCPContainerLogNodeNameLabelFieldSet.NodeName
- Register NodeNameDiscoveryTask to each TailTask dependencies to include them in the inspection task graph
- Update dry-run query placeholder comments in googlecloudlogcomputeapiaudit and googlecloudlogserialport
@kyasbal kyasbal added bug Something isn't working enhancement New feature or request labels Aug 3, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces node name discovery tasks for both Kubernetes container logs and node logs to extract node names and register them to the node name inventory. It also updates the query generation logic for Compute API and Serial Port logs to indicate that instance name filters are determined after node name discovery. I have no feedback to provide as there are no review comments.

@kyasbal
kyasbal marked this pull request as ready for review August 4, 2026 05:43
@kyasbal
kyasbal merged commit d2eb111 into GoogleCloudPlatform:main Aug 4, 2026
16 checks passed
@kyasbal
kyasbal deleted the push-lrwyltyrunqs branch August 4, 2026 05:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant