mirror of https://github.com/linkerd/linkerd2.git
43 lines
1.1 KiB
Go
43 lines
1.1 KiB
Go
package cmd
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"os"
|
|
|
|
pkgCmd "github.com/linkerd/linkerd2/pkg/cmd"
|
|
"github.com/linkerd/linkerd2/pkg/k8s"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func newCmdUninstall() *cobra.Command {
|
|
cmd := &cobra.Command{
|
|
Use: "uninstall",
|
|
Args: cobra.NoArgs,
|
|
Short: "Output Kubernetes resources to uninstall the Linkerd-jaeger extension",
|
|
Long: `Output Kubernetes resources to uninstall the Linkerd-jaeger extension.
|
|
|
|
This command provides all Kubernetes namespace-scoped and cluster-scoped resources (e.g services, deployments, RBACs, etc.) necessary to uninstall the Linkerd-jaeger extension.`,
|
|
Example: `linkerd uninstall | kubectl delete -f -`,
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
err := uninstallRunE(cmd.Context())
|
|
if err != nil {
|
|
fmt.Fprintln(os.Stderr, err)
|
|
os.Exit(1)
|
|
}
|
|
return nil
|
|
},
|
|
}
|
|
|
|
return cmd
|
|
}
|
|
|
|
func uninstallRunE(ctx context.Context) error {
|
|
k8sAPI, err := k8s.NewAPI(kubeconfigPath, kubeContext, impersonate, impersonateGroup, 0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
return pkgCmd.Uninstall(ctx, k8sAPI, fmt.Sprintf("%s=%s", k8s.LinkerdExtensionLabel, JaegerExtensionName))
|
|
}
|