From 1cf85d763c120fb4733743970e7ea708dd041a16 Mon Sep 17 00:00:00 2001 From: Kirby Chin <37311900+kabicin@users.noreply.github.com> Date: Tue, 2 Jun 2026 13:27:52 -0400 Subject: [PATCH] fix: preserve user-defined `app.kubernetes.io/part-of` label Previously, the Initialize() method unconditionally overwrote the app.kubernetes.io/part-of label with spec.applicationName, even when users explicitly set a custom value in metadata.labels. Now checks if the label exists before setting it, respecting user-provided values while still defaulting to spec.applicationName when the label is not present. --- api/v1/runtimecomponent_types.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/api/v1/runtimecomponent_types.go b/api/v1/runtimecomponent_types.go index ba78042d..1859cea1 100644 --- a/api/v1/runtimecomponent_types.go +++ b/api/v1/runtimecomponent_types.go @@ -1136,7 +1136,9 @@ func (cr *RuntimeComponent) Initialize() { } if cr.Labels != nil { - cr.Labels["app.kubernetes.io/part-of"] = cr.Spec.ApplicationName + if _, found := cr.Labels["app.kubernetes.io/part-of"]; !found { + cr.Labels["app.kubernetes.io/part-of"] = cr.Spec.ApplicationName + } } // This is to handle when there is no service in the CR