Skip to content

Commit ac595a3

Browse files
committed
update admin with prefix logic
1 parent 173ee18 commit ac595a3

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/warnet/admin.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import click
55
from rich import print as richprint
66

7-
from .constants import NETWORK_DIR, NETWORK_FILE
7+
from .constants import NETWORK_DIR, NETWORK_FILE, WARGAMES_NAMESPACE_PREFIX
88
from .deploy import deploy_network, validate_directory
99
from .k8s import get_kubeconfig_value, get_namespaces_by_prefix, get_service_accounts_in_namespace
1010
from .namespaces import copy_namespaces_defaults, namespaces
@@ -39,7 +39,6 @@ def init():
3939

4040

4141
@admin.command()
42-
@click.argument("prefix", type=str, required=True)
4342
@click.option(
4443
"--kubeconfig-dir",
4544
default="kubeconfigs",
@@ -51,7 +50,7 @@ def init():
5150
type=int,
5251
help="Duration of the token in seconds (default: 48 hours)",
5352
)
54-
def create_kubeconfigs(prefix: str, kubeconfig_dir, token_duration):
53+
def create_kubeconfigs(kubeconfig_dir, token_duration):
5554
"""Create kubeconfig files for all ServiceAccounts in warnet team namespaces starting with <prefix>."""
5655
kubeconfig_dir = os.path.expanduser(kubeconfig_dir)
5756

@@ -68,7 +67,7 @@ def create_kubeconfigs(prefix: str, kubeconfig_dir, token_duration):
6867
# TODO: choose a prefix convention and have it managed by the helm charts instead of requiring the
6968
# admin user to pipe through the correct string in multiple places. Another would be to use
7069
# labels instead of namespace naming conventions
71-
warnet_namespaces = get_namespaces_by_prefix(prefix)
70+
warnet_namespaces = get_namespaces_by_prefix(WARGAMES_NAMESPACE_PREFIX)
7271

7372
for namespace in warnet_namespaces:
7473
click.echo(f"Processing namespace: {namespace}")

0 commit comments

Comments
 (0)