-
-
Notifications
You must be signed in to change notification settings - Fork 286
/
uninstall.go
74 lines (54 loc) · 2.16 KB
/
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// Copyright (c) arkade author(s) 2022. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
package cmd
import (
"fmt"
"github.com/spf13/cobra"
)
func MakeUninstall() *cobra.Command {
var command = &cobra.Command{
Use: "uninstall",
Short: "Uninstall apps installed with arkade",
Long: `Uninstall apps installed with arkade`,
Example: ` arkade uninstall`,
Aliases: []string{"delete"},
SilenceUsage: false,
}
command.PersistentFlags().String("kubeconfig", "kubeconfig", "Local path for your kubeconfig file")
command.PersistentFlags().Bool("wait", false, "If we should wait for the resource to be ready before returning (helm3 only, default false)")
command.RunE = func(command *cobra.Command, args []string) error {
if len(args) == 0 {
fmt.Printf(
`Apps installed to Kubernetes can rarely be uninstalled in a single command
and often leave clusters in an inconsistent state. Kubernetes does not
track resources created by applications in the same way that something like
Windows 10 or MacOS would do, so it is often much easier for you to
create a new cluster, than to remove an application.
With a tool like kind, you just run:
kind delete cluster; kind create cluster
Most arkade apps are installed with helm, so you can simply use helm to
remove them, but beware that each project generally provides very specific
guidance on how to clear up all resources that it may have created
at installation time.
Get helm:
arkade get helm
List charts:
helm list --all-namespaces
Delete a chart:
helm delete -n openfaas openfaas
Delete any namespaces it created:
kubectl delete namespace openfaas openfaas-fn
Where an app was installed via manifest files or an upstream CLI like
with linkerd or OSM, then you can usually delete its namespace,
however this does not always remove all resources such as a
ClusterRole. See the app's code for more:
https://github.com/alexellis/arkade/tree/master/cmd/apps
You can seek out technical support from the OpenFaaS community
at https://slack.openfaas.io/
`)
return nil
}
return nil
}
return command
}