mirror of
https://github.com/helmfile/helmfile.git
synced 2026-10-17 19:03:06 +02:00
committed by
KUOKA Yusuke
parent
72c43a2f46
commit
1acd07fa7e
@@ -0,0 +1,44 @@
|
||||
package helmexec
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
type HelmContext struct {
|
||||
Tillerless bool
|
||||
TillerNamespace string
|
||||
WorkerIndex int
|
||||
}
|
||||
|
||||
func (context *HelmContext) GetTillerlessArgs(helmBinary string) []string {
|
||||
if context.Tillerless {
|
||||
if context.TillerNamespace != "" {
|
||||
return []string{"tiller", "run", context.TillerNamespace, "--", helmBinary}
|
||||
} else {
|
||||
return []string{"tiller", "run", "--", helmBinary}
|
||||
}
|
||||
} else {
|
||||
return []string{}
|
||||
}
|
||||
}
|
||||
|
||||
func (context *HelmContext) getTillerlessEnv() map[string]string {
|
||||
if context.Tillerless {
|
||||
result := map[string]string{
|
||||
"HELM_TILLER_SILENT": "true",
|
||||
// Changing the TILLER port doesn't really work: https://github.com/helm/helm/issues/3159
|
||||
// So this is not used for the moment.
|
||||
// "HELM_TILLER_PORT": strconv.Itoa(44134 + context.WorkerIndex),
|
||||
}
|
||||
if config := os.Getenv("KUBECONFIG"); config != "" {
|
||||
absConfig, err := filepath.Abs(config)
|
||||
if err == nil {
|
||||
result["KUBECONFIG"] = absConfig
|
||||
}
|
||||
}
|
||||
return result
|
||||
} else {
|
||||
return map[string]string{}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user