Skip to content

Commit e5dba7b

Browse files
committed
BUG: ignore IsNotFound error when trying to scale down deployment
We can safely ignore IsNotFound errors when the oeprator triyes to scale down the descheduler deployment as the result of a bad configuration. This could happen for instance if this is the first configuration attempt and the deployment has never been created before. In this way the operator can continue and succefully report the error condition. Signed-off-by: Simone Tiraboschi <[email protected]>
1 parent 4f5a9eb commit e5dba7b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pkg/operator/target_config_reconciler.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import (
3535
autoscalingv1 "k8s.io/api/autoscaling/v1"
3636
v1 "k8s.io/api/core/v1"
3737
rbacv1 "k8s.io/api/rbac/v1"
38+
"k8s.io/apimachinery/pkg/api/errors"
3839
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3940
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
4041
"k8s.io/apimachinery/pkg/runtime"
@@ -176,7 +177,7 @@ func (c TargetConfigReconciler) sync() error {
176177
},
177178
},
178179
metav1.UpdateOptions{})
179-
if err != nil {
180+
if err != nil && !errors.IsNotFound(err) {
180181
return err
181182
}
182183
_, _, err = v1helpers.UpdateStatus(c.ctx, c.deschedulerClient,

0 commit comments

Comments
 (0)