-
Notifications
You must be signed in to change notification settings - Fork 4
/
registry.go
30 lines (23 loc) · 826 Bytes
/
registry.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
package registry
import (
"context"
_ "embed"
"strings"
"github.com/adrianliechti/devkube/pkg/kubectl"
)
var (
//go:embed registry.yaml
manifest string
)
func Install(ctx context.Context, kubeconfig, namespace string) error {
if namespace == "" {
namespace = "default"
}
return kubectl.Invoke(ctx, []string{"apply", "-f", "-"}, kubectl.WithKubeconfig(kubeconfig), kubectl.WithNamespace(namespace), kubectl.WithInput(strings.NewReader(manifest)), kubectl.WithDefaultOutput())
}
func Uninstall(ctx context.Context, kubeconfig, namespace string) error {
if namespace == "" {
namespace = "default"
}
return kubectl.Invoke(ctx, []string{"delete", "-f", "-"}, kubectl.WithKubeconfig(kubeconfig), kubectl.WithNamespace(namespace), kubectl.WithInput(strings.NewReader(manifest)), kubectl.WithDefaultOutput())
}