[281#1] feat(metadata): add shared metadata helpers and standardize ResourceMetadata inline#287
Closed
mpechkurov wants to merge 2 commits into
Closed
[281#1] feat(metadata): add shared metadata helpers and standardize ResourceMetadata inline#287mpechkurov wants to merge 2 commits into
mpechkurov wants to merge 2 commits into
Conversation
Add internal/clients/metadata package with helpers for managing Cloud
Foundry resource metadata (labels and annotations) across all providers:
- BuildMetadata: merges Crossplane default labels (GetExternalTags)
with user labels/annotations into *cfresource.Metadata; nil pointer
values produce CF deletion markers via RemoveLabel/RemoveAnnotation
- MetadataMapEqual: exact equality check (nil == empty, nil-ptr != ptr(""))
- MetadataMapContains: subset check (desired ⊆ actual); extra keys in
actual are ignored -- correct for merge-patch drift detection where
CF resources may have system labels the provider doesn't manage
- IsMetadataUpToDate: convenience wrapper using MetadataMapContains
for both labels and annotations
- DiffMetadata: computes merge-patch diff for Update calls; only
processes keys in desired (keys in actual but not desired are left
unchanged per CF API convention); includes nil-value deletion
markers; accepts both label and annotation pairs
These helpers will replace per-controller duplicate implementations
(e.g. SRB controller's metadataMapEqual/isMetadataUpToDate) and
provide the foundation for issue #39 external resource labeling.
Add shared metadata client helpers (BuildMetadata, IsMetadataUpToDate, DiffMetadata) for issue #39 external resource labeling support. Standardize all 8 eligible resource types to use ResourceMetadata inline struct consistently, replacing the mixed separate Labels/Annotations fields on Space, Org, Domain, and ServiceInstance. Update downstream consumers (client observation functions, domain GenerateUpdate, exporter convert files) accordingly.
Collaborator
|
Closing as #281 received review comments. |
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.
What
internal/clients/metadata/package withBuildMetadata,IsMetadataUpToDate,MetadataMapContains,MetadataMapEqual,DiffMetadataResourceMetadatainline struct (replacing separate Labels/Annotations fields on Domain, Org, Space, ServiceInstance)Why
Foundation for #39 (external resource labeling). Provides shared metadata helpers to replace per-controller duplicate implementations.
Part of
Split from #281 — PR 1 of 6. No dependencies.
Merge order: [281#1] → [281#2] → [281#3] → [281#4] → [281#5] → [281#6]