use of io.kubernetes.client.openapi.models.V1ConfigMapList in project twister2 by DSC-SPIDAL.
the class KubernetesController method existConfigMap.
/**
* return true if there is already a ConfigMap object with the same name on Kubernetes master,
* otherwise return false
*/
public boolean existConfigMap(String jobID) {
String configMapName = jobID;
V1ConfigMapList configMapList = null;
try {
configMapList = coreApi.listNamespacedConfigMap(namespace, null, null, null, null, null, null, null, null, null);
} catch (ApiException e) {
LOG.log(Level.SEVERE, "Exception when getting ConfigMap list.", e);
throw new RuntimeException(e);
}
for (V1ConfigMap configMap : configMapList.getItems()) {
if (configMapName.equals(configMap.getMetadata().getName())) {
return true;
}
}
return false;
}
Aggregations