feat: wait until helm charts are installed before marking a deploy as failed or completed
This ensures applications are actually up vs giving a false sense of security to users about the state of their applications.
This commit is contained in:
@@ -226,6 +226,7 @@ func applyKedaClusterTriggerAuthentications(ctx context.Context, triggerType str
|
||||
ReleaseName: fmt.Sprintf("keda-cluster-trigger-authentications-%s", triggerType),
|
||||
RollbackOnFailure: true,
|
||||
Timeout: timeoutDuration,
|
||||
Wait: true,
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error installing keda-cluster-trigger-authentications-%s chart: %w", triggerType, err)
|
||||
@@ -333,6 +334,7 @@ func applyClusterIssuers(ctx context.Context) error {
|
||||
ReleaseName: "cluster-issuers",
|
||||
RollbackOnFailure: true,
|
||||
Timeout: timeoutDuration,
|
||||
Wait: true,
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error installing cluster-issuer chart: %w", err)
|
||||
@@ -1398,6 +1400,11 @@ func installHelmCharts(ctx context.Context, clientset KubernetesClient, shouldIn
|
||||
return fmt.Errorf("Error creating helm agent: %w", err)
|
||||
}
|
||||
|
||||
timeoutDuration, err := time.ParseDuration("300s")
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error parsing deploy timeout duration: %w", err)
|
||||
}
|
||||
|
||||
err = helmAgent.InstallOrUpgradeChart(ctx, ChartInput{
|
||||
ChartPath: chart.ChartPath,
|
||||
Namespace: chart.Namespace,
|
||||
@@ -1405,6 +1412,8 @@ func installHelmCharts(ctx context.Context, clientset KubernetesClient, shouldIn
|
||||
RepoURL: chart.RepoURL,
|
||||
Values: values,
|
||||
Version: chart.Version,
|
||||
Timeout: timeoutDuration,
|
||||
Wait: true,
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error installing chart %s: %w", chart.ChartPath, err)
|
||||
|
||||
@@ -51,6 +51,7 @@ type ChartInput struct {
|
||||
RepoURL string
|
||||
RollbackOnFailure bool
|
||||
Timeout time.Duration
|
||||
Wait bool
|
||||
Version string
|
||||
Values map[string]interface{}
|
||||
}
|
||||
@@ -239,7 +240,7 @@ func (h *HelmAgent) InstallChart(ctx context.Context, input ChartInput) error {
|
||||
client.Namespace = namespace
|
||||
client.ReleaseName = input.ReleaseName
|
||||
client.Timeout = input.Timeout
|
||||
client.Wait = false
|
||||
client.Wait = input.Wait
|
||||
|
||||
settings := cli.New()
|
||||
if input.RepoURL != "" {
|
||||
@@ -314,7 +315,7 @@ func (h *HelmAgent) UpgradeChart(ctx context.Context, input ChartInput) error {
|
||||
client.MaxHistory = 10
|
||||
client.Namespace = namespace
|
||||
client.Timeout = input.Timeout
|
||||
client.Wait = false
|
||||
client.Wait = input.Wait
|
||||
if input.RepoURL != "" {
|
||||
client.RepoURL = input.RepoURL
|
||||
}
|
||||
|
||||
@@ -594,6 +594,7 @@ func TriggerSchedulerDeploy(scheduler string, appName string, imageTag string) e
|
||||
ReleaseName: appName,
|
||||
RollbackOnFailure: allowRollbacks,
|
||||
Timeout: timeoutDuration,
|
||||
Wait: true,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -44,11 +44,6 @@ teardown_() {
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "sleep 20"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
assert_http_localhost_response "http" "$TEST_APP.dokku.me" "80" "" "python/http.server"
|
||||
|
||||
# include autoscaling tests
|
||||
@@ -128,11 +123,6 @@ teardown_() {
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "sleep 20"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
assert_http_localhost_response "http" "$TEST_APP.dokku.me" "80" "" "python/http.server"
|
||||
|
||||
run /bin/bash -c "kubectl get pods -o=jsonpath='{.items[*]..resources.requests.cpu}'"
|
||||
@@ -182,11 +172,6 @@ teardown_() {
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "sleep 20"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
assert_http_localhost_response "http" "$TEST_APP.dokku.me" "80" "" "python/http.server"
|
||||
}
|
||||
|
||||
@@ -237,11 +222,6 @@ teardown_() {
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "sleep 20"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
assert_http_localhost_response "http" "$TEST_APP.dokku.me" "80" "" "python/http.server"
|
||||
|
||||
run /bin/bash -c "kubectl get deployment $TEST_APP-web -o json | jq -r '.metadata.annotations.\"test.dokku.com/resource-type\"'"
|
||||
|
||||
@@ -668,8 +668,6 @@ install_k3s() {
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
sleep 20
|
||||
}
|
||||
|
||||
uninstall_k3s() {
|
||||
|
||||
Reference in New Issue
Block a user