-
Notifications
You must be signed in to change notification settings - Fork 71
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 61 files reviewed, 2 unresolved discussions
aimmo/views.py
line 124 at r1 (raw file):
return Response(response) def destroy(self, request, *args, **kwargs):
Check if this is being used
aimmo/game_manager/game_manager.py
line 73 at r1 (raw file):
self.game_ingress_manager.add_game_path_to_ingress(game_name=game_name) except ApiException as e: # TODO: Filter out no-ingress exception on localhost
Look more into what's going on here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 61 files reviewed, 4 unresolved discussions
aimmo/game_manager/game_manager.py
line 26 at r1 (raw file):
) -> None: self.api: CoreV1Api = CoreV1Api() self.api_client: ApiClient = ApiClient()
Validate we're connecting to the client correctly
aimmo/game_manager/game_manager.py
line 92 at r1 (raw file):
return self.game_server_manager.delete_game_server(game_id=game_id) def recreate_game_server(self, game_id: int, game_data_updates: dict = None) -> None:
See if we can just update instead of recreating
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 61 files reviewed, 6 unresolved discussions
aimmo-game/Pipfile
line 20 at r1 (raw file):
[packages] #aimmo-game = {editable = true, path = "."}
Remove
aimmo-game/simulation/django_communicator.py
line 7 at r1 (raw file):
import aiohttp LOGGER = logging.getLogger(__name__)
Remove this
Code quote:
import aiohttp
LOGGER = logging.getLogger(__name__)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 24 of 61 files at r1, all commit messages.
Reviewable status: 24 of 61 files reviewed, 17 unresolved discussions (waiting on @faucomte97)
aimmo/models.py
line 177 at r1 (raw file):
game_manager = GameManager() game_manager.create_game_secret(game_id=self.id, token=self.auth_token) game_manager.create_game_server(game_id=self.id, game_data=GameSerializer(self).data)
this feels redundant. why serialize data we already have? why not just pass the data in directly?
aimmo/models.py
line 202 at r1 (raw file):
class GameSerializer(serializers.Serializer):
I'm not sure this serializer is needed but if it were, why not make it a ModelSerializer since where serializing the Game model?
aimmo/views.py
line 124 at r1 (raw file):
Previously, faucomte97 (Florian Aucomte) wrote…
Check if this is being used
let me know about this. if the game server is deleted here, then where/how are game servers deleted?
aimmo/views.py
line 173 at r1 (raw file):
# Re-raise exception so that atomic transaction reverts raise exception
besides aborting the db transaction, do we have any graceful feedback or handling of this exception?
aimmo/game_manager/game_manager.py
line 26 at r1 (raw file):
Previously, faucomte97 (Florian Aucomte) wrote…
Validate we're connecting to the client correctly
how does our Django App Engine instance connect/authenticate with our GKE instance?
aimmo/game_manager/game_manager.py
line 43 at r1 (raw file):
return f"game-{game_id}" def create_game_secret(self, game_id: int, token: str):
why do we need to create a game secret?
aimmo/game_manager/game_manager.py
line 73 at r1 (raw file):
Previously, faucomte97 (Florian Aucomte) wrote…
Look more into what's going on here
this code seems dangerous. it could make it possible to create a gamer server + service without an ingress path, meaning the game will be non-contactable. Also, if there's no ingress on localhost, how are requests getting routed locally?
aimmo/game_manager/game_manager.py
line 89 at r1 (raw file):
except ApiException as e: LOGGER.error(e) self.game_service_manager.delete_game_service(game_id=game_id)
defensive programming - if an exception is raised when deleting the service, the server will not be deleted and remain orphaned. we need to be careful about orphaned instances in our system.
aimmo/game_manager/game_manager.py
line 92 at r1 (raw file):
Previously, faucomte97 (Florian Aucomte) wrote…
See if we can just update instead of recreating
I think the confusion stems from how the system is modelled. Conceptually, we're not recreating the game, we're creating a new game. But technically, the way we've implemented it, we recycle game ids (which is conceptually wrong). Let's discuss this further and see if you agree.
aimmo/game_manager/game_secret_manager.py
line 12 at r1 (raw file):
class GameSecretManager:
did we confirm if this is needed? if this is to ensure secure communication with our game servers, couldn't this just be achieved with CORS in our ingress?
aimmo/game_manager/game_server_manager.py
line 39 at r1 (raw file):
"game-id": str(game_id), }, "annotations": game_data,
why is this annotation needed? was it meant to be an environment variable?
aimmo/game_manager/game_server_manager.py
line 55 at r1 (raw file):
return result["status"]["gameServerName"] def delete_game_server(self, game_id: int) -> dict:
seems we have a few functions that delete game servers. can you help me understand the need for each on a call?
aimmo/game_manager/game_service_manager.py
line 45 at r1 (raw file):
for resource in resources.items: LOGGER.info("Removing service: {}".format(resource.metadata.name)) self.api.delete_namespaced_service(resource.metadata.name, K8S_NAMESPACE)
defensive programming - wrap in a try/except and log any exceptions
aimmo/tests/test_game_manager.py
line 37 at r1 (raw file):
def test_create_game_server(game_manager: GameManager, game_id, game_data):
what's the value of these tests? I say this because:
- we're not making assertions
- we're not testing our code/functionality? Seems we're testing the k8s client more.
aimmo/tests/test_middleware.py
line 84 at r1 (raw file):
assert Game.objects.all().count() == 2 @patch("aimmo.views.GameManager")
why mock this if we're not doing anything with it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 27 of 61 files at r1.
Reviewable status: 51 of 61 files reviewed, 17 unresolved discussions (waiting on @faucomte97)
aimmo-game/Pipfile
line 20 at r1 (raw file):
Previously, faucomte97 (Florian Aucomte) wrote…
Remove
just a reminder
aimmo-game/simulation/django_communicator.py
line 7 at r1 (raw file):
Previously, faucomte97 (Florian Aucomte) wrote…
Remove this
reminder
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 51 of 61 files reviewed, 16 unresolved discussions (waiting on @SKairinos)
aimmo/models.py
line 177 at r1 (raw file):
Previously, SKairinos (Stefan Kairinos) wrote…
this feels redundant. why serialize data we already have? why not just pass the data in directly?
Done.
aimmo/views.py
line 124 at r1 (raw file):
Previously, SKairinos (Stefan Kairinos) wrote…
let me know about this. if the game server is deleted here, then where/how are game servers deleted?
Delete this endpoint
aimmo/views.py
line 173 at r1 (raw file):
Previously, SKairinos (Stefan Kairinos) wrote…
besides aborting the db transaction, do we have any graceful feedback or handling of this exception?
Done.
aimmo/game_manager/game_manager.py
line 43 at r1 (raw file):
Previously, SKairinos (Stefan Kairinos) wrote…
why do we need to create a game secret?
Add a TODO for the improved solution
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 51 of 61 files reviewed, 14 unresolved discussions (waiting on @faucomte97 and @SKairinos)
aimmo/models.py
line 202 at r1 (raw file):
Previously, SKairinos (Stefan Kairinos) wrote…
I'm not sure this serializer is needed but if it were, why not make it a ModelSerializer since where serializing the Game model?
Added a TODO to replace with ModelSerializer.
aimmo/game_manager/game_manager.py
line 43 at r1 (raw file):
Previously, faucomte97 (Florian Aucomte) wrote…
Add a TODO for the improved solution
Done.
aimmo/game_manager/game_manager.py
line 73 at r1 (raw file):
Previously, SKairinos (Stefan Kairinos) wrote…
this code seems dangerous. it could make it possible to create a gamer server + service without an ingress path, meaning the game will be non-contactable. Also, if there's no ingress on localhost, how are requests getting routed locally?
Dun
aimmo/game_manager/game_manager.py
line 89 at r1 (raw file):
Previously, SKairinos (Stefan Kairinos) wrote…
defensive programming - if an exception is raised when deleting the service, the server will not be deleted and remain orphaned. we need to be careful about orphaned instances in our system.
no
aimmo/game_manager/game_manager.py
line 92 at r1 (raw file):
Previously, SKairinos (Stefan Kairinos) wrote…
I think the confusion stems from how the system is modelled. Conceptually, we're not recreating the game, we're creating a new game. But technically, the way we've implemented it, we recycle game ids (which is conceptually wrong). Let's discuss this further and see if you agree.
no
aimmo/game_manager/game_secret_manager.py
line 12 at r1 (raw file):
Previously, SKairinos (Stefan Kairinos) wrote…
did we confirm if this is needed? if this is to ensure secure communication with our game servers, couldn't this just be achieved with CORS in our ingress?
no
aimmo/game_manager/game_server_manager.py
line 39 at r1 (raw file):
Previously, SKairinos (Stefan Kairinos) wrote…
why is this annotation needed? was it meant to be an environment variable?
no
aimmo/game_manager/game_server_manager.py
line 55 at r1 (raw file):
Previously, SKairinos (Stefan Kairinos) wrote…
seems we have a few functions that delete game servers. can you help me understand the need for each on a call?
no
aimmo/game_manager/game_service_manager.py
line 45 at r1 (raw file):
Previously, SKairinos (Stefan Kairinos) wrote…
defensive programming - wrap in a try/except and log any exceptions
Done.
aimmo/tests/test_game_manager.py
line 37 at r1 (raw file):
Previously, SKairinos (Stefan Kairinos) wrote…
what's the value of these tests? I say this because:
- we're not making assertions
- we're not testing our code/functionality? Seems we're testing the k8s client more.
It seems like it just checks that the 3 subcalls of the create_game_server
function are being called properly, I guess to make sure that the K8s calls are executed fine? 😕
aimmo/tests/test_middleware.py
line 84 at r1 (raw file):
Previously, SKairinos (Stefan Kairinos) wrote…
why mock this if we're not doing anything with it?
It is used, by the save()
function which calls the GameManager to create the game servers.
aimmo-game/Pipfile
line 20 at r1 (raw file):
Previously, SKairinos (Stefan Kairinos) wrote…
just a reminder
Done.
aimmo-game/simulation/django_communicator.py
line 7 at r1 (raw file):
Previously, SKairinos (Stefan Kairinos) wrote…
reminder
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 5 of 61 files at r1, 5 of 5 files at r2, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @faucomte97)
aimmo/views.py
line 124 at r1 (raw file):
Previously, faucomte97 (Florian Aucomte) wrote…
Delete this endpoint
Are you going to delete it now or are do you want to just add a TODO for now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @faucomte97)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @SKairinos)
aimmo/views.py
line 124 at r1 (raw file):
Previously, SKairinos (Stefan Kairinos) wrote…
Are you going to delete it now or are do you want to just add a TODO for now?
Dun now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 2 files at r3, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @faucomte97)
Codecov Report
@@ Coverage Diff @@
## master #1798 +/- ##
==========================================
+ Coverage 66.32% 70.51% +4.19%
==========================================
Files 179 189 +10
Lines 3661 3938 +277
Branches 255 272 +17
==========================================
+ Hits 2428 2777 +349
+ Misses 1201 1132 -69
+ Partials 32 29 -3
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 2 files at r4, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @faucomte97)
This PR replaces #1575 as the owner of the repo that PR originates from has been archived.
This change is