Initial commit.

This commit is contained in:
2025-10-11 17:06:14 +00:00
commit ec521c3c91
45 changed files with 9798 additions and 0 deletions

33
internal/tools/kubectl.go Normal file
View File

@@ -0,0 +1,33 @@
package tools
import (
"os/exec"
)
// Kubectl provides a thin wrapper around the kubectl command-line tool
type Kubectl struct {
kubeconfigPath string
}
// NewKubectl creates a new Kubectl wrapper
func NewKubectl(kubeconfigPath string) *Kubectl {
return &Kubectl{
kubeconfigPath: kubeconfigPath,
}
}
// DeploymentExists checks if a deployment exists in the specified namespace
func (k *Kubectl) DeploymentExists(name, namespace string) bool {
args := []string{
"get", "deployment", name,
"-n", namespace,
}
if k.kubeconfigPath != "" {
args = append([]string{"--kubeconfig", k.kubeconfigPath}, args...)
}
cmd := exec.Command("kubectl", args...)
err := cmd.Run()
return err == nil
}