Skip to content
This repository was archived by the owner on May 6, 2026. It is now read-only.
This repository was archived by the owner on May 6, 2026. It is now read-only.

Expose Network Topology as attributes #98

@aojea

Description

@aojea

In GKE this is also exposed on the node labels https://cloud.google.com/ai-hypercomputer/docs/workloads/schedule-gke-workloads-tas#understand-physical-topology

   cloud.google.com/gce-topology-block: 6b1ddbbd41cf397b9bcd1086091914e7
    cloud.google.com/gce-topology-host: b881b33e5fd8128f2e8b3ad50506ee87
    cloud.google.com/gce-topology-subblock: 88fba4b895a44590c026f7c1bf4c1695

This can be obtained via the metdata and is represented in the following format

VM-Position

RESOURCE_POLICIES: us-central1/resourcePolicies/example-policy']
PHYSICAL_HOST: /CCCCCCC/BBBBBB/AAAA

That IIRC https://cloud.google.com/ai-hypercomputer/docs/workloads/schedule-gke-workloads-tas#understand-physical-topology

block: CCCCCCC
subblock: BBBBBB
host: AAAA

https://cloud.google.com/compute/docs/instances/use-compact-placement-policies#verify-vm-location

The implementation is just to enhance the existing function

// GetGCEAttributes fetches all attributes related to the provided GCP network.
func GetGCEAttributes(network string) map[resourceapi.QualifiedName]resourceapi.DeviceAttribute {
attributes := make(map[resourceapi.QualifiedName]resourceapi.DeviceAttribute)
var projectNumber int64
var name string
// Use custom parsing because the network path is
// different from the format expected by k8s-cloud-provider
_, err := fmt.Sscanf(network, "projects/%d/networks/%s", &projectNumber, &name)
if err != nil {
klog.Warningf("Error parsing network %q : %v", network, err)
return nil
}
attributes["gce.dra.net/networkName"] = resourceapi.DeviceAttribute{StringValue: &name}
attributes["gce.dra.net/networkProjectNumber"] = resourceapi.DeviceAttribute{IntValue: &projectNumber}
return attributes
}

Bonus to create an example in the documentation of using dranet with Kueue https://cloud.google.com/ai-hypercomputer/docs/workloads/schedule-gke-workloads-tas#use-podgroup

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions