@@ -1146,8 +1146,8 @@ command!(
11461146) ;
11471147
11481148command ! (
1149- OneOff ,
1150- "one-off " ,
1149+ Run ,
1150+ "run " ,
11511151 "exec specified command in a new container of the active pod" ,
11521152 |clap: App <' static , ' static >| clap. arg(
11531153 Arg :: with_name( "command" )
@@ -1173,7 +1173,7 @@ command!(
11731173 . takes_value( true )
11741174 . min_values( 0 )
11751175 ) ,
1176- vec![ "one-off " ] ,
1176+ vec![ "run " ] ,
11771177 |args: Vec <& str >, env: & Env | if args. len( ) <= 1 {
11781178 let mut v = Vec :: new( ) ;
11791179 let argstart = args. get( 0 ) ;
@@ -1217,7 +1217,7 @@ command!(
12171217 c
12181218 }
12191219 _ => {
1220- clickwrite!( writer, "Need an active pod to run one-off command.\n " ) ;
1220+ clickwrite!( writer, "Need an active pod to run an one-off command.\n " ) ;
12211221 return ;
12221222 }
12231223 } ,
@@ -1239,7 +1239,7 @@ command!(
12391239 }
12401240 }
12411241 _ => {
1242- clickwrite!( writer, "Need an active pod to run one-off command.\n " ) ;
1242+ clickwrite!( writer, "Need an active pod to run an one-off command.\n " ) ;
12431243 return ;
12441244 }
12451245 } ,
@@ -1275,6 +1275,7 @@ command!(
12751275 clickwrite!( writer, "Couldon't get container image\n " ) ;
12761276 return ;
12771277 } ;
1278+ let pod_name = format!( "one-off-shell-{}" , container_image. as_str( ) ) ;
12781279
12791280 if matches. is_present( "terminal" ) {
12801281 let terminal = if let Some ( t) = matches. value_of( "terminal" ) {
@@ -1292,7 +1293,7 @@ command!(
12921293 "--context" ,
12931294 & kluster. name,
12941295 "run" ,
1295- "one-off-shell" ,
1296+ pod_name . as_str ( ) ,
12961297 "--restart=Never" ,
12971298 "-i" ,
12981299 "--rm" ,
@@ -1311,14 +1312,14 @@ command!(
13111312 ) ;
13121313 }
13131314 } else {
1314- clickwrite!( writer, "Starting one-off container with image {:?}\n " , container_image) ;
1315+ clickwrite!( writer, "Starting an one-off container with image {:?}\n " , container_image) ;
13151316 let status = Command :: new( "kubectl" )
13161317 . arg( "--namespace" )
13171318 . arg( ns)
13181319 . arg( "--context" )
13191320 . arg( & kluster. name)
13201321 . arg( "run" )
1321- . arg( "one-off-shell" )
1322+ . arg( pod_name )
13221323 . arg( "--restart=Never" )
13231324 . arg( "-i" )
13241325 . arg( "--rm" )
@@ -1333,7 +1334,7 @@ command!(
13331334 }
13341335 }
13351336 } else {
1336- clickwrite!( writer, "Need an active pod in order to run one-off command.\n " ) ;
1337+ clickwrite!( writer, "Need an active pod in order to run an one-off command.\n " ) ;
13371338 }
13381339 }
13391340) ;
0 commit comments