@@ -380,6 +380,10 @@ deleteParallelUpgradeCheckerResources() {
380380}
381381
382382
383+ # Enables debug logging and set smaller size for services log file in the operator pod to make it easier to
384+ # troubleshoot issues in CI.
385+ # The method for patching the deployment depends on the OLM version, which is detected by checking for the presence
386+ # of a subscription (OLMv0) or clusterextension (OLMv1).
383387enable_debug_logging () {
384388 if [[ $( oc get -n $WMCO_DEPLOY_NAMESPACE pod -l name=windows-machine-config-operator -ojson) == * " --debugLogging" * ]]; then
385389 echo " Debug logging already enabled"
@@ -390,13 +394,16 @@ enable_debug_logging() {
390394 WMCO_SUB=$( oc get sub -n " $WMCO_DEPLOY_NAMESPACE " --no-headers 2> /dev/null | awk ' {print $1}' )
391395 if [[ -n " $WMCO_SUB " ]]; then
392396 echo " Detected OLMv0, patching subscription $WMCO_SUB "
393- oc patch subscription $WMCO_SUB -n $WMCO_DEPLOY_NAMESPACE --type=merge -p ' {"spec":{"config":{"env":[{"name":"ARGS","value":"--debugLogging"}]}}}'
397+ oc patch subscription $WMCO_SUB -n $WMCO_DEPLOY_NAMESPACE --type=merge -p ' {"spec":{"config":{"env":[{"name":"ARGS","value":"--debugLogging"},{"name":"SERVICES_LOG_FILE_SIZE","value":"1M"} ]}}}'
394398 # delete the deployment to ensure the changes are picked up in a timely matter
395399 oc delete deployment -n $WMCO_DEPLOY_NAMESPACE windows-machine-config-operator
396400 elif oc get clusterextension windows-machine-config-operator & > /dev/null; then
397401 echo " Detected OLMv1, patching deployment directly..."
398- # Add debug env variable to the WMCO manager container
399- oc set env deployment/windows-machine-config-operator -n " $WMCO_DEPLOY_NAMESPACE " ARGS=" --debugLogging" -c manager
402+ # Add debug env variable and log file limit to the WMCO manager container
403+ oc set env deployment/windows-machine-config-operator -n " $WMCO_DEPLOY_NAMESPACE " \
404+ ARGS=" --debugLogging" \
405+ SERVICES_LOG_FILE_SIZE=" 1M" \
406+ -c manager
400407 # force restart to pick up the env variable change
401408 oc scale deployment/windows-machine-config-operator -n " $WMCO_DEPLOY_NAMESPACE " --replicas=0
402409 oc scale deployment/windows-machine-config-operator -n " $WMCO_DEPLOY_NAMESPACE " --replicas=1
0 commit comments