Skip to content

Incorrect value for location in GKE for regional GKE clusters. #827

@gkevinzheng

Description

@gkevinzheng

See googleapis/google-cloud-go#9083

In google/cloud/logging_v2/handlers/_monitored_resources.py, we use the value of zone for the value of the location label in GKE:

zone = retrieve_metadata_server(_ZONE_ID)
cluster_name = retrieve_metadata_server(_GKE_CLUSTER_NAME)
project = retrieve_metadata_server(_PROJECT_NAME)
resource = Resource(
type="k8s_container",
labels={
"project_id": project if project else "",
"location": zone if zone else "",
"cluster_name": cluster_name if cluster_name else "",
},
)
return resource

This is incorrect for regional GKE clusters, because the value of location should be the region where it is deployed, and is inconsistent with the value of location for other logging statements.

Metadata

Metadata

Assignees

Labels

api: loggingIssues related to the googleapis/python-logging API.priority: p3Desirable enhancement or fix. May not be included in next release.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions