diff --git a/docs/environment-variables.md b/docs/environment-variables.md index 9799684660cd..97047be31df9 100644 --- a/docs/environment-variables.md +++ b/docs/environment-variables.md @@ -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. | diff --git a/workflow/controller/retry_tweak.go b/workflow/controller/retry_tweak.go index 2c20279f9264..2157551daad9 100644 --- a/workflow/controller/retry_tweak.go +++ b/workflow/controller/retry_tweak.go @@ -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" ) @@ -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) }