Skip to content

Commit b9945fc

Browse files
authored
[Bugfix] Prevent changes when UID is wrong (#1138)
1 parent d7edf28 commit b9945fc

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Change Log
22

33
## [master](https://github.com/arangodb/kube-arangodb/tree/master) (N/A)
4+
- (Bugfix) Prevent changes when UID is wrong
45

56
## [1.2.18](https://github.com/arangodb/kube-arangodb/tree/1.2.18) (2022-09-28)
67
- (Feature) Define Actions PlaceHolder

pkg/deployment/deployment.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ type Deployment struct {
103103
log logging.Logger
104104

105105
name string
106+
uid types.UID
106107
namespace string
107108

108109
currentObject *api.ArangoDeployment
@@ -234,6 +235,7 @@ func New(config Config, deps Dependencies, apiObject *api.ArangoDeployment) (*De
234235
currentObject: apiObject,
235236
currentObjectStatus: apiObject.Status.DeepCopy(),
236237
name: apiObject.GetName(),
238+
uid: apiObject.GetUID(),
237239
namespace: apiObject.GetNamespace(),
238240
config: config,
239241
deps: deps,

pkg/deployment/deployment_inspector.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,12 @@ func (d *Deployment) inspectDeployment(lastInterval util.Interval) util.Interval
7676
d.log.Info("Deployment is gone")
7777
d.Stop()
7878
return nextInterval
79+
} else if err != nil {
80+
d.log.Err(err).Error("Deployment fetch error")
81+
return nextInterval
82+
} else if d.uid != updated.GetUID() {
83+
d.log.Error("Deployment UID Changed!")
84+
return nextInterval
7985
} else if updated != nil && updated.GetDeletionTimestamp() != nil {
8086
// Deployment is marked for deletion
8187
if err := d.runDeploymentFinalizers(ctxReconciliation, d.GetCachedStatus()); err != nil {

0 commit comments

Comments
 (0)