Skip to content

Deadlocks while ensuring resources

When transitioning from a version of the operator that deployed DeploymentConfig -> Deployment, I observed the DrupalSites stuck in this status:

  status:
    conditions:
    - lastTransitionTime: "2021-02-24T14:55:48Z"
      status: "True"
      type: Installed
    - lastTransitionTime: "2021-03-11T18:33:59Z"
      message: 'k8sAPIClientError: %v: for PHP-FPM CM: k8sAPIClientError: Failed to
        roll out new deployment while updating the PHP-FPM configMap (deployment not
        found): Deployment.apps "drupal-test-ideasquare" not found'
      reason: k8sAPIClientError
      status: "False"
      type: Ready

I deleted the DeploymentConfig, but the Deployment wasn't being created. On closer inspection, it turns out the Deployment is only created after the configmap has been ensured: https://gitlab.cern.ch/drupal/paas/drupalsite-operator/-/blob/master/controllers/drupalsite_resources.go#L161

The serial logic creates deadlocks. All resources need to be ensured in the same reconciliation.