Skip to content

Commit

Permalink
added check for if labels need to be propagated
Browse files Browse the repository at this point in the history
Signed-off-by: Arsh Sharma <[email protected]>
  • Loading branch information
RinkiyaKeDad committed Jan 28, 2025
1 parent 2d1a2f8 commit 26ba569
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/controller/instance/controller_reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,14 @@ func (igr *instanceGraphReconciler) handleResourceCreation(
) error {
igr.log.V(1).Info("Creating new resource", "resourceID", resourceID)

// Check if label propagation is enabled
annotations, found := igr.runtime.GetInstance().Object["metadata"].(map[string]interface{})["annotations"].(map[string]interface{})
if found {
if val, ok := annotations["kro.run/propagate-labels"]; ok && val == "true" {
igr.log.V(1).Info("Found propage labels annotation")
}
}

// Apply labels and create resource
igr.instanceSubResourcesLabeler.ApplyLabels(resource)
if _, err := rc.Create(ctx, resource, metav1.CreateOptions{}); err != nil {
Expand Down

0 comments on commit 26ba569

Please sign in to comment.