-
Notifications
You must be signed in to change notification settings - Fork 55
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
3. Adding Recommendation Updater Abstraction and VPA Updater [KRUIZE-VPA Integration] #1412
3. Adding Recommendation Updater Abstraction and VPA Updater [KRUIZE-VPA Integration] #1412
Conversation
Signed-off-by: Shekhar Saxena <[email protected]>
a46287c
to
9e1d5e0
Compare
Signed-off-by: Shekhar Saxena <[email protected]>
Signed-off-by: Shekhar Saxena <[email protected]>
Signed-off-by: Shekhar Saxena <[email protected]>
@bharathappali @msvinaykumar Can you please review this PR, thanks |
src/main/java/com/autotune/analyzer/recommendations/updater/vpa/VpaUpdaterImpl.java
Outdated
Show resolved
Hide resolved
src/main/java/com/autotune/analyzer/recommendations/updater/vpa/VpaUpdaterImpl.java
Show resolved
Hide resolved
src/main/java/com/autotune/analyzer/recommendations/updater/vpa/VpaUpdaterImpl.java
Outdated
Show resolved
Hide resolved
src/main/java/com/autotune/analyzer/recommendations/updater/vpa/VpaUpdaterImpl.java
Outdated
Show resolved
Hide resolved
src/main/java/com/autotune/analyzer/recommendations/updater/vpa/VpaUpdaterImpl.java
Outdated
Show resolved
Hide resolved
src/main/java/com/autotune/analyzer/recommendations/updater/vpa/VpaUpdaterImpl.java
Outdated
Show resolved
Hide resolved
src/main/java/com/autotune/analyzer/recommendations/updater/vpa/VpaUpdaterImpl.java
Outdated
Show resolved
Hide resolved
src/main/java/com/autotune/analyzer/recommendations/updater/vpa/VpaUpdaterImpl.java
Outdated
Show resolved
Hide resolved
src/main/java/com/autotune/analyzer/recommendations/updater/vpa/VpaUpdaterImpl.java
Outdated
Show resolved
Hide resolved
src/main/java/com/autotune/analyzer/recommendations/updater/vpa/VpaUpdaterImpl.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Shekhar Saxena <[email protected]>
Hi @bharathappali , I’ve pushed the changes incorporating the modifications and suggestions you provided. Thank you for your review and valuable feedback. Could you please review it again? Thank you! |
Signed-off-by: Shekhar Saxena <[email protected]>
Signed-off-by: Shekhar Saxena <[email protected]>
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.
LGTM!
try { | ||
// checks if updater is installed or not | ||
if (isUpdaterInstalled()) { | ||
LOGGER.info(String.format(AnalyzerConstants.RecommendationUpdaterConstants.InfoMsgs.CREATEING_VPA, kruizeObject.getExperimentName())); |
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.
This might create too much logging if we are apply VPA for every object in the cluster. I'd suggest make it LOGGER.debug. Only error's should be logged by default
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.
Agree. I've updated the info
messages to debug
messages which are experiment specific. Thanks for pointing out.
LOGGER.info(String.format(AnalyzerConstants.RecommendationUpdaterConstants.InfoMsgs.RECOMMENDATION_VALUE, | ||
AnalyzerConstants.RecommendationItem.CPU, containerName, cpuRecommendationValue)); | ||
LOGGER.info(String.format(AnalyzerConstants.RecommendationUpdaterConstants.InfoMsgs.RECOMMENDATION_VALUE, | ||
AnalyzerConstants.RecommendationItem.MEMORY, containerName, memoryRecommendationValue)); |
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.
LOGGER.debug
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.
Updated to use debug
messages.
LOGGER.info(String.format(AnalyzerConstants.RecommendationUpdaterConstants.InfoMsgs.CHECKING_IF_VPA_PRESENT, vpaName)); | ||
NamespacedVerticalPodAutoscalerClient client = new DefaultVerticalPodAutoscalerClient(); | ||
VerticalPodAutoscalerList vpas = client.v1().verticalpodautoscalers().inAnyNamespace().list(); | ||
|
||
if (null != vpas && null != vpas.getItems() && !vpas.getItems().isEmpty()) { | ||
for (VerticalPodAutoscaler vpa : vpas.getItems()) { | ||
if (vpaName.equals(vpa.getMetadata().getName())) { | ||
LOGGER.info(String.format(AnalyzerConstants.RecommendationUpdaterConstants.InfoMsgs.VPA_WITH_NAME_FOUND, vpaName)); | ||
return vpa; | ||
} | ||
} | ||
} | ||
LOGGER.info(String.format(AnalyzerConstants.RecommendationUpdaterConstants.InfoMsgs.VPA_WITH_NAME_NOT_FOUND, vpaName)); |
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.
This is called while applying recommendations right? Please use LOGGER.debug everywhere
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.
Yes, as we discussed, it will verify before applying the recommendations or before creating the vpa objects.
} | ||
} | ||
} | ||
LOGGER.info(String.format(AnalyzerConstants.RecommendationUpdaterConstants.InfoMsgs.VPA_WITH_NAME_NOT_FOUND, vpaName)); |
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.
This should be LOGGER.error right? Others should be debug
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.
Updated this one to error
message.
@Override | ||
public boolean isUpdaterInstalled() { | ||
try { | ||
LOGGER.info(AnalyzerConstants.RecommendationUpdaterConstants.InfoMsgs.CHECKING_IF_UPDATER_INSTALLED, |
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.
General rule to follow, only log it as info
if it is a rare occurence, eg once per kruize start. All other items which are on a per experiment basis should only be logged as debug
unless there is a justification
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.
Thanks for pointing it out @dinogun! I’ve updated the info
logs to debug
messages and ensured that only error
messages are logged by default. I’ll ensure this in future implementations also.
Signed-off-by: Shekhar Saxena <[email protected]>
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.
LGTM
Description
This PR introduces a basic abstraction for the
RecommendationUpdater
.RecommendationUpdater
interface is created, with a generic implementation provided byRecommendationUpdaterImpl
.VpaUpdaterImpl
extendsRecommendationUpdaterImpl
to offer a VPA-specific implementation for updating resource recommendations.Type of change
How has this been tested?
Tested on both the ResourceHub cluster and the Kind cluster to verify any issues.
Test Configuration
Kubernetes clusters tested on: ResourceHub (OpenShift), Kind
Checklist 🎯
Additional information
This PR is based on PR#1411. Please merge PR#1411 before this one.