Skip to content

Commit

Permalink
feat(controller): Allow configurable host name label key when retryin…
Browse files Browse the repository at this point in the history
…g different hosts (#6341)

Signed-off-by: Yuan Tang <[email protected]>
  • Loading branch information
terrytangyuan authored Jul 19, 2021
1 parent bd5a8a9 commit d6ec032
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Note that these environment variables may be removed at any time.
| `RETRY_BACKOFF_DURATION` | `time.Duration` | `10ms` | The retry backoff duration when retrying API calls. |
| `RETRY_BACKOFF_FACTOR` | `float` | `2.0` | The retry backoff factor when retrying API calls. |
| `RETRY_BACKOFF_STEPS` | `int` | `5` | The retry backoff steps when retrying API calls. |
| `RETRY_HOST_NAME_LABEL_KEY` | `string` | `kubernetes.io/hostname` | The label key for host name used when retrying templates. |
| `TRANSIENT_ERROR_PATTERN` | `string` | `""` | The regular expression that represents additional patterns for transient errors. |
| `WF_DEL_PROPAGATION_POLICY` | `string` | `""` | The deletion propagation policy for workflows. |
| `WORKFLOW_GC_PERIOD` | `time.Duration` | `5m` | The periodicity for GC of workflows. |
Expand Down
4 changes: 3 additions & 1 deletion workflow/controller/retry_tweak.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package controller

import (
"k8s.io/utils/env"

wfv1 "github.com/argoproj/argo-workflows/v3/pkg/apis/workflow/v1alpha1"
wfretry "github.com/argoproj/argo-workflows/v3/workflow/util/retry"
)
Expand All @@ -15,7 +17,7 @@ func RetryOnDifferentHost(retryNodeName string) RetryTweak {
return
}
hostNames := wfretry.GetFailHosts(nodes, retryNodeName)
hostLabel := "kubernetes.io/hostname"
hostLabel := env.GetString("RETRY_HOST_NAME_LABEL_KEY", "kubernetes.io/hostname")
if hostLabel != "" && len(hostNames) > 0 {
tmpl.Affinity = wfretry.AddHostnamesToAffinity(hostLabel, hostNames, tmpl.Affinity)
}
Expand Down

0 comments on commit d6ec032

Please sign in to comment.