(feat) Add referenced resource data as annotations #1439
Merged
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.
When Sveltos deploys a YAML/JSON (via PolicyRefs or KustomizationRefs) the information on referenced resources were added as labels. This had a downside: the name of the referenced resource cannot exceed 63 characters (that is the maximum length of a label value).
This PR move those data to annotations, removing that limitation.
This PR also introduces a tier concept for PolicyRefs/KustomizationRefs. The Tier field on a Sveltos PolicyRef/KustomizationRef introduces a secondary, intra-profile priority system. It is designed specifically to resolve resource conflicts that occur when multiple policy references within the same parent ClusterProfile or Profile attempt to deploy the identical Kubernetes resource.
This system works in two distinct steps:
This is the first and highest-level check.
Scenario: Two different ClusterProfile objects (Profile A and Profile B), both matching the same destination cluster, try to deploy the same resource (e.g., a ConfigMap named my-app-config).
Rule: The ClusterProfile with the lowest numerical Tier value wins. (Lower number = higher priority).
Example: If Profile A has Tier: 10 and Profile B has Tier: 50, Profile A wins and is the only one authorized to manage my-app-config.