Skip to content

Commit 65a5b07

Browse files
author
Jan Kleinert
committed
Added support for Deployments
1 parent a6c8b8a commit 65a5b07

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/main/java/com/openshift/k8svisualizer/controllers/APIController.java

+6
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ public List<PlatformObject> getServices() {
4949
return helper.getServices();
5050
}
5151

52+
@RequestMapping("/getDeployments")
53+
public List<PlatformObject> getDeployments() {
54+
PlatformObjectHelper helper = new PlatformObjectHelper();
55+
return helper.getDeployments();
56+
}
57+
5258
@CrossOrigin
5359
@RequestMapping("/deleteObject")
5460
public void deletePlatformObject(@RequestParam(value = "gameID") String gameID,

src/main/java/com/openshift/k8svisualizer/helpers/PlatformObjectHelper.java

+11
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import java.util.Random;
66
import com.openshift.k8svisualizer.models.PlatformObject;
77
import com.openshift.k8svisualizer.models.PlatformObjectPod;
8+
import io.fabric8.kubernetes.api.model.extensions.Deployment;
89
import io.fabric8.kubernetes.api.model.PersistentVolumeClaim;
910
import io.fabric8.kubernetes.api.model.Pod;
1011
import io.fabric8.kubernetes.api.model.Service;
@@ -38,6 +39,7 @@ public List<PlatformObject> getPlatformObjects() {
3839
platformObjects.addAll(this.getPVs());
3940
platformObjects.addAll(this.getServices());
4041
platformObjects.addAll(this.getRoutes());
42+
platformObjects.addAll(this.getDeployments());
4143

4244
return platformObjects;
4345

@@ -121,6 +123,15 @@ public List<PlatformObject> getServices() {
121123
return theList;
122124
}
123125

126+
public List<PlatformObject> getDeployments() {
127+
ArrayList<PlatformObject> theList = new ArrayList<>();
128+
List<Deployment> theItems = client.extensions().deployments().withLabel(labelName, labelValue).list().getItems();
129+
for (Deployment currConfig : theItems) {
130+
theList.add(new PlatformObject(currConfig.getMetadata().getUid(), currConfig.getMetadata().getName(),
131+
"DEPLOYMENT"));
132+
}
133+
return theList;
134+
}
124135
private List<PlatformObject> getRoutes() {
125136
ArrayList<PlatformObject> theList = new ArrayList<>();
126137
List<Route> theItems = client.routes().list().getItems();

0 commit comments

Comments
 (0)