@@ -831,12 +831,6 @@ func (o *Operator) syncResolvingNamespace(obj interface{}) error {
831
831
return err
832
832
}
833
833
834
- ips , err := o .listInstallPlansMap (namespace )
835
- if err != nil {
836
- logger .WithError (err ).Debug ("couldn't list installplan" )
837
- return err
838
- }
839
-
840
834
// TODO: parallel
841
835
maxGeneration := 0
842
836
subscriptionUpdated := false
@@ -853,7 +847,7 @@ func (o *Operator) syncResolvingNamespace(obj interface{}) error {
853
847
}
854
848
855
849
// ensure the installplan reference is correct
856
- sub , changedIP , err := o .ensureSubscriptionInstallPlanState (logger , sub , ips )
850
+ sub , changedIP , err := o .ensureSubscriptionInstallPlanState (logger , sub )
857
851
if err != nil {
858
852
logger .Debugf ("error ensuring installplan state: %v" , err )
859
853
return err
@@ -958,29 +952,9 @@ func (o *Operator) nothingToUpdate(logger *logrus.Entry, sub *v1alpha1.Subscript
958
952
return false
959
953
}
960
954
961
- // checkMissingInstallPlan checks if the installplan is missing or not when
962
- // the subscription is in pending upgrade state
963
- func (o * Operator ) checkMissingInstallPlan (sub * v1alpha1.Subscription , ips map [string ]struct {}) (* v1alpha1.Subscription , bool , error ) {
964
- _ , ok := ips [sub .Status .InstallPlanRef .Name ]
965
- if ! ok && sub .Status .State == v1alpha1 .SubscriptionStateUpgradePending {
966
- out := sub .DeepCopy ()
967
- out .Status .InstallPlanRef = nil
968
- out .Status .Install = nil
969
- out .Status .CurrentCSV = ""
970
- out .Status .State = v1alpha1 .SubscriptionStateNone
971
- out .Status .LastUpdated = o .now ()
972
- updated , err := o .client .OperatorsV1alpha1 ().Subscriptions (sub .GetNamespace ()).UpdateStatus (context .TODO (), out , metav1.UpdateOptions {})
973
- if err != nil {
974
- return out , false , nil
975
- }
976
- return updated , true , nil
977
- }
978
- return sub , false , nil
979
- }
980
-
981
- func (o * Operator ) ensureSubscriptionInstallPlanState (logger * logrus.Entry , sub * v1alpha1.Subscription , ips map [string ]struct {}) (* v1alpha1.Subscription , bool , error ) {
955
+ func (o * Operator ) ensureSubscriptionInstallPlanState (logger * logrus.Entry , sub * v1alpha1.Subscription ) (* v1alpha1.Subscription , bool , error ) {
982
956
if sub .Status .InstallPlanRef != nil || sub .Status .Install != nil {
983
- return o . checkMissingInstallPlan ( sub , ips )
957
+ return sub , false , nil
984
958
}
985
959
986
960
logger .Debug ("checking for existing installplan" )
@@ -2046,20 +2020,6 @@ func (o *Operator) listInstallPlans(namespace string) (ips []*v1alpha1.InstallPl
2046
2020
return
2047
2021
}
2048
2022
2049
- func (o * Operator ) listInstallPlansMap (namespace string ) (ips map [string ]struct {}, err error ) {
2050
- list , err := o .client .OperatorsV1alpha1 ().InstallPlans (namespace ).List (context .TODO (), metav1.ListOptions {})
2051
- if err != nil {
2052
- return
2053
- }
2054
-
2055
- ips = make (map [string ]struct {})
2056
- for i := range list .Items {
2057
- ips [list .Items [i ].GetName ()] = struct {}{}
2058
- }
2059
-
2060
- return
2061
- }
2062
-
2063
2023
// competingCRDOwnersExist returns true if there exists a CSV that owns at least one of the given CSVs owned CRDs (that's not the given CSV)
2064
2024
func competingCRDOwnersExist (namespace string , csv * v1alpha1.ClusterServiceVersion , existingOwners map [string ][]string ) (bool , error ) {
2065
2025
// Attempt to find a pre-existing owner in the namespace for any owned crd
0 commit comments