Skip to content

Commit

Permalink
[RS-2297] Recreate dashboard-installer job on image mismatch (#3768)
Browse files Browse the repository at this point in the history
* Recreate dashboard-installer job on image mismatch

* Make job image update more reliable
  • Loading branch information
Dean-Coakley authored Feb 6, 2025
1 parent d334553 commit 57cdab7
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions pkg/controller/utils/component.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2020-2024 Tigera, Inc. All rights reserved.
// Copyright (c) 2020-2025 Tigera, Inc. All rights reserved.

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -446,9 +446,16 @@ func mergeState(desired client.Object, current runtime.Object) client.Object {
cj := current.(*batchv1.Job)
dj := desired.(*batchv1.Job)

// We're only comparing jobs based off of annotations for now so we can send a signal to recreate a job. Later
// we might want to have some better comparison of jobs so that a changed in the container spec would trigger
// a recreation of the job
if len(cj.Spec.Template.Spec.Containers) != len(dj.Spec.Template.Spec.Containers) {
return dj
}

for i := range cj.Spec.Template.Spec.Containers {
if cj.Spec.Template.Spec.Containers[i].Image != dj.Spec.Template.Spec.Containers[i].Image {
return dj
}
}

if reflect.DeepEqual(cj.Spec.Template.Annotations, dj.Spec.Template.Annotations) {
return nil
}
Expand Down

0 comments on commit 57cdab7

Please sign in to comment.