mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
refactor(docker): share one Docker reachability probe across the container managers (#8951)
This commit is contained in:
1 parent
3b695e25d2
commit
b388616273
19 files changed
+73
-104
No files matched your search
@@ -1583,6 +1583,20 @@ public class ContainerLifecycleManager {
|
||||
return resolveContainerIp(inspect, preferredNetwork);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the Docker daemon answers a ping, which is how a missing daemon is told apart from a
|
||||
* container that failed for its own reasons. The one probe the container-backed services share.
|
||||
*/
|
||||
public boolean isDockerReachable() {
|
||||
try {
|
||||
dockerClient.pingCmd().exec();
|
||||
return true;
|
||||
} catch (RuntimeException e) {
|
||||
LOG.debugv("Docker daemon is not reachable: {0}", e.getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the underlying control-plane DockerClient for operations not covered by this
|
||||
* manager. Prefer using manager methods when available. A stream that stays open for a
|
||||
|
||||
@@ -95,13 +95,7 @@ public class DocDbContainerManager {
|
||||
* container that failed for its own reasons.
|
||||
*/
|
||||
public boolean isDockerReachable() {
|
||||
try {
|
||||
lifecycleManager.getDockerClient().pingCmd().exec();
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
LOG.debugv("Docker daemon is not reachable: {0}", e.getMessage());
|
||||
return false;
|
||||
}
|
||||
return lifecycleManager.isDockerReachable();
|
||||
}
|
||||
|
||||
public DocDbContainerHandle start(String clusterId, String image, String masterUsername, String masterPassword,
|
||||
|
||||
@@ -710,13 +710,7 @@ public class EksClusterManager
|
||||
* k3s container that failed for its own reasons.
|
||||
*/
|
||||
public boolean isDockerReachable() {
|
||||
try {
|
||||
lifecycleManager.getDockerClient().pingCmd().exec();
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
LOG.debugv("Docker daemon is not reachable: {0}", e.getMessage());
|
||||
return false;
|
||||
}
|
||||
return lifecycleManager.isDockerReachable();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-7
@@ -128,13 +128,7 @@ public class ElastiCacheContainerManager {
|
||||
* container that failed for its own reasons.
|
||||
*/
|
||||
public boolean isDockerReachable() {
|
||||
try {
|
||||
lifecycleManager.getDockerClient().pingCmd().exec();
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
LOG.debugv("Docker daemon is not reachable: {0}", e.getMessage());
|
||||
return false;
|
||||
}
|
||||
return lifecycleManager.isDockerReachable();
|
||||
}
|
||||
|
||||
public ElastiCacheContainerHandle start(String groupId, String image, String region) {
|
||||
|
||||
+1
-7
@@ -106,13 +106,7 @@ public class ElastiCacheMemcachedContainerManager {
|
||||
* container that failed for its own reasons.
|
||||
*/
|
||||
public boolean isDockerReachable() {
|
||||
try {
|
||||
lifecycleManager.getDockerClient().pingCmd().exec();
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
LOG.debugv("Docker daemon is not reachable: {0}", e.getMessage());
|
||||
return false;
|
||||
}
|
||||
return lifecycleManager.isDockerReachable();
|
||||
}
|
||||
|
||||
/** {@code region} is null for a cluster recorded without one, which then counts as the default region's. */
|
||||
|
||||
+1
-7
@@ -115,13 +115,7 @@ public class MemoryDbContainerManager {
|
||||
* container that failed for its own reasons.
|
||||
*/
|
||||
public boolean isDockerReachable() {
|
||||
try {
|
||||
lifecycleManager.getDockerClient().pingCmd().exec();
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
LOG.debugv("Docker daemon is not reachable: {0}", e.getMessage());
|
||||
return false;
|
||||
}
|
||||
return lifecycleManager.isDockerReachable();
|
||||
}
|
||||
|
||||
public MemoryDbContainerHandle start(String clusterName, String image) {
|
||||
|
||||
@@ -124,13 +124,7 @@ public class RedpandaManager {
|
||||
* container that failed for its own reasons.
|
||||
*/
|
||||
public boolean isDockerReachable() {
|
||||
try {
|
||||
lifecycleManager.getDockerClient().pingCmd().exec();
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
LOG.debugv("Docker daemon is not reachable: {0}", e.getMessage());
|
||||
return false;
|
||||
}
|
||||
return lifecycleManager.isDockerReachable();
|
||||
}
|
||||
|
||||
public void startContainer(MskCluster cluster) {
|
||||
|
||||
@@ -98,13 +98,7 @@ public class NeptuneContainerManager {
|
||||
* container that failed for its own reasons.
|
||||
*/
|
||||
public boolean isDockerReachable() {
|
||||
try {
|
||||
lifecycleManager.getDockerClient().pingCmd().exec();
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
LOG.debugv("Docker daemon is not reachable: {0}", e.getMessage());
|
||||
return false;
|
||||
}
|
||||
return lifecycleManager.isDockerReachable();
|
||||
}
|
||||
|
||||
public NeptuneContainerHandle start(String clusterId, String image, NeptuneDbType dbType,
|
||||
|
||||
@@ -89,13 +89,7 @@ public class OpenSearchDomainManager {
|
||||
* container that failed for its own reasons.
|
||||
*/
|
||||
public boolean isDockerReachable() {
|
||||
try {
|
||||
lifecycleManager.getDockerClient().pingCmd().exec();
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
LOG.debugv("Docker daemon is not reachable: {0}", e.getMessage());
|
||||
return false;
|
||||
}
|
||||
return lifecycleManager.isDockerReachable();
|
||||
}
|
||||
|
||||
public void startDomain(Domain domain) {
|
||||
|
||||
@@ -240,13 +240,7 @@ public class RdsContainerManager implements RdsBackendGate, RdsBackendEndpointRe
|
||||
* container that failed for its own reasons.
|
||||
*/
|
||||
public boolean isDockerReachable() {
|
||||
try {
|
||||
lifecycleManager.getDockerClient().pingCmd().exec();
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
LOG.debugv("Docker daemon is not reachable: {0}", e.getMessage());
|
||||
return false;
|
||||
}
|
||||
return lifecycleManager.isDockerReachable();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-7
@@ -79,13 +79,7 @@ public class TimestreamInfluxDbContainerManager implements ContainerTeardown {
|
||||
}
|
||||
|
||||
public boolean isDockerReachable() {
|
||||
try {
|
||||
lifecycleManager.getDockerClient().pingCmd().exec();
|
||||
return true;
|
||||
} catch (RuntimeException e) {
|
||||
LOG.debugv("Docker daemon is not reachable: {0}", e.getMessage());
|
||||
return false;
|
||||
}
|
||||
return lifecycleManager.isDockerReachable();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user