kalavai-client 0.5.15__py3-none-any.whl → 0.5.17__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
kalavai_client/cluster.py CHANGED
@@ -10,7 +10,16 @@ from kalavai_client.utils import (
10
10
  populate_template
11
11
  )
12
12
 
13
- from kalavai_client.env import user_path
13
+ from kalavai_client.env import (
14
+ DEFAULT_CONTAINER_NAME,
15
+ KUBE_VERSION,
16
+ DEFAULT_FLANNEL_IFACE,
17
+ USER_COMPOSE_FILE,
18
+ USER_KUBECONFIG_FILE,
19
+ USER_LOCAL_SERVER_FILE,
20
+ USER_HELM_APPS_FILE,
21
+ user_path
22
+ )
14
23
 
15
24
 
16
25
  class Cluster(ABC):
@@ -125,7 +134,7 @@ class dockerCluster(Cluster):
125
134
 
126
135
  def remove_agent(self):
127
136
  try:
128
- run_cmd(f'docker compose -f {self.compose_file} down')
137
+ run_cmd(f'docker compose -f {self.compose_file} down --volumes')
129
138
  return True
130
139
  except:
131
140
  return False
@@ -171,6 +180,7 @@ class dockerCluster(Cluster):
171
180
 
172
181
  except:
173
182
  pass
183
+ time.sleep(5)
174
184
  return self.is_agent_running()
175
185
 
176
186
  def get_cluster_token(self):
@@ -331,3 +341,16 @@ class k3sCluster(Cluster):
331
341
  if not validate_poolconfig(self.poolconfig_file):
332
342
  raise ValueError("Cache missconfigured. Run 'kalavai pool stop' to clear.")
333
343
  return True
344
+
345
+ ####################################################
346
+ ####################################################
347
+
348
+ CLUSTER = dockerCluster(
349
+ container_name=DEFAULT_CONTAINER_NAME,
350
+ kube_version=KUBE_VERSION,
351
+ flannel_iface=DEFAULT_FLANNEL_IFACE,
352
+ compose_file=USER_COMPOSE_FILE,
353
+ kubeconfig_file=USER_KUBECONFIG_FILE,
354
+ poolconfig_file=USER_LOCAL_SERVER_FILE,
355
+ dependencies_file=USER_HELM_APPS_FILE
356
+ )