feat: Add coordinates to Location spec - #328
Merged
Merged
Conversation
Location previously only carried a topology.datum.net/city-code value, with no latitude/longitude anywhere on the resource. Consumers that want to plot a location on a map (e.g. the compute portal plugin's instance locations view) had no way to do that without a hand-maintained city-code lookup table. Add an optional spec.coordinates field with latitude/longitude. Both are serialized as strings rather than floats, per Kubernetes API convention, with a regex pattern plus a CEL range rule (double(self) within [-90, 90] / [-180, 180]) enforced at the apiserver. Key changes: - Add Coordinates type and LocationSpec.Coordinates field - Regenerate CRD manifests, deepcopy, and API docs - Add envtest coverage for the happy path, the optional-field case, and both CEL/pattern rejections Fixes #327
savme
approved these changes
Jul 30, 2026
mattdjenkinson
approved these changes
Jul 30, 2026
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
A
Locationonly carries atopology.datum.net/city-codevalue — there's no latitude/longitude anywhere on the resource, so any UI that wants to plot a location on a map (e.g. the compute portal plugin's instance locations view) has to maintain its own hand-rolled city-code → coordinates lookup table.This adds an optional
spec.coordinatesfield withlatitude/longitude. Both are strings rather than floats — controller-gen flags float fields as discouraged, matching the broader Kubernetes API convention against them — validated with a regex pattern plus a CEL rule enforcing the real range ([-90, 90] for latitude, [-180, 180] for longitude) at the apiserver.The field is optional and additive, so existing Locations without coordinates are unaffected.
Test plan
make manifests generate api-docs— CRD schema, deepcopy, and API docs regeneratedmake lint— cleanmake test— full suite passes, including new envtest coverage:Fixes #327