Pass --ca-file to helm upgrade when applicable [#74]

This commit is contained in:
Erin Call
2020-01-20 10:47:49 -08:00
parent 1f7b6bb389
commit c38537ac32
5 changed files with 10 additions and 1 deletions

View File

@@ -111,6 +111,7 @@ var upgrade = func(cfg Config) []Step {
Force: cfg.Force,
Atomic: cfg.AtomicUpgrade,
CleanupOnFail: cfg.CleanupOnFail,
CAFile: cfg.RepoCAFile,
})
return steps

View File

@@ -143,6 +143,7 @@ func (suite *PlanTestSuite) TestUpgrade() {
Force: true,
AtomicUpgrade: true,
CleanupOnFail: true,
RepoCAFile: "state_licensure.repo.cert",
}
steps := upgrade(cfg)
@@ -166,6 +167,7 @@ func (suite *PlanTestSuite) TestUpgrade() {
Force: cfg.Force,
Atomic: true,
CleanupOnFail: true,
CAFile: "state_licensure.repo.cert",
}
suite.Equal(expected, upgrade)

View File

@@ -20,6 +20,7 @@ type Upgrade struct {
Force bool
Atomic bool
CleanupOnFail bool
CAFile string
cmd cmd
}
@@ -82,6 +83,9 @@ func (u *Upgrade) Prepare(cfg Config) error {
for _, vFile := range u.ValuesFiles {
args = append(args, "--values", vFile)
}
if u.CAFile != "" {
args = append(args, "--ca-file", u.CAFile)
}
args = append(args, u.Release, u.Chart)
u.cmd = command(helmBin, args...)

View File

@@ -102,6 +102,7 @@ func (suite *UpgradeTestSuite) TestPrepareWithUpgradeFlags() {
Force: true,
Atomic: true,
CleanupOnFail: true,
CAFile: "local_ca.cert",
}
cfg := Config{}
@@ -121,6 +122,7 @@ func (suite *UpgradeTestSuite) TestPrepareWithUpgradeFlags() {
"--set-string", "height=5ft10in",
"--values", "/usr/local/stats",
"--values", "/usr/local/grades",
"--ca-file", "local_ca.cert",
"maroon_5_memories", "hot_ac"}, args)
return suite.mockCmd