Skip to content

Commit

Permalink
Fixed an unrelated error for minikube run. If the replication control…
Browse files Browse the repository at this point in the history
…ler was already created before, we shall not create another one.
  • Loading branch information
danalex97 committed Jul 27, 2017
1 parent fcd66b0 commit 31858eb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
3 changes: 1 addition & 2 deletions aimmo-game/simulation/custom_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,5 +219,4 @@ def check_complete(self, game_state):
except KeyError:
return False

return main_avatar.score > 24

return main_avatar.score > 10000007
18 changes: 14 additions & 4 deletions minikube.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
from urllib2 import urlopen
from zipfile import ZipFile

from kubernetes.client.rest import ApiException

BASE_DIR = os.path.abspath(os.path.dirname(__file__))
TEST_BIN = os.path.join(BASE_DIR, 'test-bin')
OS = platform.system().lower()
Expand Down Expand Up @@ -150,10 +152,18 @@ def restart_pods(game_creator):
v1_api.delete_namespaced_pod(body=kubernetes.client.V1DeleteOptions(), name=pod.metadata.name, namespace='default')
for service in v1_api.list_namespaced_service('default').items:
v1_api.delete_namespaced_service(name=service.metadata.name, namespace='default')
v1_api.create_namespaced_replication_controller(
body=game_creator,
namespace='default',
)

try:
v1_api.create_namespaced_replication_controller(
body=game_creator,
namespace='default',
)
except ApiException as e:
# TODO: If the replication controller already exists, we do nothing for the moment
if e.status == 409:
print("Replication controller already exists.")
else:
raise


def start():
Expand Down

0 comments on commit 31858eb

Please sign in to comment.