diff --git a/internal/cnpgi/operator/lifecycle.go b/internal/cnpgi/operator/lifecycle.go index f2a7307..eb2513c 100644 --- a/internal/cnpgi/operator/lifecycle.go +++ b/internal/cnpgi/operator/lifecycle.go @@ -95,6 +95,15 @@ func (impl LifecycleImplementation) LifecycleHook( return nil, nil } + // Only allow modifications during EVALUATE or CREATE operations. + // For PATCH, UPDATE, or other operations, skip processing as the operator will handle changes during EVALUATE. + if *operation != lifecycle.OperatorOperationType_TYPE_EVALUATE && + *operation != lifecycle.OperatorOperationType_TYPE_CREATE { + contextLogger.Trace("Skipping lifecycle hook: operation is not EVALUATE or CREATE", + "operation", operation.String()) + return nil, nil + } + switch kind { case "Pod": contextLogger.Info("Reconciling pod")