From 03f65a97dbb6fda7f9afdf075f2a3dd764868019 Mon Sep 17 00:00:00 2001 From: lr90 Date: Mon, 4 Nov 2024 19:36:17 +0800 Subject: [PATCH 1/2] clarify comments of GenerationChangedPredicate --- pkg/predicate/predicate.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/predicate/predicate.go b/pkg/predicate/predicate.go index 90918db57a..18aa4c71ae 100644 --- a/pkg/predicate/predicate.go +++ b/pkg/predicate/predicate.go @@ -173,7 +173,7 @@ func (TypedResourceVersionChangedPredicate[T]) Update(e event.TypedUpdateEvent[T // The metadata.generation field of an object is incremented by the API server when writes are made to the spec field of an object. // This allows a controller to ignore update events where the spec is unchanged, and only the metadata and/or status fields are changed. // -// For CustomResource objects the Generation is only incremented when the status subresource is enabled. +// For CustomResource objects the Generation is only incremented when the status subresource is not enabled. // // Caveats: // @@ -191,7 +191,7 @@ type GenerationChangedPredicate = TypedGenerationChangedPredicate[client.Object] // The metadata.generation field of an object is incremented by the API server when writes are made to the spec field of an object. // This allows a controller to ignore update events where the spec is unchanged, and only the metadata and/or status fields are changed. // -// For CustomResource objects the Generation is only incremented when the status subresource is enabled. +// For CustomResource objects the Generation is only incremented when the status subresource is not enabled. // // Caveats: // From 75b5e9dc2a8f4069d3978734a3231bd64f42e74a Mon Sep 17 00:00:00 2001 From: lr90 Date: Mon, 4 Nov 2024 20:37:12 +0800 Subject: [PATCH 2/2] fix: update comments of GenerationChangedPredicate about cr generation --- pkg/predicate/predicate.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/predicate/predicate.go b/pkg/predicate/predicate.go index 18aa4c71ae..ce33975f3b 100644 --- a/pkg/predicate/predicate.go +++ b/pkg/predicate/predicate.go @@ -173,7 +173,8 @@ func (TypedResourceVersionChangedPredicate[T]) Update(e event.TypedUpdateEvent[T // The metadata.generation field of an object is incremented by the API server when writes are made to the spec field of an object. // This allows a controller to ignore update events where the spec is unchanged, and only the metadata and/or status fields are changed. // -// For CustomResource objects the Generation is only incremented when the status subresource is not enabled. +// For CustomResource objects the Generation is incremented when spec is changed, or status changed and status not modeled as subresource. +// subresource status update will not increase Generation. // // Caveats: // @@ -191,7 +192,8 @@ type GenerationChangedPredicate = TypedGenerationChangedPredicate[client.Object] // The metadata.generation field of an object is incremented by the API server when writes are made to the spec field of an object. // This allows a controller to ignore update events where the spec is unchanged, and only the metadata and/or status fields are changed. // -// For CustomResource objects the Generation is only incremented when the status subresource is not enabled. +// For CustomResource objects the Generation is incremented when spec is changed, or status changed and status not modeled as subresource. +// subresource status update will not increase Generation. // // Caveats: //