The SAS® Viya® Deployment Operator reconcile job fails with a "jobs.batch sas-pyconfig-cjinitial already exists" error


The SAS Viya Deployment Operator fails to reconcile a SASDeployment custom resource. The sasdeployment is in a FAILED state.  When this issue occurs, the logs from the sas-deployment-operator-reconcile jobs contain the following error:

kubectl create job --namespace esp-viya --from cronjob/sas-pyconfig sas-pyconfig-cjinitial
error: failed to create job: jobs.batch \"sas-pyconfig-cjinitial\" already exists 

The sas-deployment-operator-reconcile job log shows that actions are repeated twice. The sas-pyconfig-cjinitial job is created successfully the first time but fails the second time. 

Cause

This error occurs when the SASDeployment custom resource contains multiple sas-bases directories.

When you run the sas-orchestartion create sas-deployment-cr command, all files in the user-content directory are added to the SASDeployment custom resource. The user-content directory is expected to contain the sas-bases directory extracted from the deployment assets, the site-config directory, and the kustomization.yaml file. If a directory ends in sas-bases, an entry is added for the directory, but the contents of this directory are omitted from the SASDeployment custom resource.  

The SAS Deployment Operator does not expect to have multiple sas-bases directories in the SASDeployment custom resource. 

Resolution

Move or rename any sas-bases directories other than the sas-bases directory created by extracting the deployment assets. Then, re-run the sas-orchestartion create sas-deployment-cr command, and apply the SASDeployment custom resource.