merge the list of resources from custom checks and the generated cont… #727
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
…roller list before deduplicating them
This PR fixes #
Controllers being shown twice in the Polaris dashboard:
Currently the logic used by the Polaris dashboard collects all existing pods of the live cluster. It will then keep check for the parent controller by checking the ownerrefences. Once the ultimate parent controller has been found that does not have any ownerreference it will be added to a list. Every pod will return a "ultimate" parent controller. Because multiple pods can belong to the same controller, this list of controllers will be "deduplicated" by an internal function. Finally this list will be added to the final list of the controllers to be shown in the dashboard.
At the same time, Polaris dashboard allows for custom checks to be defined. We are using this functionality to perform custom checks on kubernetes custom resource definitions like elasticsearch. All these resources (which can also be controllers such as for example elasticsearch) will then be added to the final list of the controllers to be shown in the dashboard.
The controllers are only being deduplicated in case 1. This means that in the case of pods being created by operators that are watching crds we are ending up with duplicate controllers in the dashboard. First, polaris will find that the ultimate controller of the elasticsearch pods is the elasticsearch crd. Then, we also use custom checks to validate the contents of these elasticsearch crds, they will be added again. In this PR I propose to first merge the list of kubernetes resources from case 1 and case 2 and deduplicate the combined list.
Checklist
Description
What's the goal of this PR?
Ensure that custom checks defined in Polaris against crds that create pods do not result in Polaris dashboard showing controllers twice.
What changes did you make?
What alternative solution should we consider, if any?
Possibly rename of rethink some of the variables or function names.