@@ -123,6 +123,7 @@ func (u *OperatorUninstall) deleteObjects(ctx context.Context, objs ...controlle
123123 return waitForDeletion (ctx , u .config .Client , objs ... )
124124}
125125
126+ // getInstalledCSV looks up the installed CSV name from the provided subscription and fetches it.
126127func (u * OperatorUninstall ) getInstalledCSV (ctx context.Context , subscription * v1alpha1.Subscription ) (* v1alpha1.ClusterServiceVersion , error ) {
127128 key := types.NamespacedName {
128129 Name : subscription .Status .InstalledCSV ,
@@ -134,14 +135,11 @@ func (u *OperatorUninstall) getInstalledCSV(ctx context.Context, subscription *v
134135 return nil , err
135136 }
136137
137- installedCSV .SetGroupVersionKind (schema.GroupVersionKind {
138- Kind : csvKind ,
139- Version : installedCSV .GroupVersionKind ().Version ,
140- Group : installedCSV .GroupVersionKind ().Group ,
141- })
138+ installedCSV .SetGroupVersionKind (v1alpha1 .SchemeGroupVersion .WithKind (csvKind ))
142139 return installedCSV , nil
143140}
144141
142+ // getCRDs returns the list of CRDs required by a CSV.
145143func getCRDs (csv * v1alpha1.ClusterServiceVersion ) (crds []controllerutil.Object ) {
146144 for _ , resource := range csv .Status .RequirementStatus {
147145 if resource .Kind == crdKind {
@@ -152,8 +150,6 @@ func getCRDs(csv *v1alpha1.ClusterServiceVersion) (crds []controllerutil.Object)
152150 Kind : resource .Kind ,
153151 })
154152 obj .SetName (resource .Name )
155- obj .SetNamespace (csv .GetNamespace ())
156-
157153 crds = append (crds , obj )
158154 }
159155 }
0 commit comments