@@ -3,7 +3,6 @@ package reconciler
3
3
import (
4
4
"context"
5
5
"fmt"
6
-
7
6
"github.com/operator-framework/api/pkg/operators/v1alpha1"
8
7
"github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorclient"
9
8
"github.com/operator-framework/operator-lifecycle-manager/pkg/lib/operatorlister"
@@ -14,7 +13,9 @@ import (
14
13
v1 "k8s.io/api/core/v1"
15
14
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
16
15
"k8s.io/apimachinery/pkg/labels"
16
+ "k8s.io/apimachinery/pkg/types"
17
17
"k8s.io/apimachinery/pkg/util/intstr"
18
+ "sigs.k8s.io/controller-runtime/pkg/client"
18
19
)
19
20
20
21
const CatalogSourceUpdateKey = "catalogsource.operators.coreos.com/update"
@@ -198,12 +199,20 @@ func (c *GrpcRegistryReconciler) ensureUpdatePod(source grpcCatalogSourceDecorat
198
199
updatePod .Labels [CatalogSourceUpdateKey ] = ""
199
200
200
201
// Update the update pod to promote it to serving pod
201
- _ , err := c .OpClient .KubernetesInterface ().CoreV1 ().Pods (source .GetNamespace ()).Update (context .TODO (), updatePod , metav1.UpdateOptions {})
202
- if err != nil {
203
- return errors .Wrapf (err , "error creating new pod: %s" , source .Pod ().GetName ())
202
+ forceApply := true
203
+ opts := metav1.PatchOptions {
204
+ Force : & forceApply ,
205
+ FieldManager : "operator-lifecycle-manager-registry-reconciler" ,
204
206
}
205
207
206
- break
208
+ updatePodBytes , err := client .Apply .Data (updatePod )
209
+ if err != nil {
210
+ return errors .Wrapf (err , "error serializing updated catalog source pod to bytes: %s" , source .Pod ().GetName ())
211
+ }
212
+ _ , err = c .OpClient .KubernetesInterface ().CoreV1 ().Pods (source .GetNamespace ()).Patch (context .TODO (), updatePod .Name , types .ApplyPatchType , updatePodBytes , opts )
213
+ if err != nil {
214
+ return errors .Wrapf (err , "error updating catalog source pod: %s" , source .Pod ().GetName ())
215
+ }
207
216
}
208
217
}
209
218
0 commit comments