-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
auto-delete pods on becoming unavailable
- Loading branch information
Showing
6 changed files
with
41 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
shared/src/main/java/net/chrotos/ingress/minecraft/Pod.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package net.chrotos.ingress.minecraft; | ||
|
||
import io.kubernetes.client.openapi.ApiException; | ||
import io.kubernetes.client.openapi.apis.CoreV1Api; | ||
import io.kubernetes.client.openapi.models.V1Pod; | ||
|
||
public class Pod { | ||
private final V1Pod pod; | ||
private final CoreV1Api api; | ||
|
||
protected Pod(V1Pod pod, CoreV1Api api) { | ||
this.pod = pod; | ||
this.api = api; | ||
} | ||
|
||
public V1Pod getPod() { | ||
return this.pod; | ||
} | ||
|
||
public void delete() { | ||
try { | ||
api.deleteNamespacedPod(pod.getMetadata().getName(), pod.getMetadata().getNamespace(), null, null, | ||
null, null, null, null); | ||
} catch (ApiException ignored) {} | ||
} | ||
} |
4 changes: 1 addition & 3 deletions
4
shared/src/main/java/net/chrotos/ingress/minecraft/PodRessourceHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
package net.chrotos.ingress.minecraft; | ||
|
||
import io.kubernetes.client.openapi.models.V1Pod; | ||
|
||
@FunctionalInterface | ||
public interface PodRessourceHandler { | ||
void onEventReceived(V1Pod pod, boolean deleted) throws Throwable; | ||
void onEventReceived(Pod pod, boolean deleted) throws Throwable; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters