Skip to content

Commit d49bf49

Browse files
committed
fix: remove "replicas" field from checkForDifferences() function (#952)
Signed-off-by: Julie Vogelman <julie_vogelman@intuit.com>
1 parent 6270135 commit d49bf49

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

internal/controller/monovertexrollout/monovertexrollout_controller_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,7 @@ func Test_CheckForDifferences(t *testing.T) {
471471
from: func() *unstructured.Unstructured {
472472
obj := &unstructured.Unstructured{
473473
Object: map[string]interface{}{
474+
"replicas": 1,
474475
"spec": map[string]interface{}{
475476
"some_map": map[string]interface{}{
476477
"key": "value1",

internal/controller/monovertexrollout/monovertexrollout_progressive.go

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,21 @@ func (r *MonoVertexRolloutReconciler) CheckForDifferences(
161161
return false, err
162162
}
163163

164+
// first remove the "replicas" field from the spec since that's a field which Numaflow Controller adds and we don't want to compare it
165+
removeReplicasFieldFunc := func(spec map[string]interface{}) error {
166+
excludedPaths := []string{"replicas"}
167+
util.RemovePaths(spec, excludedPaths, ".")
168+
return nil
169+
}
170+
err := removeReplicasFieldFunc(from)
171+
if err != nil {
172+
return false, err
173+
}
174+
err = removeReplicasFieldFunc(to)
175+
if err != nil {
176+
return false, err
177+
}
178+
164179
// During a Progressive Upgrade, we need to be aware of the fact that our promoted and upgrading monovertices have been scaled down,
165180
// so we need to be careful about how we compare to the target definition
166181

@@ -215,7 +230,7 @@ func (r *MonoVertexRolloutReconciler) CheckForDifferences(
215230

216231
removeScaleFieldsFunc := func(spec map[string]interface{}) error {
217232

218-
excludedPaths := []string{"replicas", "scale.min", "scale.max", "scale.disabled"}
233+
excludedPaths := []string{"scale.min", "scale.max", "scale.disabled"}
219234

220235
util.RemovePaths(spec, excludedPaths, ".")
221236

0 commit comments

Comments
 (0)