-
Notifications
You must be signed in to change notification settings - Fork 4
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
fix: Updated the code to copy the prerenderdata into another variable #43
Conversation
func GetPreRenderData(labels map[string]string) map[string]map[string]string { | ||
preRenderData := make(map[string]map[string]string) | ||
for key, value := range clusterData { | ||
preRenderData[key] = value |
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.
So now clusterData is available to render the values ? Is there any specific
field needed in that ?
I think the field in question was {{application.instance}}
which still should come from application labels.
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.
yea so I renamed prerenderdata to clusterdata as I can see it probably caused confusion. With this change the preRenderData will now have all the cluster level data and the application level data. The change was to copy the original prerenderdata(now named as clusterdata) into another variable since the original clusterdata map was an instance variable and was supposed to hold only cluster level data and its updates from the informer. It shouldnt be updated with application details.
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.
Hope this made sense?
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.
I therefore did two things:
- renamed prerenderdata to cluster data - to make it clear that it is cluster data
- Copied the instance variable cluster data into a local variable and to this local variable, add the application data as well. This local variable will now serve the template rendering for all cluster and application values.
So, when a new application is updated, since its loading the local variable at runtime, it will always have the application specific details for that release
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.
previously it was adding application details directly to the instance variable which lives permanently as long overwhelm is running. So if new applications are released that have missing labels (like release instance for e.g.,) will not update the instance variable and old data will be rendered into the new release which was one of the issues they were facing
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.
also theres no need to store all the application details in memory which was happening before
📝 Description
🔗 Related Issues