MCPcopy Create free account
hub / github.com/cloudnative-pg/cloudnative-pg / DeleteCSV

Function DeleteCSV

tests/utils/openshift/openshift.go:221–248  ·  view source on GitHub ↗

DeleteCSV will delete all operator's CSVs

(
	ctx context.Context,
	crudClient client.Client,
)

Source from the content-addressed store, hash-verified

219
220// DeleteCSV will delete all operator's CSVs
221func DeleteCSV(
222 ctx context.Context,
223 crudClient client.Client,
224) error {
225 ol := &unstructured.UnstructuredList{}
226 ol.SetGroupVersionKind(schema.GroupVersionKind{
227 Group: "operators.coreos.com",
228 Version: "v1alpha1",
229 Kind: "ClusterServiceVersion",
230 })
231 labelSelector := labels.SelectorFromSet(map[string]string{
232 "operators.coreos.com/cloudnative-pg.openshift-operators": "",
233 })
234 err := objects.List(ctx, crudClient, ol, client.MatchingLabelsSelector{Selector: labelSelector})
235 if err != nil {
236 return err
237 }
238 for _, o := range ol.Items {
239 err = objects.Delete(ctx, crudClient, &o)
240 if err != nil {
241 if apierrors.IsNotFound(err) {
242 continue
243 }
244 return err
245 }
246 }
247 return err
248}
249
250// UpgradeSubscription patch an unstructured subscription object with target channel
251func UpgradeSubscription(

Callers

nothing calls this directly

Calls 2

ListFunction · 0.92
DeleteFunction · 0.92

Tested by

no test coverage detected