mirror of
https://github.com/floci-io/floci.git
synced 2026-11-22 21:50:46 -05:00
fix(eks): keep a cluster in CREATING until k3s has deployed its addons (#8283)
This commit is contained in:
1 parent
57c7462846
commit
fdb4a811ba
1 file changed
+13
-1
@@ -1217,12 +1217,24 @@ public class EksClusterManager
|
||||
disableSslVerification(https);
|
||||
}
|
||||
int code = conn.getResponseCode();
|
||||
return code == 200 || code == 401 || code == 403;
|
||||
return (code == 200 || code == 401 || code == 403) && addonsDeployed(cluster.getContainerId());
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* k3s creates its Addon objects only after its embedded CRDs are established. A k3s stopped
|
||||
* before that leaves a CRD unestablished for good, and every later start waits on it forever.
|
||||
*/
|
||||
private boolean addonsDeployed(String containerId) {
|
||||
ContainerExec.Result addons = execInContainerForResult(containerId,
|
||||
new String[]{"kubectl", "--request-timeout=2s", "get", "addons.k3s.cattle.io",
|
||||
"-n", "kube-system", "-o", "name"}, 10);
|
||||
return addons.exitCode() == 0 && addons.stdout() != null
|
||||
&& addons.stdout().contains("addon.k3s.cattle.io/");
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts the kubeconfig from the running k3s container, rewrites the server URL,
|
||||
* and sets the certificate authority data on the cluster.
|
||||
|
||||
Reference in new issue
Block a user