From 6a73cc9598727a5d73d452fd635d1933b1c51851 Mon Sep 17 00:00:00 2001 From: Uday Bhaskar Date: Tue, 17 Mar 2026 18:30:47 +0530 Subject: [PATCH] GPUOP-583 584 ANR fixes (#1202) * GPUOP-584 fix workflow step conditions * GPUOP-583 truncate job name to 63 chars (cherry picked from commit 462d45556a37b53342bdee6f74d1c5eb1714873d) --- .../controllers/remediation/scripts/test.sh | 23 +++++++++++++++++-- internal/controllers/remediation_handler.go | 4 ++-- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/internal/controllers/remediation/scripts/test.sh b/internal/controllers/remediation/scripts/test.sh index 4981f9b4..beccc6d1 100644 --- a/internal/controllers/remediation/scripts/test.sh +++ b/internal/controllers/remediation/scripts/test.sh @@ -1,7 +1,26 @@ set -e NODE_NAME='{{inputs.parameters.node_name}}' -JOB_NAME="{{workflow.name}}-test-run" -CM_NAME='{{workflow.name}}-test-configmap' + +# Generate a unique job name under 63 characters +# Format: --test +WORKFLOW_NAME='{{workflow.name}}' +WORKFLOW_UID='{{workflow.uid}}' + +# Extract last 8 characters of workflow UID for uniqueness +SHORT_UID="${WORKFLOW_UID: -8}" + +# Calculate max length for workflow name prefix (63 - 8 (uid) - 1 (dash) - 5 ("-test") - 1 (dash) = 48) +MAX_PREFIX_LEN=48 + +# Truncate workflow name if needed +if [ ${#WORKFLOW_NAME} -gt $MAX_PREFIX_LEN ]; then + WORKFLOW_PREFIX="${WORKFLOW_NAME:0:$MAX_PREFIX_LEN}" +else + WORKFLOW_PREFIX="$WORKFLOW_NAME" +fi + +JOB_NAME="${WORKFLOW_PREFIX}-${SHORT_UID}-test" +CM_NAME="${WORKFLOW_PREFIX}-${SHORT_UID}-cm" FRAMEWORK='{{inputs.parameters.framework}}' RECIPE='{{inputs.parameters.recipe}}' ITERATIONS='{{inputs.parameters.iterations}}' diff --git a/internal/controllers/remediation_handler.go b/internal/controllers/remediation_handler.go index 760f59ec..6689b39b 100644 --- a/internal/controllers/remediation_handler.go +++ b/internal/controllers/remediation_handler.go @@ -643,7 +643,7 @@ func (h *remediationMgrHelper) createDefaultWorkflowTemplate(ctx context.Context Name: "inbuilt", Metadata: instanceIDMeta, Steps: []workflowv1alpha1.ParallelSteps{ - {Steps: []workflowv1alpha1.WorkflowStep{{Name: "autostart", Template: "suspend", When: "{{workflow.parameters.auto_start}} == 'false'"}}}, // If auto start is disabled, workflow will be created in suspended state and needs to be manually resumed by user + {Steps: []workflowv1alpha1.WorkflowStep{{Name: "autostart", Template: "suspend", When: "{{workflow.parameters.auto_start}} == false"}}}, // If auto start is disabled, workflow will be created in suspended state and needs to be manually resumed by user {Steps: []workflowv1alpha1.WorkflowStep{{Name: "applylabels", Template: "applylabels"}}}, {Steps: []workflowv1alpha1.WorkflowStep{{Name: "taint", Template: "taint"}}}, {Steps: []workflowv1alpha1.WorkflowStep{{Name: "drain", Template: "drain"}}}, @@ -662,7 +662,7 @@ func (h *remediationMgrHelper) createDefaultWorkflowTemplate(ctx context.Context }, }, {Steps: []workflowv1alpha1.WorkflowStep{{Name: "suspend", Template: "suspend"}}}, - {Steps: []workflowv1alpha1.WorkflowStep{{Name: "reboot", Template: "reboot", ContinueOn: &workflowv1alpha1.ContinueOn{Failed: true}, When: "{{workflow.parameters.skipRebootStep}} == 'false'"}}}, + {Steps: []workflowv1alpha1.WorkflowStep{{Name: "reboot", Template: "reboot", ContinueOn: &workflowv1alpha1.ContinueOn{Failed: true}, When: "{{workflow.parameters.skipRebootStep}} == false"}}}, {Steps: []workflowv1alpha1.WorkflowStep{{Name: "test", Template: "test", ContinueOn: &workflowv1alpha1.ContinueOn{Failed: true}}}}, {Steps: []workflowv1alpha1.WorkflowStep{ {