-
Notifications
You must be signed in to change notification settings - Fork 8
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
Conversation
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.") |
There was a problem hiding this comment.
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.") |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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") }
There was a problem hiding this comment.
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?
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:
status
on Kyma CR is updated the controller is not triggered unless changes are related toapplication-connector
module nameRelated issue(s)