Skip to content

Conversation

@RinkiyaKeDad
Copy link
Member

This PR allows the user to propogate the labels they have set on the Resource Group Instance by using setting the kro.run/propagate-labels: "true" annotation.

Fixes #184

Sample RGI to try it out with:

apiVersion: kro.run/v1alpha1
kind: Something
metadata:
  name: my-something-instance
  annotations:
    kro.run/propagate-labels: "true"
  labels:
    this: works
spec:
  name: my-awesome-app
  ingress:
    enabled: false

Use the RG from the getting started guide with this.

@RinkiyaKeDad
Copy link
Member Author

@a-hilaly I wasn't able to figure out where to write the tests for this, can you please point me in the right direction?

Signed-off-by: Arsh Sharma <[email protected]>
@k8s-triage-robot
Copy link

Unknown CLA label state. Rechecking for CLA labels.

Send feedback to sig-contributor-experience at kubernetes/community.

/check-cla
/easycla

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Sep 12, 2025
Copy link
Member

@a-hilaly a-hilaly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @RinkiyaKeDad ! left a few minors below

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{})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
annotations, found := igr.runtime.GetInstance().Object["metadata"].(map[string]interface{})["annotations"].(map[string]interface{})
annotations := igr.runtime.GetInstance().GetAnnotations()


func (igr *instanceGraphReconciler) propagateLabelsToResource(resource *unstructured.Unstructured) {
// Get labels from the RGI
rgiLabels, found := igr.runtime.GetInstance().Object["metadata"].(map[string]interface{})["labels"].(map[string]interface{})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

propagate RGI labels to managed resources

4 participants