-
Notifications
You must be signed in to change notification settings - Fork 202
/
uninstall.go
39 lines (32 loc) · 909 Bytes
/
uninstall.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// ------------------------------------------------------------
// Copyright (c) Microsoft Corporation and Dapr Contributors.
// Licensed under the MIT License.
// ------------------------------------------------------------
package kubernetes
import (
"time"
"github.com/dapr/cli/utils"
helm "helm.sh/helm/v3/pkg/action"
)
// Uninstall removes Dapr from a Kubernetes cluster.
func Uninstall(namespace string, uninstallAll bool, timeout uint) error {
config, err := helmConfig(namespace)
if err != nil {
return err
}
uninstallClient := helm.NewUninstall(config)
uninstallClient.Timeout = time.Duration(timeout) * time.Second
_, err = uninstallClient.Run(daprReleaseName)
if err != nil {
return err
}
if uninstallAll {
for _, crd := range crdsFullResources {
_, err := utils.RunCmdAndWait("kubectl", "delete", "crd", crd)
if err != nil {
return err
}
}
}
return nil
}