@@ -86,67 +86,14 @@ def create_fleet_yaml(module_name, aimmo_version):
86
86
return content
87
87
88
88
89
- def create_creator_yaml (module_name , aimmo_version ):
90
- """
91
- Loads an aimmo-game-creator yaml into a dictionary.
92
-
93
- Replaces the GAME_API_URL environment variable with the correct url for the
94
- deployment environment we are in
95
-
96
- :param module_name: The name of the environment we're in (ie. staging, dev).
97
- :param aimmo_version: The game version we want to deploy.
98
- :return: python object containing yaml with modified values.
99
- """
100
-
101
- def _replace_game_api_url (content ):
102
- game_api_url = (
103
- "https://"
104
- + module_name
105
- + "-dot-decent-digit-629.appspot.com/kurono/api/games/"
106
- )
107
- env_variables = content ["spec" ]["template" ]["spec" ]["containers" ][0 ]["env" ]
108
- game_api_url_index = env_variables .index (
109
- {"name" : "GAME_API_URL" , "value" : "REPLACE_ME" }
110
- )
111
- env_variables [game_api_url_index ]["value" ] = game_api_url
112
-
113
- def _replace_image_version (content ):
114
- env_variables = content ["spec" ]["template" ]["spec" ]["containers" ][0 ]["env" ]
115
- image_suffix_index = env_variables .index (
116
- {"name" : "IMAGE_SUFFIX" , "value" : "latest" }
117
- )
118
- env_variables [image_suffix_index ]["value" ] = aimmo_version
119
-
120
- def _replace_image_tag (content ):
121
- content ["spec" ]["template" ]["spec" ]["containers" ][0 ][
122
- "image"
123
- ] = "ocadotechnology/aimmo-game-creator:{}" .format (aimmo_version )
124
-
125
- path = os .path .join (CURR_DIR , "rs_aimmo_game_creator.yaml" )
126
- with open (path ) as yaml_file :
127
- content = yaml .safe_load (yaml_file .read ())
128
- _replace_game_api_url (content )
129
- _replace_image_version (content )
130
- _replace_image_tag (content )
131
- return content
132
-
133
-
134
- def restart_pods (game_creator_yaml , ingress_yaml , fleet_yaml ):
89
+ def restart_pods (ingress_yaml , fleet_yaml ):
135
90
"""
136
91
Restarts the kubernetes replication controllers, pods, services and ingresses
137
92
in the 'default' namespace
138
93
139
- :param game_creator_yaml: The dict to create the aimmo game creator rc
140
94
:param ingress_yaml: The dict to create the ingress
141
95
:param fleet_yaml: The dict to create the fleet
142
96
"""
143
- for rs in apps_api_instance .list_namespaced_replica_set ("default" ).items :
144
- if rs .metadata .name == game_creator_yaml ["metadata" ]["name" ]:
145
- apps_api_instance .delete_namespaced_replica_set (
146
- body = kubernetes .client .V1DeleteOptions (),
147
- name = rs .metadata .name ,
148
- namespace = "default" ,
149
- )
150
97
for service in api_instance .list_namespaced_service ("default" ).items :
151
98
if service .metadata .name .startswith ("game-" ):
152
99
api_instance .delete_namespaced_service (
@@ -193,10 +140,6 @@ def restart_pods(game_creator_yaml, ingress_yaml, fleet_yaml):
193
140
194
141
networking_api_instance .create_namespaced_ingress ("default" , ingress_yaml )
195
142
196
- apps_api_instance .create_namespaced_replica_set (
197
- body = game_creator_yaml , namespace = "default"
198
- )
199
-
200
143
custom_objects_api_instance .create_namespaced_custom_object (
201
144
group = "agones.dev" ,
202
145
version = "v1" ,
@@ -225,12 +168,9 @@ def main(module_name):
225
168
aimmo_version = get_aimmo_version ()
226
169
227
170
ingress = create_ingress_yaml (module_name = module_name )
228
- game_creator_rs = create_creator_yaml (
229
- module_name = module_name , aimmo_version = aimmo_version
230
- )
231
171
fleet = create_fleet_yaml (module_name = module_name , aimmo_version = aimmo_version )
232
172
233
- restart_pods (game_creator_rs , ingress , fleet )
173
+ restart_pods (ingress , fleet )
234
174
235
175
236
176
if __name__ == "__main__" :
0 commit comments