Skip to content

Conversation

barney-s
Copy link
Contributor

Related PR that triggered this doc: #631

@barney-s barney-s requested review from matthchr and a-hilaly August 19, 2025 16:13
@barney-s barney-s mentioned this pull request Aug 19, 2025
Copy link
Contributor

@jakobmoellerdev jakobmoellerdev left a comment

Choose a reason for hiding this comment

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

Mostly LGTM. Just thinking we should really start unifying everything and not keep the old labels.

Copy link
Contributor

@fabianburth fabianburth left a comment

Choose a reason for hiding this comment

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

Looks good!

@barney-s barney-s added this to the 0.5 milestone Aug 20, 2025
barney-s added a commit to barney-s/kro that referenced this pull request Aug 21, 2025
- Based on proposal: kubernetes-sigs#639
- Move to new labels and remove old labels
- Add new testcase for nested RGD and update existing testcase labels
- Have separate instance labellers for different reconcile paths.
  This is needed when we have RGD2 instance in RGD1 resources.
  Today both paths use the same label resulting in conflict.
  path 1: RGD2.instance created as part of an RGD1 instance reconciliation
  path 2: RGD2.instance reconciled by RGD2 reconciler
barney-s added a commit to barney-s/kro that referenced this pull request Aug 21, 2025
- Based on proposal: kubernetes-sigs#639
- Move to new labels and remove old labels
- Add new testcase for nested RGD and update existing testcase labels
- Have separate instance labellers for different reconcile paths.
  This is needed when we have RGD2 instance in RGD1 resources.
  Today both paths use the same label resulting in conflict.
  path 1: RGD2.instance created as part of an RGD1 instance reconciliation
  path 2: RGD2.instance reconciled by RGD2 reconciler
barney-s added a commit to barney-s/kro that referenced this pull request Aug 21, 2025
- Based on proposal: kubernetes-sigs#639
- Move to new labels
- Add deprecate TODO for old labels
- Add new testcase for nested RGD and update existing testcase labels
- Have separate instance labellers for different reconcile paths.
  This is needed when we have RGD2 instance in RGD1 resources.
  Today both paths use the same label resulting in conflict.
  path 1: RGD2.instance created as part of an RGD1 instance reconciliation
  path 2: RGD2.instance reconciled by RGD2 reconciler
barney-s added a commit to barney-s/kro that referenced this pull request Aug 21, 2025
- Based on proposal: kubernetes-sigs#639
- Move to new labels
- Add deprecate TODO for old labels
- Add new testcase for nested RGD and update existing testcase labels
- Have separate instance labellers for different reconcile paths.
  This is needed when we have RGD2 instance in RGD1 resources.
  Today both paths use the same label resulting in conflict.
  path 1: RGD2.instance created as part of an RGD1 instance reconciliation
  path 2: RGD2.instance reconciled by RGD2 reconciler
barney-s added a commit to barney-s/kro that referenced this pull request Aug 21, 2025
- Based on proposal: kubernetes-sigs#639
- Move to new labels
- Add deprecate TODO for old labels
- Add new testcase for nested RGD and update existing testcase labels
- Have separate instance labellers for different reconcile paths.
  This is needed when we have RGD2 instance in RGD1 resources.
  Today both paths use the same label resulting in conflict.
  path 1: RGD2.instance created as part of an RGD1 instance reconciliation
  path 2: RGD2.instance reconciled by RGD2 reconciler
barney-s added a commit to barney-s/kro that referenced this pull request Aug 25, 2025
- Based on proposal: kubernetes-sigs#639
- Move to new labels
- Add deprecate TODO for old labels
- Add new testcase for nested RGD and update existing testcase labels
- Add docs
- Have separate instance labellers for different reconcile paths.
  This is needed when we have RGD2 instance in RGD1 resources.
  Today both paths use the same label resulting in conflict.
  path 1: RGD2.instance created as part of an RGD1 instance reconciliation
  path 2: RGD2.instance reconciled by RGD2 reconciler
- `kro.run/reconciled-by-rgd`
- **Value:** The name of the ResourceGraphDefinition (e.g., `my-rgd-name`).
- **Purpose:** To indicate that an instance is being actively reconciled against a specific RGD. This label will be applied to the instance itself.
- **Alternative Names:**
Copy link
Contributor

Choose a reason for hiding this comment

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

are these alternative names set too or are these just suggestions? I would prefer to limit us to one.

- **Purpose:** To identify which RGD was used as a template to create a resource during the reconciliation of an instance. This label will be applied to all resources created by the instance controller.
- **Alternative Names:**
- kro.run/created-by-rgd
- kro.run/managed-by-rgd
Copy link
Contributor

Choose a reason for hiding this comment

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

I think managed-by probably fits best since we continuously work on it

Copy link
Contributor

Choose a reason for hiding this comment

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

I think if we have kro.run/managed-by-rgd it could be reused for the instance too. Is there a specific need to have two labels here?

- kro.run/instance-namespace: default
- **Proposed Labels:**
- `kro.run/managed-by-instance-group`: The API group of the instance (e.g., `mygroup.example.com`).
- `kro.run/managed-by-instance-kind`: The kind of the instance (e.g., `MyKind`).
Copy link
Contributor

Choose a reason for hiding this comment

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

if you define a group+kind, don't you also need to define a version?

Copy link
Member

Choose a reason for hiding this comment

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

How about:

kro.run/instance: production/my-web-app  # namespace/name format
kro.run/instance-gvk: myapp.io/v1/WebService  # optional for additional context ?

Copy link
Member

Choose a reason for hiding this comment

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

another approach would be to just include an RGD ref?

- `kro.run/owner-`
- `kro.run/created-by-`

## Other solutions considered
Copy link
Contributor

Choose a reason for hiding this comment

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

Im wondering if it doesn't make sense to reuse the kubernetes labels or at least co-apply them. Im sure you thought about this too so it would be good to have a thought about this in the proposal

Copy link
Member

Choose a reason for hiding this comment

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

+1 here i would love for us to adopt k8s standard labels. at least the app.kuberentes.io/managed-by and app.kubernets.io/part-of

@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.

Thanks for putting this together @barney-s ! you've identified an important issue - the current labeling scheme is definitely confusing with both resource-graph-definition-id and resource-graph-definition-name without clear semantics.


1. **Label for an instance being reconciled:**
- **Existing Labels:**
- kro.run/resource-graph-definition-id: 761e8fb7-14d5-4da1-b4f9-0a16fc334d6c
Copy link
Member

Choose a reason for hiding this comment

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

I wanted to add some context about why I originally introduced the RGD ID label. The goal was to help the controller detect when RGDs are deleted and recreated, which creates completely new RGDs and can trigger unwanted cleanup. I was thinking we could have an RGD annotation like kro.run/allow-recreation (or maybe kro.run/allow-rgd-replacement?) that users would need to explicitly set. Without this annotation, kro would reject the recreation as a conflict to prevent accidental data loss. cc @matthchr @jakobmoellerdev @n3wscott

Copy link
Member

Choose a reason for hiding this comment

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

This might influence how we think about the labeling scheme - we still need some way to track RGD identity beyond just the name. but i fully agree the current implementation could be clearer

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the Kubernetes UID field is sufficient for this purpose because it is effectively an ID that gets recreated when the object is recreated. Any specific reason why you would want to roll your own?

- kro.run/instance-namespace: default
- **Proposed Labels:**
- `kro.run/managed-by-instance-group`: The API group of the instance (e.g., `mygroup.example.com`).
- `kro.run/managed-by-instance-kind`: The kind of the instance (e.g., `MyKind`).
Copy link
Member

Choose a reason for hiding this comment

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

How about:

kro.run/instance: production/my-web-app  # namespace/name format
kro.run/instance-gvk: myapp.io/v1/WebService  # optional for additional context ?

- kro.run/instance-namespace: default
- **Proposed Labels:**
- `kro.run/managed-by-instance-group`: The API group of the instance (e.g., `mygroup.example.com`).
- `kro.run/managed-by-instance-kind`: The kind of the instance (e.g., `MyKind`).
Copy link
Member

Choose a reason for hiding this comment

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

another approach would be to just include an RGD ref?

- `kro.run/owner-`
- `kro.run/created-by-`

## Other solutions considered
Copy link
Member

Choose a reason for hiding this comment

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

+1 here i would love for us to adopt k8s standard labels. at least the app.kuberentes.io/managed-by and app.kubernets.io/part-of


This aligns with the common Kubernetes practice of using labels for discovery and organization of related resources, as seen in tools like Helm and Kustomize.

#### Design details
Copy link
Member

Choose a reason for hiding this comment

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

should we have a section addressing deeply nested RGDs (3+ levels)? thinking what happens when RGD1 creates an RGD2 instance, which creates an RGD3 instance, which creates an RGD4 instance ? With the two label scheme, we lose the intermediate relationships e.g an RGD4 instance would only show it was defined by RGD3 and controlled by RGD4, with no trace of RGD1 or RGD2. this means queries like "show me all resources that originated from RGD1, including those created indirectly through nested RGDs" won't be possible - which is fine, but worth noting.

Copy link
Contributor

Choose a reason for hiding this comment

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

We could get around this by having a root RGD, although this starts to get reaaaally complicated by then :D

barney-s added a commit to barney-s/kro that referenced this pull request Sep 17, 2025
- Based on proposal: kubernetes-sigs#639
- Move to new labels
- Add deprecate TODO for old labels
- Add new testcase for nested RGD and update existing testcase labels
- Add docs
- Have separate instance labellers for different reconcile paths.
  This is needed when we have RGD2 instance in RGD1 resources.
  Today both paths use the same label resulting in conflict.
  path 1: RGD2.instance created as part of an RGD1 instance reconciliation
  path 2: RGD2.instance reconciled by RGD2 reconciler
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.

6 participants