@@ -46,16 +46,23 @@ def get_default_namespace() -> str:
4646 """Get the default namespace from kubectl config."""
4747 try :
4848 result = subprocess .run (
49- ["kubectl" , "config" , "view" , "--minify" , "-o" , "jsonpath={.contexts[0].context.namespace}" ],
49+ [
50+ "kubectl" ,
51+ "config" ,
52+ "view" ,
53+ "--minify" ,
54+ "-o" ,
55+ "jsonpath={.contexts[0].context.namespace}" ,
56+ ],
5057 capture_output = True ,
5158 text = True ,
52- check = False
59+ check = False ,
5360 )
5461 if result .returncode == 0 and result .stdout .strip ():
5562 return result .stdout .strip ()
5663 except Exception :
5764 pass
58-
65+
5966 # Fallback to "default" if we can't get it from config
6067 return "default"
6168
@@ -264,7 +271,9 @@ def test_permissions(self, check_crd: bool = False) -> Tuple[int, int]:
264271 permissions = self .get_required_permissions ()
265272 total = len (permissions )
266273
267- console .print (f"\n Checking { total } Kubernetes permissions for namespace '{ self .namespace } '...\n " )
274+ console .print (
275+ f"\n Checking { total } Kubernetes permissions for namespace '{ self .namespace } '...\n "
276+ )
268277 console .print ("-" * 80 )
269278
270279 for i , perm in enumerate (permissions , 1 ):
@@ -326,7 +335,8 @@ def print_summary(self):
326335 console .print (" 3. Ensure the KubeRay CRDs are installed in the cluster" )
327336 else :
328337 console .print (
329- "\n All permission checks passed! You have the required permissions to use KubeRay." , style = "green"
338+ "\n All permission checks passed! You have the required permissions to use KubeRay." ,
339+ style = "green" ,
330340 )
331341
332342 def generate_rbac_manifest (self ) -> str :
@@ -531,8 +541,6 @@ def test_user_permissions(self, username: str):
531541 console .print (f" ✗ Error testing { resource } : { e } " , style = "red" )
532542
533543
534-
535-
536544def show_help ():
537545 """Display help message using rich console."""
538546 help_text = """
@@ -655,11 +663,9 @@ def main():
655663 formatter_class = argparse .RawDescriptionHelpFormatter ,
656664 add_help = False ,
657665 )
658-
666+
659667 # Add custom help argument
660- parser .add_argument (
661- "-h" , "--help" , action = "store_true" , help = "Show this help message and exit"
662- )
668+ parser .add_argument ("-h" , "--help" , action = "store_true" , help = "Show this help message and exit" )
663669
664670 subparsers = parser .add_subparsers (dest = "command" , help = "Available commands" )
665671
@@ -694,7 +700,7 @@ def main():
694700 )
695701
696702 args = parser .parse_args ()
697-
703+
698704 # Handle custom help
699705 if args .help :
700706 show_help ()
@@ -703,7 +709,7 @@ def main():
703709 if not args .command :
704710 show_help ()
705711 sys .exit (1 )
706-
712+
707713 rbac_manager = KubeRayRBAC (namespace = args .namespace )
708714
709715 if args .command == "test" :
0 commit comments