Skip to content

Commit

Permalink
Adds constants for each api version in kruize, and changes the list r…
Browse files Browse the repository at this point in the history
…ecommendation SO to have specific version of API rather than having the kruize object version

Signed-off-by: bharathappali <[email protected]>
  • Loading branch information
bharathappali committed Nov 3, 2023
1 parent b929706 commit 3866b67
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public KruizeObject(String experimentName,

StringBuilder error = ValidateKruizeObject.validate(map);
if (error.toString().isEmpty()) {
this.apiVersion = AnalyzerConstants.VersionConstants.CURRENT_KRUIZE_OBJECT_VERSION;
this.experimentName = experimentName;
this.mode = mode;
this.targetCluster = targetCluster;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public static ListRecommendationsAPIObject convertKruizeObjectToListRecommendati
Timestamp monitoringEndTime) {
ListRecommendationsAPIObject listRecommendationsAPIObject = new ListRecommendationsAPIObject();
try {
listRecommendationsAPIObject.setApiVersion(kruizeObject.getApiVersion());
listRecommendationsAPIObject.setApiVersion(AnalyzerConstants.VersionConstants.APIVersionConstants.CURRENT_LIST_RECOMMENDATIONS_VERSION);
listRecommendationsAPIObject.setExperimentName(kruizeObject.getExperimentName());
listRecommendationsAPIObject.setClusterName(kruizeObject.getClusterName());
List<KubernetesAPIObject> kubernetesAPIObjects = new ArrayList<>();
Expand Down Expand Up @@ -190,7 +190,7 @@ public static ListRecommendationsAPIObject convertKruizeObjectToListRecommendati
String monitoringEndTimestamp) {
ListRecommendationsAPIObject listRecommendationsAPIObject = new ListRecommendationsAPIObject();
try {
listRecommendationsAPIObject.setApiVersion(kruizeObject.getApiVersion());
listRecommendationsAPIObject.setApiVersion(AnalyzerConstants.VersionConstants.APIVersionConstants.CURRENT_LIST_RECOMMENDATIONS_VERSION);
listRecommendationsAPIObject.setExperimentName(kruizeObject.getExperimentName());
listRecommendationsAPIObject.setClusterName(kruizeObject.getClusterName());
List<KubernetesAPIObject> kubernetesAPIObjects = new ArrayList<>();
Expand Down
16 changes: 16 additions & 0 deletions src/main/java/com/autotune/analyzer/utils/AnalyzerConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -531,4 +531,20 @@ private BooleanString() {

}
}

public static final class VersionConstants {
public static final class APIVersionConstants {
public static final String CURRENT_CREATE_EXPERIMENT_VERSION = "v1.0";
public static final String CURRENT_UPDATE_RESULTS_VERSION = "v1.0";
public static final String CURRENT_LIST_RECOMMENDATIONS_VERSION = "v2.0";
public static final String CURRENT_UPDATE_RECOMMENDATIONS_VERSION = "v2.0";
private APIVersionConstants() {

}
}
public static final String CURRENT_KRUIZE_OBJECT_VERSION = "v1.0";
private VersionConstants() {

}
}
}

0 comments on commit 3866b67

Please sign in to comment.