Skip to content

Commit 476763d

Browse files
authored
Merge pull request #26 from Tedyst/master
Distinguish between booleans and strings correctly
2 parents ae91806 + b1be2a9 commit 476763d

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

pkg/helm/controller.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,9 @@ func args(chart *helmv1.HelmChart) []string {
333333

334334
for _, k := range keys(spec.Set) {
335335
val := spec.Set[k]
336-
if val.StrVal != "" {
336+
if val.StrVal == "false" || val.StrVal == "true" {
337+
args = append(args, "--set", fmt.Sprintf("%s=%s", k, val.StrVal))
338+
} else if val.StrVal != "" {
337339
args = append(args, "--set-string", fmt.Sprintf("%s=%s", k, val.StrVal))
338340
} else {
339341
args = append(args, "--set", fmt.Sprintf("%s=%d", k, val.IntVal))

pkg/helm/controller_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func TestDeleteJob(t *testing.T) {
3232
func TestInstallArgs(t *testing.T) {
3333
assert := assert.New(t)
3434
stringArgs := strings.Join(args(NewChart()), " ")
35-
assert.Equal("install --set-string rbac.enabled=true --set-string ssl.enabled=true", stringArgs)
35+
assert.Equal("install --set-string acme.dnsProvider.name=cloudflare --set rbac.enabled=true --set ssl.enabled=false", stringArgs)
3636
}
3737

3838
func TestDeleteArgs(t *testing.T) {
@@ -47,7 +47,8 @@ func TestDeleteArgs(t *testing.T) {
4747
func NewChart() *v1.HelmChart {
4848
var set = make(map[string]intstr.IntOrString)
4949
set["rbac.enabled"] = intstr.IntOrString{StrVal: "true"}
50-
set["ssl.enabled"] = intstr.IntOrString{StrVal: "true"}
50+
set["ssl.enabled"] = intstr.IntOrString{StrVal: "false"}
51+
set["acme.dnsProvider.name"] = intstr.IntOrString{StrVal: "cloudflare"}
5152

5253
return v1.NewHelmChart("kube-system", "traefik", v1.HelmChart{
5354
Spec: v1.HelmChartSpec{

0 commit comments

Comments
 (0)