diff --git a/infra/vultr-kubernetes/dev/.gitignore b/infra/vultr-kubernetes/dev/.gitignore deleted file mode 100644 index 7b782aa..0000000 --- a/infra/vultr-kubernetes/dev/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -# created by virtualenv automatically -bin/ -lib/ - diff --git a/infra/vultr-kubernetes/dev/find-server.py b/infra/vultr-kubernetes/dev/find-server.py deleted file mode 100644 index dd07647..0000000 --- a/infra/vultr-kubernetes/dev/find-server.py +++ /dev/null @@ -1,59 +0,0 @@ -from argparse import ArgumentParser -from argparse import Namespace -from kubernetes import client, config -import re - -def get_args() -> Namespace: - parser = ArgumentParser( - prog="Cluster Search Thing", - description="General utility for finding resources for game server bot" - ) - games = {"health", "reflex", "minecraft"} - parser.add_argument('-g', '--game', required=False, choices=games) - - admin = {"health"} - parser.add_argument('-a', '--admin', required=False, choices=admin) - return parser.parse_args() - -def k8s_api(config_path: str) -> client.api.core_v1_api.CoreV1Api: - config.load_kube_config("../config.yaml") - return client.CoreV1Api() - -def get_admin_service_details(args: ArgumentParser, api: client.api.core_v1_api.CoreV1Api): - print('admin thing requested', args.admin) - services = api.list_service_for_all_namespaces(label_selector=f'app={args.admin}') - if len(services.items) == 0: - print(f'Unable to find {args.admin} amongst the admin-services') - return - - port = services.items[0].spec.ports[0].port - node_ips = list(filter(lambda a: a.type == 'ExternalIP', api.list_node().items[0].status.addresses)) - ipv4 = list(filter(lambda item: not re.match('[\d\.]{3}\d', item.address), node_ips))[0].address - ipv6 = list(filter(lambda item: re.match('[\d\.]{3}\d', item.address), node_ips))[0].address - - print(f'{args.admin} --> {ipv4}:{port} ~~> {ipv6}:{port}') - -def get_game_server_ip(args: ArgumentParser, api: client.api.core_v1_api.CoreV1Api): - services = api.list_service_for_all_namespaces(label_selector=f'app={args.game}') - port = services.items[0].spec.ports[0].port - - # Collecting the IPV4 of the node that contains the pod(container) - # we actually care about. Since these pods only have 1 container - # Now we collect specific data about the game server we requested - node_ips = list(filter(lambda a: a.type == 'ExternalIP', api.list_node().items[0].status.addresses)) - ipv4 = list(filter(lambda item: not re.match('[\d\.]{3}\d', item.address), node_ips))[0].address - ipv6 = list(filter(lambda item: re.match('[\d\.]{3}\d', item.address), node_ips))[0].address - - print(f'{args.game} --> {ipv4}:{port} ~~> {ipv6}:{port}') - - -if __name__ == '__main__': - args = get_args() - api = k8s_api('../config.yaml') - - if args.game: - get_game_server_ip(args, api) - - if args.admin: - get_admin_service_details(args, api) - diff --git a/infra/vultr-kubernetes/dev/pyvenv.cfg b/infra/vultr-kubernetes/dev/pyvenv.cfg deleted file mode 100644 index 2ff528d..0000000 --- a/infra/vultr-kubernetes/dev/pyvenv.cfg +++ /dev/null @@ -1,8 +0,0 @@ -home = /usr -implementation = CPython -version_info = 3.10.12.final.0 -virtualenv = 20.13.0+ds -include-system-site-packages = false -base-prefix = /usr -base-exec-prefix = /usr -base-executable = /usr/bin/python3 diff --git a/infra/vultr-kubernetes/dev/requirements.txt b/infra/vultr-kubernetes/dev/requirements.txt deleted file mode 100644 index 070c98d..0000000 --- a/infra/vultr-kubernetes/dev/requirements.txt +++ /dev/null @@ -1,18 +0,0 @@ -cachetools==5.5.0 -certifi==2024.8.30 -charset-normalizer==3.4.0 -durationpy==0.9 -google-auth==2.36.0 -idna==3.10 -kubernetes==31.0.0 -oauthlib==3.2.2 -pyasn1==0.6.1 -pyasn1_modules==0.4.1 -python-dateutil==2.9.0.post0 -PyYAML==6.0.2 -requests==2.32.3 -requests-oauthlib==2.0.0 -rsa==4.9 -six==1.17.0 -urllib3==2.2.3 -websocket-client==1.8.0