Always use the default kubeconfig file path [#20]

This commit is contained in:
Erin Call
2019-12-23 12:43:17 -08:00
parent 80b26434f5
commit 4755f502b5
10 changed files with 42 additions and 57 deletions

View File

@@ -19,8 +19,7 @@ type Config struct {
Prefix string `` // Prefix to use when looking up secret env vars
// Global helm config
Debug bool `` // global helm flag (also applies to drone-helm itself)
KubeConfig string `split_words:"true" default:"/root/.kube/config"` // path to the kube config file
Debug bool `` // global helm flag (also applies to drone-helm itself)
Values string ``
StringValues string `split_words:"true"`
ValuesFiles []string `split_words:"true"`

View File

@@ -6,7 +6,10 @@ import (
"os"
)
const kubeConfigTemplate = "/root/.kube/config.tpl"
const (
kubeConfigTemplate = "/root/.kube/config.tpl"
kubeConfigFile = "/root/.kube/config"
)
// A Step is one step in the plan.
type Step interface {
@@ -27,7 +30,6 @@ func NewPlan(cfg Config) (*Plan, error) {
cfg: cfg,
runCfg: run.Config{
Debug: cfg.Debug,
KubeConfig: cfg.KubeConfig,
Values: cfg.Values,
StringValues: cfg.StringValues,
ValuesFiles: cfg.ValuesFiles,
@@ -141,6 +143,7 @@ func initKube(cfg Config) []Step {
ServiceAccount: cfg.ServiceAccount,
Token: cfg.KubeToken,
TemplateFile: kubeConfigTemplate,
ConfigFile: kubeConfigFile,
},
}
}

View File

@@ -32,7 +32,6 @@ func (suite *PlanTestSuite) TestNewPlan() {
cfg := Config{
Command: "help",
Debug: false,
KubeConfig: "/branch/.sfere/profig",
Values: "steadfastness,forthrightness",
StringValues: "tensile_strength,flexibility",
ValuesFiles: []string{"/root/price_inventory.yml"},
@@ -41,7 +40,6 @@ func (suite *PlanTestSuite) TestNewPlan() {
runCfg := run.Config{
Debug: false,
KubeConfig: "/branch/.sfere/profig",
Values: "steadfastness,forthrightness",
StringValues: "tensile_strength,flexibility",
ValuesFiles: []string{"/root/price_inventory.yml"},
@@ -142,6 +140,7 @@ func (suite *PlanTestSuite) TestDel() {
ServiceAccount: "greathelm",
Token: "b2YgbXkgYWZmZWN0aW9u",
TemplateFile: kubeConfigTemplate,
ConfigFile: kubeConfigFile,
}
suite.Equal(expected, init)
@@ -176,6 +175,7 @@ func (suite *PlanTestSuite) TestInitKube() {
ServiceAccount: "helmet",
Token: "cXVlZXIgY2hhcmFjdGVyCg==",
TemplateFile: kubeConfigTemplate,
ConfigFile: kubeConfigFile,
}
suite.Equal(expected, init)
}