Skip to content

Commit

Permalink
Don't apply if resource version is incorrect (#43)
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Kim <[email protected]>
  • Loading branch information
Oats87 authored Aug 6, 2021
1 parent c8e5174 commit cbfd684
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/k8splan/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ func (w *watcher) start(ctx context.Context) {
}
logrus.Debugf("[K8s] Processing secret %s in namespace %s at generation %d with resource version %s", secret.Name, secret.Namespace, secret.Generation, secret.ResourceVersion)
needsApplied := true
if w.lastAppliedResourceVersion > secret.ResourceVersion {
logrus.Debugf("received secret to process that was older than the last secret operated on. (%s vs %s)", secret.ResourceVersion, w.lastAppliedResourceVersion)
return secret, nil
}
if w.lastAppliedResourceVersion == secret.ResourceVersion {
logrus.Debugf("last applied resource version (%s) did not change. skipping apply.", w.lastAppliedResourceVersion)
needsApplied = false
Expand Down

0 comments on commit cbfd684

Please sign in to comment.