(feat) Add referenced resource data as annotations#566
Merged
gianlucam76 merged 1 commit intoprojectsveltos:release-1.1from Oct 10, 2025
Merged
(feat) Add referenced resource data as annotations#566gianlucam76 merged 1 commit intoprojectsveltos:release-1.1from
gianlucam76 merged 1 commit intoprojectsveltos:release-1.1from
Conversation
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: 1. Primary Conflict Resolution (ClusterProfile Tier) 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. 2. Secondary Conflict Resolution (PolicyRef Tier) This is the second-level check, which only happens after a single ClusterProfile has won the primary conflict. Scenario: One winning ClusterProfile references multiple sources (e.g., PolicyRef 1 pointing to ConfigMap 1, and PolicyRef 2 pointing to ConfigMap 2). Both ConfigMaps contain the same resource (e.g., a Deployment named my-deployment). Rule: The PolicyRef within the winning ClusterProfile with the lowest numerical Tier value wins and is authorized to deploy/override the resource. Example: If PolicyRef 1 has Tier: 50 and PolicyRef 2 has Tier: 10 (and both are in the same winning ClusterProfile), PolicyRef 2 wins, allowing ConfigMap 2 to overwrite the Deployment deployed by ConfigMap 1. Default/Tie-Breaker: If the PolicyRef Tiers are identical, the standard Sveltos order of processing (typically the order of declaration in the list) determines the winner, or a conflict is reported if both try to deploy a new resource simultaneously.
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.
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.
This is the second-level check, which only happens after a single ClusterProfile has won the primary conflict.
Scenario: One winning ClusterProfile references multiple sources (e.g., PolicyRef 1 pointing to ConfigMap 1, and PolicyRef 2 pointing to ConfigMap 2). Both ConfigMaps contain the same resource (e.g., a Deployment named my-deployment).
Rule: The PolicyRef within the winning ClusterProfile with the lowest numerical Tier value wins and is authorized to deploy/override the resource.
Example: If PolicyRef 1 has Tier: 50 and PolicyRef 2 has Tier: 10 (and both are in the same winning ClusterProfile), PolicyRef 2 wins, allowing ConfigMap 2 to overwrite the Deployment deployed by ConfigMap 1.
Default/Tie-Breaker: If the PolicyRef Tiers are identical, the standard Sveltos order of processing (typically the order of declaration in the list) determines the winner, or a conflict is reported if both try to deploy a new resource simultaneously.