@@ -6,14 +6,18 @@ config.define_string("host-ip", args=False, usage="IP Address of the host to ena
66config .define_string ("hostname" , args = False , usage = "Accessible name of the host to enable redirection to local services" )
77config .define_string ("faf-data-dir" , args = False , usage = "Directory where the FAF Data lives normally C:/ProgramData/FAForever on Windows or ~/.faforever on Linux" )
88config .define_string ("base-domain" , args = False , usage = "Base Domain to use for all faf services. Defaults to faforever.localhost" )
9- config .define_string_list ("local-services" , args = False , usage = "Names of services that you intend to run locally" )
9+ config .define_string_list ("local" , args = False , usage = "Names of services that you intend to run locally" )
10+ config .define_string_list ("run" , args = False , usage = "Names of applciatioons that you intend to run" )
1011cfg = config .parse ()
1112is_ci = os .getenv ("CI" , False )
1213windows_bash_path = cfg .get ("windows-bash-path" , "C:\\ Program Files\\ Git\\ bin\\ bash.exe" )
1314host_ip = cfg .get ("host-ip" , "" )
14- local_services = cfg .get ("local-services" , [])
15+ local_services = cfg .get ("local" , [])
16+ applications = cfg .get ("run" , [])
1517base_domain = cfg .get ("base-domain" , "faforever.localhost" )
1618
19+ config .set_enabled_resources (applications + local_services + ["populate-featured-mod-files" , "create-hosts-file-content" ])
20+
1721data_relative_path = ".local-data"
1822if os .name == "nt" :
1923 faf_data_dir = cfg .get ("faf-data-dir" , "C:/ProgramData/FAForever" )
@@ -137,6 +141,7 @@ def helm_with_build_cache(chart, namespace="", values=[], set=[], specifier = ""
137141 containers = template_spec .get ("containers" , [])
138142 for container in containers :
139143 container ["imagePullPolicy" ] = default_pull_policy
144+ container ["resources" ] = {}
140145 init_containers = template_spec .get ("initContainers" , [])
141146 for init_container in init_containers :
142147 init_container ["imagePullPolicy" ] = default_pull_policy
@@ -225,7 +230,7 @@ def proxy_local_service_if_set(service_name, service_chart, service_namespace, a
225230 k8s_yaml (service_proxy_yaml )
226231 for object in decode_yaml_stream (service_proxy_yaml ):
227232 service_objects .append (object ["metadata" ]["name" ] + ":" + object ["kind" ].lower ())
228- k8s_resource (new_name = service_name , objects = service_objects , resource_deps = all_service_deps , labels = service_labels , links = user_service_links , pod_readiness = "ignore" )
233+ k8s_resource (new_name = service_name , objects = service_objects , resource_deps = all_service_deps , labels = service_labels , links = service_links , pod_readiness = "ignore" )
229234 else :
230235 if service_name == "faf-icebreaker" :
231236 service_yaml = remove_init_container (service_yaml )
@@ -283,7 +288,7 @@ for object in decode_yaml_stream(traefik_yaml):
283288
284289k8s_resource (new_name = "traefik-crds" , objects = traefik_crds , labels = ["traefik" ])
285290k8s_resource (new_name = "traefik-setup" , objects = traefik_identifiers , resource_deps = ["namespaces" , "traefik-crds" ], labels = ["traefik" ])
286- k8s_resource (workload = "release-name-traefik" , new_name = "traefik" , port_forwards = ["443:8443" , "80:8000" ], resource_deps = ["traefik-setup" ], labels = ["traefik" ])
291+ k8s_resource (workload = "release-name-traefik" , new_name = "traefik" , port_forwards = ["443:8443" , "80:8000" ], resource_deps = ["traefik-setup" ], labels = ["traefik" ], links = [ link ( "http://traefik.{}" . format ( base_domain ), "FAF Traefik" )] )
287292
288293postgres_yaml = helm_with_build_cache ("infra/postgres" , namespace = "faf-infra" , values = ["config/local.yaml" ])
289294postgres_init_user_yaml , postgres_resource_yaml = filter_yaml (postgres_yaml , {"app" : "postgres-sync-db-user" })
@@ -353,15 +358,18 @@ k8s_resource(workload="nodebb", objects=["nodebb:ingressroute"], resource_deps=[
353358k8s_yaml (keep_objects_of_kind (helm_with_build_cache ("apps/debezium" , namespace = "faf-apps" , values = ["config/local.yaml" ]), kinds = ["ConfigMap" , "Secret" ]))
354359k8s_resource (new_name = "debezium-config" , objects = ["debezium:configmap" , "debezium:secret" ], labels = ["database" ])
355360
361+ hydra_deps = ["ory-hydra-migration" , "traefik" ]
362+ hydra_labels = ["hydra" ]
363+ hydra_links = [link ("http://hydra.{}/.well-known/openid-configuration" .format (base_domain ), "Hydra Configuration" )]
356364hydra_yaml = helm_with_build_cache ("apps/ory-hydra" , namespace = "faf-apps" , values = ["config/local.yaml" ])
357365hydra_client_create_yaml , hydra_resources_yaml = filter_yaml (hydra_yaml , {"app" : "ory-hydra-create-clients" })
358366_ , hydra_resources_yaml = filter_yaml (hydra_resources_yaml , {"app" : "ory-hydra-janitor" })
359367hydra_resources_yaml = patch_config (hydra_resources_yaml , "ory-hydra" , {"URLS_SELF_ISSUER" : "http://ory-hydra:4444" , "URLS_SELF_PUBLIC" : "http://hydra.{}" .format (base_domain ), "URLS_LOGIN" : "http://user.{}/oauth2/login" .format (base_domain ), "URLS_CONSENT" : "http://user.{}/oauth2/consent" .format (base_domain ), "DEV" : "true" })
360368k8s_yaml (hydra_resources_yaml )
361369k8s_yaml (hydra_client_create_yaml )
362- k8s_resource (new_name = "ory-hydra-config" , objects = ["ory-hydra:configmap" , "ory-hydra:secret" ], labels = [ "hydra" ] )
363- k8s_resource (workload = "ory-hydra-migration" , resource_deps = ["ory-hydra-config" ] + postgres_setup_resources , labels = [ "hydra" ] )
364- k8s_resource (workload = "ory-hydra" , objects = ["ory-hydra:ingressroute" ], resource_deps = [ "ory-hydra-migration" , "traefik" ], port_forwards = ["4444" , "4445" ], labels = [ "hydra" ] )
370+ k8s_resource (new_name = "ory-hydra-config" , objects = ["ory-hydra:configmap" , "ory-hydra:secret" ], labels = hydra_labels )
371+ k8s_resource (workload = "ory-hydra-migration" , resource_deps = ["ory-hydra-config" ] + postgres_setup_resources , labels = hydra_labels )
372+ k8s_resource (workload = "ory-hydra" , objects = ["ory-hydra:ingressroute" ], resource_deps = hydra_deps , port_forwards = ["4444" , "4445" ], labels = hydra_labels , links = hydra_links )
365373for object in decode_yaml_stream (hydra_client_create_yaml ):
366374 k8s_resource (workload = object ["metadata" ]["name" ], resource_deps = ["ory-hydra" ], labels = ["hydra" ])
367375
0 commit comments