| 59 | } |
| 60 | |
| 61 | func (c *Cluster) deleteStreams() error { |
| 62 | // check if stream CRD is installed before trying a delete |
| 63 | _, err := c.KubeClient.CustomResourceDefinitions().Get(context.TODO(), constants.EventStreamCRDName, metav1.GetOptions{}) |
| 64 | if k8sutil.ResourceNotFound(err) { |
| 65 | return nil |
| 66 | } |
| 67 | c.setProcessName("deleting event streams") |
| 68 | errors := make([]string, 0) |
| 69 | |
| 70 | for appId := range c.Streams { |
| 71 | err := c.deleteStream(appId) |
| 72 | if err != nil { |
| 73 | errors = append(errors, fmt.Sprintf("%v", err)) |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | if len(errors) > 0 { |
| 78 | return fmt.Errorf("could not delete all event stream custom resources: %v", strings.Join(errors, `', '`)) |
| 79 | } |
| 80 | |
| 81 | return nil |
| 82 | } |
| 83 | |
| 84 | func getDistinctApplicationIds(streams []acidv1.Stream) []string { |
| 85 | appIds := make([]string, 0) |