File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
pkg/controller/operators/catalog Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 5
5
"encoding/json"
6
6
"errors"
7
7
"fmt"
8
+ "reflect"
8
9
"sync"
9
10
"time"
10
11
@@ -1034,6 +1035,19 @@ func (o *Operator) ExecutePlan(plan *v1alpha1.InstallPlan) error {
1034
1035
// Attempt to create the CRD.
1035
1036
_ , err = o .opClient .ApiextensionsV1beta1Interface ().ApiextensionsV1beta1 ().CustomResourceDefinitions ().Create (& crd )
1036
1037
if k8serrors .IsAlreadyExists (err ) {
1038
+ currentCRD , _ := o .OpClient .ApiextensionsV1beta1Interface ().ApiextensionsV1beta1 ().CustomResourceDefinitions ().Get (crd .GetName (), metav1.GetOptions {})
1039
+ // Compare 2 CRDs to see if it needs to be updatetd
1040
+ if ! reflect .DeepEqual (crd , * currentCRD ) {
1041
+ // Verify CRD ownership, only attempt to update if
1042
+ // CRD has only one owner
1043
+ if len (existingCRDOwners [currentCRD .GetName ()]) == 1 {
1044
+ // Attempt to update CRD
1045
+ _ , err = o .OpClient .ApiextensionsV1beta1Interface ().ApiextensionsV1beta1 ().CustomResourceDefinitions ().Update (& crd )
1046
+ if err != nil {
1047
+ return errorwrap .Wrapf (err , "error update CRD: %s" , step .Resource .Name )
1048
+ }
1049
+ }
1050
+ }
1037
1051
// If it already existed, mark the step as Present.
1038
1052
plan .Status .Plan [i ].Status = v1alpha1 .StepStatusPresent
1039
1053
continue
You can’t perform that action at this time.
0 commit comments