Skip to content

Commit 88383f4

Browse files
authored
Feat: Adding Defaults() to util/helm (#182)
Signed-off-by: Daniel Hu <[email protected]>
1 parent b253e6d commit 88383f4

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

docs/argocd_plugin.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ tools:
3131
namespace: argocd
3232
# whether to wait for the release to be deployed or not
3333
wait: true
34-
# the time to wait for any individual Kubernetes operation (like Jobs for hooks)
34+
# the time to wait for any individual Kubernetes operation (like Jobs for hooks). This defaults to 5m0s
3535
timeout: 5m
3636
# whether to perform a CRD upgrade during installation
3737
upgradeCRDs: true

docs/kube-prometheus_plugin.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ tools:
3333
namespace: monitoring
3434
# whether to wait for the release to be deployed or not
3535
wait: true
36-
# the time to wait for any individual Kubernetes operation (like Jobs for hooks)
36+
# the time to wait for any individual Kubernetes operation (like Jobs for hooks). This defaults to 5m0s
3737
timeout: 5m
3838
# whether to perform a CRD upgrade during installation
3939
upgradeCRDs: true

pkg/util/helm/validation.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ package helm
33
import "fmt"
44

55
func Validate(param *HelmParam) []error {
6+
Defaults(param)
7+
68
retErrors := make([]error, 0)
79

810
if param.Repo.Name == "" {
@@ -17,3 +19,12 @@ func Validate(param *HelmParam) []error {
1719

1820
return retErrors
1921
}
22+
23+
// Defaults set the default value with HelmParam.
24+
// TODO(daniel-hutao): don't call this function insides the Validate()
25+
func Defaults(param *HelmParam) {
26+
if param.Chart.Timeout == "" {
27+
// Make the timeout be same as the default value for `--timeout` with `helm install/upgrade/rollback`
28+
param.Chart.Timeout = "5m0s"
29+
}
30+
}

0 commit comments

Comments
 (0)