fix: inject the sidecar only during Pod/Job creation

Closes #377

Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
This commit is contained in:
Marco Nenciarini 2025-05-30 14:17:52 +02:00
parent 8fcd748c3b
commit baa88b630e
No known key found for this signature in database
GPG Key ID: 589F03F01BA55038

View File

@ -95,6 +95,15 @@ func (impl LifecycleImplementation) LifecycleHook(
return nil, nil 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 { switch kind {
case "Pod": case "Pod":
contextLogger.Info("Reconciling pod") contextLogger.Info("Reconciling pod")