Skip to content

Commit 85616c9

Browse files
committed
fix: don't strip user-managed kagenti.io/skills annotation on deletion
The deletion handler was removing the kagenti.io/skills annotation from the target Deployment. This annotation is user-managed (set by the kagenti backend or user) — the operator reads but never sets it, so it should not remove it either. This caused the E2E skill discovery test to fail: the "feature gate disabled" test deletes the AgentRuntime, the finalizer strips the annotation, and the subsequent "feature gate enabled" test finds an empty annotation on the same Deployment. Also re-apply the Deployment fixture in the E2E "feature gate enabled" BeforeAll to guard against any future annotation-stripping regressions. Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com> Signed-off-by: Paolo Dettori <dettori@us.ibm.com>
1 parent 1432569 commit 85616c9

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

kagenti-operator/internal/controller/agentruntime_controller.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -719,10 +719,6 @@ func (r *AgentRuntimeReconciler) handleDeletion(ctx context.Context, rt *agentv1
719719
delete(workloadLabels, LabelManagedBy)
720720
acc.obj.SetLabels(workloadLabels)
721721

722-
// Remove skills annotation from workload metadata.
723-
workloadAnnotations := acc.obj.GetAnnotations()
724-
delete(workloadAnnotations, AnnotationSkills)
725-
acc.obj.SetAnnotations(workloadAnnotations)
726722

727723
// Remove kagenti.io/type from PodTemplateSpec pod labels so future pods
728724
// are not presented to the webhook with the type label.

kagenti-operator/test/e2e/e2e_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2133,6 +2133,13 @@ rules:
21332133

21342134
Context("Feature gate enabled", Ordered, func() {
21352135
BeforeAll(func() {
2136+
By("re-applying target Deployment to restore skills annotation after prior deletion cleanup")
2137+
_, err := utils.KubectlApplyStdin(skillDiscoveryDeploymentFixture(), skillDiscoveryTestNamespace)
2138+
Expect(err).NotTo(HaveOccurred())
2139+
Expect(utils.WaitForDeploymentReady(
2140+
"skill-discovery-agent", skillDiscoveryTestNamespace, 2*time.Minute,
2141+
)).To(Succeed())
2142+
21362143
By("enabling skillDiscovery feature gate")
21372144
Expect(utils.EnableSkillDiscovery(controllerNamespace, controllerDeployment)).To(Succeed())
21382145

0 commit comments

Comments
 (0)