Skip to content

Commit

Permalink
New KW Wait For Deployment Replica To Be Ready for oc_install.robot
Browse files Browse the repository at this point in the history
This Keyword waits for all pods with a specified label in a specified
deployment, to have the Replica-Set ready (desired pods running)

Signed-off-by: manosnoam <[email protected]>
  • Loading branch information
manosnoam committed Sep 30, 2024
1 parent 5c0f422 commit dca338b
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 69 deletions.
111 changes: 42 additions & 69 deletions ods_ci/tasks/Resources/RHODS_OLM/install/oc_install.robot
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,8 @@ Verify RHODS Installation
Set Global Variable ${DASHBOARD_APP_NAME} ${PRODUCT.lower()}-dashboard
Log Verifying RHODS installation console=yes
Log To Console Waiting for all RHODS resources to be up and running
Wait For Pods Numbers 1
... namespace=${OPERATOR_NAMESPACE}
... label_selector=name=${OPERATOR_NAME_LABEL}
... timeout=2000
Wait For Deployment Replica To Be Ready namespace=${OPERATOR_NAMESPACE}
... label_selector=name=${OPERATOR_NAME_LABEL} timeout=2000s
Wait For Pods Status namespace=${OPERATOR_NAMESPACE} timeout=1200
Log Verified ${OPERATOR_NAMESPACE} console=yes

Expand All @@ -99,85 +97,57 @@ Verify RHODS Installation
END
Apply DataScienceCluster CustomResource dsc_name=${DSC_NAME}
END

${dashboard} = Is Component Enabled dashboard ${DSC_NAME}
IF ("${UPDATE_CHANNEL}" == "stable" or "${UPDATE_CHANNEL}" == "beta") or "${dashboard}" == "true"
# Needs to be removed ASAP
IF "${PRODUCT}" == "ODH"
Log To Console Waiting for 2 pods in ${APPLICATIONS_NAMESPACE}, label_selector=app=odh-dashboard
Wait For Pods Numbers 2
... namespace=${APPLICATIONS_NAMESPACE}
... label_selector=app=odh-dashboard
... timeout=1200
Wait For Deployment Replica To Be Ready namespace=${APPLICATIONS_NAMESPACE}
... label_selector=app=odh-dashboard timeout=1200s
#This line of code is strictly used for the exploratory cluster to accommodate UI/UX team requests
Add UI Admin Group To Dashboard Admin

ELSE
Log To Console Waiting for 5 pods in ${APPLICATIONS_NAMESPACE}, label_selector=app=${DASHBOARD_APP_NAME}
Wait For Pods Numbers 5
... namespace=${APPLICATIONS_NAMESPACE}
... label_selector=app=${DASHBOARD_APP_NAME}
... timeout=1200
Wait For Deployment Replica To Be Ready namespace=${APPLICATIONS_NAMESPACE}
... label_selector=app=${DASHBOARD_APP_NAME} timeout=1200s
END
END

${workbenches} = Is Component Enabled workbenches ${DSC_NAME}
IF ("${UPDATE_CHANNEL}" == "stable" or "${UPDATE_CHANNEL}" == "beta") or "${workbenches}" == "true"
Log To Console Waiting for 1 pod in ${APPLICATIONS_NAMESPACE}, label_selector=app=notebook-controller
Wait For Pods Numbers 1
... namespace=${APPLICATIONS_NAMESPACE}
... label_selector=app=notebook-controller
... timeout=400
Log To Console Waiting for 1 pod in ${APPLICATIONS_NAMESPACE}, label_selector=app=odh-notebook-controller
Wait For Pods Numbers 1
... namespace=${APPLICATIONS_NAMESPACE}
... label_selector=app=odh-notebook-controller
... timeout=400
Wait For Deployment Replica To Be Ready namespace=${APPLICATIONS_NAMESPACE}
... label_selector=app=notebook-controller timeout=400s
Wait For Deployment Replica To Be Ready namespace=${APPLICATIONS_NAMESPACE}
... label_selector=app=odh-notebook-controller timeout=400s
END

${modelmeshserving} = Is Component Enabled modelmeshserving ${DSC_NAME}
IF ("${UPDATE_CHANNEL}" == "stable" or "${UPDATE_CHANNEL}" == "beta") or "${modelmeshserving}" == "true"
Log To Console Waiting for 3 pods in ${APPLICATIONS_NAMESPACE}, label_selector=app=odh-model-controller
Wait For Pods Numbers 3
... namespace=${APPLICATIONS_NAMESPACE}
... label_selector=app=odh-model-controller
... timeout=400
Log To Console Waiting for 1 pod in ${APPLICATIONS_NAMESPACE}, label_selector=component=model-mesh-etcd
Wait For Pods Numbers 1
... namespace=${APPLICATIONS_NAMESPACE}
... label_selector=component=model-mesh-etcd
... timeout=400
Log To Console Waiting for 3 pods in ${APPLICATIONS_NAMESPACE}, label_selector=app.kubernetes.io/name=modelmesh-controller
Wait For Pods Numbers 3
... namespace=${APPLICATIONS_NAMESPACE}
... label_selector=app.kubernetes.io/name=modelmesh-controller
... timeout=400
Wait For Deployment Replica To Be Ready namespace=${APPLICATIONS_NAMESPACE}
... label_selector=app=odh-model-controller timeout=400s
Wait For Deployment Replica To Be Ready namespace=${APPLICATIONS_NAMESPACE}
... label_selector=component=model-mesh-etcd timeout=400s
Wait For Deployment Replica To Be Ready namespace=${APPLICATIONS_NAMESPACE}
... label_selector=app.kubernetes.io/name=modelmesh-controller timeout=400s
END

${datasciencepipelines} = Is Component Enabled datasciencepipelines ${DSC_NAME}
IF ("${UPDATE_CHANNEL}" == "stable" or "${UPDATE_CHANNEL}" == "beta") or "${datasciencepipelines}" == "true"
Log To Console Waiting for 1 pod in ${APPLICATIONS_NAMESPACE}, label_selector=app.kubernetes.io/name=data-science-pipelines-operator
Wait For Pods Numbers 1
... namespace=${APPLICATIONS_NAMESPACE}
... label_selector=app.kubernetes.io/name=data-science-pipelines-operator
... timeout=400
Wait For Deployment Replica To Be Ready namespace=${APPLICATIONS_NAMESPACE}
... label_selector=app.kubernetes.io/name=data-science-pipelines-operator timeout=400s
END

${modelregistry} = Is Component Enabled modelregistry ${DSC_NAME}
IF "${modelregistry}" == "true"
Log To Console Waiting for 1 pod in ${APPLICATIONS_NAMESPACE}, label_selector=app.kubernetes.io/part-of=model-registry-operator
Wait For Pods Numbers 1
... namespace=${APPLICATIONS_NAMESPACE}
... label_selector=app.kubernetes.io/part-of=model-registry-operator
... timeout=400
Wait For Deployment Replica To Be Ready namespace=${APPLICATIONS_NAMESPACE}
... label_selector=app.kubernetes.io/part-of=model-registry-operator timeout=400s
END

${kserve} = Is Component Enabled kserve ${DSC_NAME}
IF "${kserve}" == "true"
Log To Console Waiting for 3 pods in ${APPLICATIONS_NAMESPACE}, label_selector=app=odh-model-controller
Wait For Pods Numbers 3
... namespace=${APPLICATIONS_NAMESPACE}
... label_selector=app=odh-model-controller
... timeout=400
Log To Console Waiting for 1 pods in ${APPLICATIONS_NAMESPACE}, label_selector=control-plane=kserve-controller-manager
Wait For Pods Numbers 1
... namespace=${APPLICATIONS_NAMESPACE}
... label_selector=control-plane=kserve-controller-manager
... timeout=400
Wait For Deployment Replica To Be Ready namespace=${APPLICATIONS_NAMESPACE}
... label_selector=app=odh-model-controller timeout=400s
Wait For Deployment Replica To Be Ready namespace=${APPLICATIONS_NAMESPACE}
... label_selector=control-plane=kserve-controller-manager timeout=400s
END

IF ("${UPDATE_CHANNEL}" == "stable" or "${UPDATE_CHANNEL}" == "beta") or "${dashboard}" == "true" or "${workbenches}" == "true" or "${modelmeshserving}" == "true" or "${datasciencepipelines}" == "true" # robocop: disable
Expand Down Expand Up @@ -226,15 +196,18 @@ Install RHODS In Managed Cluster Using CLI
Wait For Pods Numbers
[Documentation] Wait for number of pod during installtion
[Arguments] ${count} ${namespace} ${label_selector} ${timeout}
${output} = Wait Until Keyword Succeeds ${timeout}s 3s Run And Verify Command
... oc wait -n ${namespace} --for condition\=ready pod -l "${label_selector}" --timeout\=${timeout}s print_to_log=${FALSE}
Log To Console ${output}
${result} = Run Process oc get pod -n ${namespace} -l ${label_selector} | tail -n +2 | wc -l shell=true
Log To Console ${result.stdout}/${count} pods created with label ${label_selector} in ${namespace} namespace
IF ${result.stdout} != ${count}
Log To Console [WARN] Timeout exceeded for all ${count} pods to be ready. Verifying if desired ReplicaSet created STDERR
Run Keyword And Continue On Failure Run And Verify Command
... oc get deployment -l ${label_selector} -n ${namespace} -o json | jq -e '.status | .replicas \=\= .readyReplicas'
${status} Set Variable False
FOR ${counter} IN RANGE ${timeout}
${return_code} ${output} Run And Return Rc And Output oc get pod -n ${namespace} -l ${label_selector} | tail -n +2 | wc -l
IF ${output} == ${count}
${status} Set Variable True
Log To Console pods ${label_selector} created
BREAK
END
Sleep 1 sec
END
IF '${status}' == 'False'
Run Keyword And Continue On Failure FAIL Timeout- ${output} pods found with the label selector ${label_selector} in ${namespace} namespace
END

Apply DSCInitialization CustomResource
Expand Down
10 changes: 10 additions & 0 deletions ods_ci/tests/Resources/OCP.resource
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,16 @@ Wait For Pods To Be Ready
Length Should Be ${replicas} ${exp_replicas}
END

Wait For Deployment Replica To Be Ready
[Documentation] Wait for Deployment of ${label_selector} in ${namespace} to have the Replica-Set Ready
[Arguments] ${namespace} ${label_selector} ${timeout}=600s
Log To Console Waiting for Deployment with label "${label_selector}" in Namespace "${namespace}", to have desired Replica-Set

Check warning

Code scanning / Robocop

Line is too long ({{ line_length }}/{{ allowed_length }}) Warning test

Line is too long (130/120)
${output} = Wait Until Keyword Succeeds ${timeout} 3s Run And Verify Command

Check warning

Code scanning / Robocop

The assignment sign is not consistent within the file. Expected '{{ expected_sign }}' but got '{{ actual_sign }}' instead Warning test

The assignment sign is not consistent within the file. Expected '=' but got ' =' instead

Check notice

Code scanning / Robocop

Variable '{{ name }}' is assigned but not used Note test

Variable '${output}' is assigned but not used
... oc wait -n ${namespace} --for condition\=ready pod -l "${label_selector}" --timeout\=${timeout}
... print_to_log=${FALSE}
Run And Verify Command
... oc get deployment -l ${label_selector} -n ${namespace} -o json | jq -e '.status | .replicas \=\= .readyReplicas'

Check warning

Code scanning / Robocop

Line is too long ({{ line_length }}/{{ allowed_length }}) Warning test

Line is too long (121/120)

Wait For Pods To Succeed
[Arguments] ${label_selector} ${namespace} ${timeout}=300s ${exp_replicas}=${NONE}
Wait Until Keyword Succeeds ${timeout} 3s
Expand Down

0 comments on commit dca338b

Please sign in to comment.