DeleteSubscription deletes the operator's subscription object
( ctx context.Context, crudClient client.Client, )
| 163 | |
| 164 | // DeleteSubscription deletes the operator's subscription object |
| 165 | func DeleteSubscription( |
| 166 | ctx context.Context, |
| 167 | crudClient client.Client, |
| 168 | ) error { |
| 169 | u := &unstructured.Unstructured{} |
| 170 | u.SetName("cloudnative-pg") |
| 171 | u.SetNamespace("openshift-operators") |
| 172 | u.SetGroupVersionKind(schema.GroupVersionKind{ |
| 173 | Group: "operators.coreos.com", |
| 174 | Version: "v1alpha1", |
| 175 | Kind: "Subscription", |
| 176 | }) |
| 177 | |
| 178 | err := objects.Delete(ctx, crudClient, u) |
| 179 | if apierrors.IsNotFound(err) { |
| 180 | return nil |
| 181 | } |
| 182 | |
| 183 | return err |
| 184 | } |
| 185 | |
| 186 | // DeleteOperatorCRDs deletes the CRDs associated with the operator |
| 187 | func DeleteOperatorCRDs( |