4
4
import click
5
5
from rich import print as richprint
6
6
7
- from .constants import NETWORK_DIR , NETWORK_FILE
7
+ from .constants import NETWORK_DIR , NETWORK_FILE , WARGAMES_NAMESPACE_PREFIX
8
8
from .deploy import deploy_network , validate_directory
9
9
from .k8s import get_kubeconfig_value , get_namespaces_by_prefix , get_service_accounts_in_namespace
10
10
from .namespaces import copy_namespaces_defaults , namespaces
@@ -39,7 +39,6 @@ def init():
39
39
40
40
41
41
@admin .command ()
42
- @click .argument ("prefix" , type = str , required = True )
43
42
@click .option (
44
43
"--kubeconfig-dir" ,
45
44
default = "kubeconfigs" ,
@@ -51,7 +50,7 @@ def init():
51
50
type = int ,
52
51
help = "Duration of the token in seconds (default: 48 hours)" ,
53
52
)
54
- def create_kubeconfigs (prefix : str , kubeconfig_dir , token_duration ):
53
+ def create_kubeconfigs (kubeconfig_dir , token_duration ):
55
54
"""Create kubeconfig files for all ServiceAccounts in warnet team namespaces starting with <prefix>."""
56
55
kubeconfig_dir = os .path .expanduser (kubeconfig_dir )
57
56
@@ -68,7 +67,7 @@ def create_kubeconfigs(prefix: str, kubeconfig_dir, token_duration):
68
67
# TODO: choose a prefix convention and have it managed by the helm charts instead of requiring the
69
68
# admin user to pipe through the correct string in multiple places. Another would be to use
70
69
# labels instead of namespace naming conventions
71
- warnet_namespaces = get_namespaces_by_prefix (prefix )
70
+ warnet_namespaces = get_namespaces_by_prefix (WARGAMES_NAMESPACE_PREFIX )
72
71
73
72
for namespace in warnet_namespaces :
74
73
click .echo (f"Processing namespace: { namespace } " )
0 commit comments