@@ -31,7 +31,7 @@ def cluster(ctx, project_name, cluster_name, profile):
3131
3232# LOGIN ON CLUSTER
3333@cluster .command ('login' , help = "Set a default cluster" )
34- @click .option ('--cluster-name' , '-c' , required = True , help = "Name of cluster" )
34+ @click .option ('--cluster-name' , '-c' , required = False , help = "Name of cluster" )
3535@click .option ("--profile" , help = "Configuration profile to use" , shell_complete = profile_completer )
3636@click .pass_context
3737def cluster_login (ctx , cluster_name , profile ):
@@ -312,8 +312,7 @@ def _create_cluster(project_name, cluster_config, output):
312312# CLUSTER CREATE BY NAME
313313@cluster .command ('create' , help = "Create a new cluster" )
314314@click .option ('--project-name' , '-p' , required = False , help = "Project Name" )
315- @click .option ('--cluster-name' , '-c' , required = True , help = "Cluster Name" )
316- @click .option ('--name' , 'cluster_name' , required = True , help = "Cluster Name" )
315+ @click .option ('--cluster-name' , '--name' , '-c' , required = False , help = "Cluster Name" )
317316@click .option ('--description' , help = "Description of the cluster" )
318317@click .option ('--admin' , help = "Admin Whitelist" )
319318@click .option ('--version' , shell_complete = shell_completions , help = "Kubernetes version" )
@@ -342,6 +341,9 @@ def cluster_create_command(ctx, project_name, cluster_name, description, admin,
342341 input_data = filename .read ()
343342 cluster_config = detect_and_parse_input (input_data )
344343
344+ if not cluster_name and "name" not in cluster_config :
345+ raise click .BadArgumentUsage ("Missing option '--cluster-name' / '-c'." )
346+
345347 if cluster_name :
346348 cluster_config ['name' ] = cluster_name
347349
@@ -646,7 +648,7 @@ def _run_kubectl(project_id, cluster_id, user, group, args, input=None):
646648 kubeconfig_path = save_cache (project_id , cluster_id , 'kubeconfig' , kubeconfig_raw , user , group )
647649
648650 env = dict (os .environ )
649- env ['KUBECONFIG' ] = kubeconfig_path
651+ env ['KUBECONFIG' ] = str ( kubeconfig_path )
650652 cmd = ['kubectl' ]
651653 cmd += list (args )
652654 logging .info ("running %s" , cmd )
0 commit comments