fix(core): include instanceCounts when fetching project clusters, fix ClassCastException for gce and appengine fetch cluster methods
MODIFY
clouddriver-appengine/src/main/groovy/com/netflix/spinnaker/clouddriver/appengine/provider/view/AppengineClusterProvider.groovy
clouddriver-appengine/src/main/groovy/com/netflix/spinnaker/clouddriver/appengine/provider/view/AppengineClusterProvider.groovy
@@ -98,12 +98,12 @@ class AppengineClusterProvider implements ClusterProvider<AppengineCluster> {
@Override
Map<String, Set<AppengineCluster>> getClusterSummaries(String applicationName) {
- translateClusters(getClusterData(applicationName), false)?.groupBy { it.accountName } as Map<String, Set<AppengineCluster>>
+ translateClusters(getClusterData(applicationName), false)?.groupBy { it.accountName }.collectEntries { k, v -> [k, new HashSet<>(v)] }
}
@Override
Map<String, Set<AppengineCluster>> getClusterDetails(String applicationName) {
- translateClusters(getClusterData(applicationName), true)?.groupBy { it.accountName } as Map<String, Set<AppengineCluster>>
+ translateClusters(getClusterData(applicationName), true)?.groupBy { it.accountName }.collectEntries { k, v -> [k, new HashSet<>(v)] }
}
Set<CacheData> getClusterData(String applicationName) {

MODIFY
clouddriver-core/src/main/groovy/com/netflix/spinnaker/clouddriver/core/ProjectClustersService.java
clouddriver-core/src/main/groovy/com/netflix/spinnaker/clouddriver/core/ProjectClustersService.java
@@ -222,12 +222,14 @@ public class ProjectClustersService {
public String stack;
public String detail;
public List<ApplicationClusterModel> applications;
+ public ServerGroup.InstanceCounts instanceCounts;
public ClusterModel(String account, String stack, String detail, List<ApplicationClusterModel> applications) {
this.account = account;
this.stack = stack;
this.detail = detail;
this.applications = applications;
+ this.instanceCounts = getInstanceCounts();
}
ServerGroup.InstanceCounts getInstanceCounts() {

MODIFY
clouddriver-google/src/main/groovy/com/netflix/spinnaker/clouddriver/google/provider/view/GoogleClusterProvider.groovy
clouddriver-google/src/main/groovy/com/netflix/spinnaker/clouddriver/google/provider/view/GoogleClusterProvider.groovy
@@ -68,12 +68,12 @@ class GoogleClusterProvider implements ClusterProvider<GoogleCluster.View> {
@Override
Map<String, Set<GoogleCluster.View>> getClusterDetails(String applicationName) {
- getClusters(applicationName, true /* detailed */)
+ getClusters(applicationName, true /* detailed */).collectEntries { k, v -> [k, new HashSet<>(v)] }
}
@Override
Map<String, Set<GoogleCluster.View>> getClusterSummaries(String applicationName) {
- getClusters(applicationName, false /* detailed */)
+ getClusters(applicationName, false /* detailed */).collectEntries { k, v -> [k, new HashSet<>(v)] }
}
Map<String, Set<GoogleCluster.View>> getClusters(String applicationName, boolean includeInstanceDetails) {

fix(core): include instanceCounts when fetching project clusters, fix ClassCastException for gce and appengine fetch cluster methods (#3244)