@@ -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,10 @@ 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/runtime/schema"
17
+ "k8s.io/apimachinery/pkg/types"
17
18
"k8s.io/apimachinery/pkg/util/intstr"
19
+ "sigs.k8s.io/controller-runtime/pkg/client"
18
20
)
19
21
20
22
const CatalogSourceUpdateKey = "catalogsource.operators.coreos.com/update"
@@ -198,12 +200,28 @@ func (c *GrpcRegistryReconciler) ensureUpdatePod(source grpcCatalogSourceDecorat
198
200
updatePod .Labels [CatalogSourceUpdateKey ] = ""
199
201
200
202
// 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 {})
203
+ forceApply := true
204
+ opts := metav1.PatchOptions {
205
+ Force : & forceApply ,
206
+ FieldManager : "operator-lifecycle-manager-registry-reconciler" ,
207
+ }
208
+
209
+ updatePodBytes , err := client .Apply .Data (updatePod )
202
210
if err != nil {
203
- return errors .Wrapf (err , "error creating new pod: %s" , source .Pod ().GetName ())
211
+ return errors .Wrapf (err , "error serializing updated catalog source pod to bytes : %s" , source .Pod ().GetName ())
204
212
}
205
213
206
- break
214
+ if updatePod .GroupVersionKind ().Empty () {
215
+ updatePod .SetGroupVersionKind (schema.GroupVersionKind {
216
+ Group : "" ,
217
+ Version : "v1" ,
218
+ Kind : "Pod" ,
219
+ })
220
+ }
221
+ _ , err = c .OpClient .KubernetesInterface ().CoreV1 ().Pods (source .GetNamespace ()).Patch (context .TODO (), updatePod .Name , types .ApplyPatchType , updatePodBytes , opts )
222
+ if err != nil {
223
+ return errors .Wrapf (err , "error updating catalog source pod: %s" , source .Pod ().GetName ())
224
+ }
207
225
}
208
226
}
209
227
0 commit comments