Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Operator has a chance of not cleaning up what it can #837

Open
KevinJCross opened this issue Aug 23, 2022 · 0 comments
Open

Operator has a chance of not cleaning up what it can #837

KevinJCross opened this issue Aug 23, 2022 · 0 comments
Labels
backlog Will be taken care of when time allows bug

Comments

@KevinJCross
Copy link
Contributor

KevinJCross commented Aug 23, 2022

Operator could be missing removing policies from dead apps.

on line 46 of application syncer function Operate()
We exit early rather than continuing over the rest of the list. This could cause a single continuous failure in the db to create a buildup of autoscaler policies without apps.

func (as ApplicationSynchronizer) Operate() {
	// Get all the application details from policyDB
	appIds, err := as.policyDb.GetAppIds()
	if err != nil {
		as.logger.Error("failed-to-get-apps", err)
		return
	}
	// For each app check if they really exist or not via CC api call
	for appID := range appIds {
		_, err = as.cfClient.GetApp(appID)
		if err != nil {
			as.logger.Error("failed-to-get-app-info", err)
			if models.IsNotFound(err) {
				// Application does not exist, lets clean up app details from policyDB
				err = as.policyDb.DeletePolicy(appID)
				if err != nil {
					as.logger.Error("failed-to-prune-non-existent-application-details", err)
	>>> here 		//TODO make this a continue and write a test.
					return
				}
				as.logger.Info("successfully-pruned-non-existent-applcation", lager.Data{"appid": appID})
			}
		}
	}
}
@silvestre silvestre added the backlog Will be taken care of when time allows label Sep 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog Will be taken care of when time allows bug
Projects
None yet
Development

No branches or pull requests

2 participants