DeleteOperatorCRDs deletes the CRDs associated with the operator
( ctx context.Context, crudClient client.Client, )
| 185 | |
| 186 | // DeleteOperatorCRDs deletes the CRDs associated with the operator |
| 187 | func DeleteOperatorCRDs( |
| 188 | ctx context.Context, |
| 189 | crudClient client.Client, |
| 190 | ) error { |
| 191 | u := &unstructured.Unstructured{} |
| 192 | u.SetName("clusters.postgresql.cnpg.io") |
| 193 | u.SetGroupVersionKind(schema.GroupVersionKind{ |
| 194 | Group: "apiextensions.k8s.io", |
| 195 | Version: "v1", |
| 196 | Kind: "CustomResourceDefinition", |
| 197 | }) |
| 198 | err := objects.Delete(ctx, crudClient, u) |
| 199 | if !apierrors.IsNotFound(err) { |
| 200 | return err |
| 201 | } |
| 202 | u.SetName("backups.postgresql.cnpg.io") |
| 203 | err = objects.Delete(ctx, crudClient, u) |
| 204 | if !apierrors.IsNotFound(err) { |
| 205 | return err |
| 206 | } |
| 207 | u.SetName("poolers.postgresql.cnpg.io") |
| 208 | err = objects.Delete(ctx, crudClient, u) |
| 209 | if !apierrors.IsNotFound(err) { |
| 210 | return err |
| 211 | } |
| 212 | u.SetName("scheduledbackups.postgresql.cnpg.io") |
| 213 | err = objects.Delete(ctx, crudClient, u) |
| 214 | if apierrors.IsNotFound(err) { |
| 215 | return nil |
| 216 | } |
| 217 | return err |
| 218 | } |
| 219 | |
| 220 | // DeleteCSV will delete all operator's CSVs |
| 221 | func DeleteCSV( |