Skip to content

Commit

Permalink
check if resource exists BEFORE pushing -> Created state for new reso…
Browse files Browse the repository at this point in the history
…urces (was: Updated) (#708)

Signed-off-by: Andre Dietisheim <[email protected]>
  • Loading branch information
adietish committed Jan 18, 2024
1 parent e89fbd4 commit 07c29d7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ open class ClusterResource protected constructor(
return
}
this.updatedResource = resource
setDeleted(false)
setDeleted(resource == null)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,14 +206,15 @@ open class EditorResource(
"Could not push ${toKindAndName(resource)} to cluster.",
"Not connected."
)
val exists = cluster.exists()
val updatedResource = cluster.push(resource)
setResourceVersion(KubernetesResourceUtil.getResourceVersion(updatedResource))
/**
* Store resource that was pushed, not resource returned from cluster.
* In this way this resource is not in modified state anymore
*/
setLastPushedPulled(resource)
createPushedState(resource, cluster.exists())
createPushedState(resource, exists)
} catch (e: Exception) {
/**
* Store resource that we tried to push but failed.
Expand Down

0 comments on commit 07c29d7

Please sign in to comment.