Skip to content

Commit baa88b6

Browse files
committed
fix: inject the sidecar only during Pod/Job creation
Closes #377 Signed-off-by: Marco Nenciarini <[email protected]>
1 parent 8fcd748 commit baa88b6

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

internal/cnpgi/operator/lifecycle.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,15 @@ func (impl LifecycleImplementation) LifecycleHook(
9595
return nil, nil
9696
}
9797

98+
// Only allow modifications during EVALUATE or CREATE operations.
99+
// For PATCH, UPDATE, or other operations, skip processing as the operator will handle changes during EVALUATE.
100+
if *operation != lifecycle.OperatorOperationType_TYPE_EVALUATE &&
101+
*operation != lifecycle.OperatorOperationType_TYPE_CREATE {
102+
contextLogger.Trace("Skipping lifecycle hook: operation is not EVALUATE or CREATE",
103+
"operation", operation.String())
104+
return nil, nil
105+
}
106+
98107
switch kind {
99108
case "Pod":
100109
contextLogger.Info("Reconciling pod")

0 commit comments

Comments
 (0)