diff --git a/pkg/controller/perconaservermongodb/smart.go b/pkg/controller/perconaservermongodb/smart.go index fd93a1be71..f545e0481a 100644 --- a/pkg/controller/perconaservermongodb/smart.go +++ b/pkg/controller/perconaservermongodb/smart.go @@ -222,7 +222,9 @@ func (r *ReconcilePerconaServerMongoDB) setUpdateMongosFirst(ctx context.Context if err := r.client.Get(ctx, types.NamespacedName{Name: cr.Name, Namespace: cr.Namespace}, c); err != nil { return err } - + if c.Annotations == nil { + c.Annotations = make(map[string]string) + } c.Annotations[api.AnnotationUpdateMongosFirst] = "true" return r.client.Update(ctx, c)