Java Code Examples for io.fabric8.kubernetes.client.dsl.FilterWatchListDeletable#delete()

The following examples show how to use io.fabric8.kubernetes.client.dsl.FilterWatchListDeletable#delete() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: KubernetesAppDeployer.java    From spring-cloud-deployer-kubernetes with Apache License 2.0 5 votes vote down vote up
private void deleteService(Map<String, String> labels) {
	FilterWatchListDeletable<Service, ServiceList, Boolean, Watch, Watcher<Service>> servicesToDelete =
			client.services().withLabels(labels);

	if (servicesToDelete != null && servicesToDelete.list().getItems() != null) {
		boolean servicesDeleted = servicesToDelete.delete();
		logger.debug(String.format("Service deleted for: %s - %b", labels, servicesDeleted));
	}
}
 
Example 2
Source File: KubernetesAppDeployer.java    From spring-cloud-deployer-kubernetes with Apache License 2.0 5 votes vote down vote up
private void deleteDeployment(Map<String, String> labels) {
	FilterWatchListDeletable<Deployment, DeploymentList, Boolean, Watch, Watcher<Deployment>> deploymentsToDelete =
			client.apps().deployments().withLabels(labels);

	if (deploymentsToDelete != null && deploymentsToDelete.list().getItems() != null) {
		boolean deploymentsDeleted = deploymentsToDelete.delete();
		logger.debug(String.format("Deployment deleted for: %s - %b", labels, deploymentsDeleted));
	}
}
 
Example 3
Source File: KubernetesAppDeployer.java    From spring-cloud-deployer-kubernetes with Apache License 2.0 5 votes vote down vote up
private void deleteStatefulSet(Map<String, String> labels) {
	FilterWatchListDeletable<StatefulSet, StatefulSetList, Boolean, Watch, Watcher<StatefulSet>> ssToDelete =
			client.apps().statefulSets().withLabels(labels);

	if (ssToDelete != null && ssToDelete.list().getItems() != null) {
		boolean ssDeleted = ssToDelete.delete();
		logger.debug(String.format("StatefulSet deleted for: %s - %b", labels, ssDeleted));
	}
}
 
Example 4
Source File: KubernetesAppDeployer.java    From spring-cloud-deployer-kubernetes with Apache License 2.0 5 votes vote down vote up
private void deletePod(Map<String, String> labels) {
	FilterWatchListDeletable<Pod, PodList, Boolean, Watch, Watcher<Pod>> podsToDelete = client.pods()
			.withLabels(labels);

	if (podsToDelete != null && podsToDelete.list().getItems() != null) {
		boolean podsDeleted = podsToDelete.delete();
		logger.debug(String.format("Pod deleted for: %s - %b", labels, podsDeleted));
	}
}
 
Example 5
Source File: KubernetesAppDeployer.java    From spring-cloud-deployer-kubernetes with Apache License 2.0 5 votes vote down vote up
private void deletePvc(Map<String, String> labels) {
	FilterWatchListDeletable<PersistentVolumeClaim, PersistentVolumeClaimList, Boolean, Watch,
			Watcher<PersistentVolumeClaim>> pvcsToDelete = client.persistentVolumeClaims()
			.withLabels(labels);

	if (pvcsToDelete != null && pvcsToDelete.list().getItems() != null) {
		boolean pvcsDeleted = pvcsToDelete.delete();
		logger.debug(String.format("PVC deleted for: %s - %b", labels, pvcsDeleted));
	}
}
 
Example 6
Source File: KubernetesTaskLauncher.java    From spring-cloud-deployer-kubernetes with Apache License 2.0 5 votes vote down vote up
private void deleteJob(String id) {
	FilterWatchListDeletable<Job, JobList, Boolean, Watch, Watcher<Job>> jobsToDelete = client.batch().jobs()
			.withLabel(SPRING_APP_KEY, id);

	if (jobsToDelete != null && jobsToDelete.list().getItems() != null) {
		logger.debug(String.format("Deleting Job for task: %s", id));
		boolean jobDeleted = jobsToDelete.delete();
		logger.debug(String.format("Job deleted for: %s - %b", id, jobDeleted));
	}
}
 
Example 7
Source File: KubernetesTaskLauncher.java    From spring-cloud-deployer-kubernetes with Apache License 2.0 5 votes vote down vote up
private void deletePod(String id) {
	FilterWatchListDeletable<Pod, PodList, Boolean, Watch, Watcher<Pod>> podsToDelete = client.pods()
			.withLabel(SPRING_APP_KEY, id);

	if (podsToDelete != null && podsToDelete.list().getItems() != null) {
		logger.debug(String.format("Deleting Pod for task: %s", id));
		boolean podsDeleted = podsToDelete.delete();
		logger.debug(String.format("Pod deleted for: %s - %b", id, podsDeleted));
	}
}