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

Controller triggers only when App Conn module in status was updated #66

Merged
merged 3 commits into from
Dec 15, 2023

Conversation

mvshao
Copy link
Contributor

@mvshao mvshao commented Dec 13, 2023

Description
For now, the controller is looking for the Application Connector module in status field, but we encountered a bug, that PR will fix.

Changes proposed in this pull request:

  • when status on Kyma CR is updated the controller is not triggered unless changes are related to application-connector module name

Related issue(s)

@mvshao mvshao added the area/application-connector Issues or PRs related to application connectivity label Dec 13, 2023
@mvshao mvshao requested a review from a team as a code owner December 13, 2023 12:51
@kyma-bot kyma-bot added cla: yes Indicates the PR's author has signed the CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Dec 13, 2023
func (cm *CompassManagerReconciler) needsToBeReconciledUpdate(oldObj, newObj runtime.Object) bool {
oldKymaObj, ok := oldObj.(*kyma.Kyma)
if !ok {
cm.Log.Error("Unexpected type detected. Old object is supposed to be of the Kyma type.")
Copy link

@tobiscr tobiscr Dec 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we maybe also print the current type of the object? Just to know better why the casting failed.

}
newKymaObj, ok := newObj.(*kyma.Kyma)
if !ok {
cm.Log.Error("Unexpected type detected. New object is supposed to be of the Kyma type.")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

}

func getModuleNames(modules []kyma.ModuleStatus) []string {
var result []string
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For performance reasons, using a map would avoid the looping over arrays - probably a bit more memory expensive as a plain array, but I asume the amount of modules will probably never grow to several thousands.

e.g.

cache := make (map[string]bool,len(modules))
for _, item := range modules {
    cache[item.Name] = true
}

//checking for an entry in the map
if _, exists := cache["modulename"]; !exists {  fmt.Println("This module doens't exist") }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we postpone this implementation for a while?

@kyma-bot kyma-bot added the lgtm Looks good to me! label Dec 15, 2023
@kyma-bot kyma-bot merged commit 9911c06 into kyma-project:main Dec 15, 2023
7 checks passed
@Disper Disper assigned koala7659, m00g3n and mvshao and unassigned m00g3n and tobiscr Dec 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/application-connector Issues or PRs related to application connectivity cla: yes Indicates the PR's author has signed the CLA. lgtm Looks good to me! size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants