Merge pull request #657 from schylek/patch-test-fix
Loosen test conditions for patching VPA objects.
This commit is contained in:
commit
b1935fc0d0
|
|
@ -71,22 +71,17 @@ func UpdateVpaStatus(vpaClient vpa_api.VerticalPodAutoscalerInterface, vpa *mode
|
||||||
|
|
||||||
patches := make([]patchRecord, 0)
|
patches := make([]patchRecord, 0)
|
||||||
|
|
||||||
// Verify that Status was not updated in the meantime to avoid a race
|
// Verify that Status was not updated in the meantime to avoid a race condition.
|
||||||
// condition.
|
// If LastUpdateTime is not set patch is executed unconditionally (it is a low
|
||||||
|
// risk race condition).
|
||||||
if !vpa.LastUpdateTime.IsZero() {
|
if !vpa.LastUpdateTime.IsZero() {
|
||||||
patches = append(patches, patchRecord{
|
patches = append(patches, patchRecord{
|
||||||
Op: "test",
|
Op: "test",
|
||||||
Path: "/status/lastUpdateTime",
|
Path: "/status/lastUpdateTime",
|
||||||
Value: metav1.NewTime(vpa.LastUpdateTime),
|
Value: metav1.NewTime(vpa.LastUpdateTime),
|
||||||
})
|
})
|
||||||
} else {
|
|
||||||
// Status field not set yet.
|
|
||||||
patches = append(patches, patchRecord{
|
|
||||||
Op: "test",
|
|
||||||
Path: "/status",
|
|
||||||
Value: nil,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
patches = append(patches, patchRecord{
|
patches = append(patches, patchRecord{
|
||||||
Op: "add",
|
Op: "add",
|
||||||
Path: "/status",
|
Path: "/status",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue