Autogenerated Applications Cannot be Deleted w/ onlySpinnakerManaged set to false


Issue

When enabling onlySpinnakerManaged: false applications will be generated to populate the Spinnaker console based on the Kubernetes environment and account assigned in the Accounts declaration of either the Halyard (https://docs.armory.io/docs/armory-admin/kubernetes-account-add/#how-spinnaker-operates-when-deploying-to-kubernetes-targets) or Operator (https://docs.armory.io/docs/installation/operator-reference/providers/#account-parameters-8) configuration.

The ingestion and creation of these Autogenerated Applications Placeholders is based on the naming convention of resources in Kubernetes

Attempting to manage or delete the applications can sometimes lead to the following displayed error where The application tenant has not been configured is displayed and the application cannot be deleted

Cause

The way this legacy item works is if set to false, is that it will then attempt configure applications for resources in Kubernetes, based on what the Spinnaker environment is able to see. 

However, this feature can end up picking up information incorrectly and attempt to populate the Spinnaker environment with Autogenerated Applications Placeholders that were unintended.  The application doesn't actually exist, and then the Autogenerated Applications Placeholders are misconfigured and do not correlate to resources properly.  If changes are also made to the Kubernetes cluster, this will further complicate things by causing the error message above

Making things more difficult is that MySQL doesn't have an automatic cleanup to remove these misconfigured Autogernerated applications, unlike in REDIS, which can have an auto expiry set that will respect the change of the onlySpinnakerManaged value back to true.

Solution

Resolving this issue is a bit complicated.  There are a few options to resolve this issue, but in general, it is recommended that to remove complications, to try and use true as the value for onlySpinnakerManaged. This will stop these issues from occurring in the future.  

Once that value is set, cleanup can be done in a few ways:

  • If the environment is still in its infancy, it is possible to delete the database and start with a new database.  Ensure that any pipeline information is copied/exported as a JSON and these pipelines can then easily be used to recreate the necessary pipelines in the new environment
  • It is also possible to perform a cleanup of the database to remove the applications and pipelines that exist within the environment.  Within a REDIS environment, cleanup can occur with an auto expiry set on the database values.  Within a MySQL environment, a query should be created to remove the Autogenerated applications and pipelines

As Tested On Version

2.22.x