File tree Expand file tree Collapse file tree 3 files changed +11
-14
lines changed
examples/src/main/java/io/kubernetes/client/examples
extended/src/main/java/io/kubernetes/client/extended/kubectl Expand file tree Collapse file tree 3 files changed +11
-14
lines changed Original file line number Diff line number Diff line change @@ -110,11 +110,14 @@ public static void main(String[] args)
110
110
System .exit (0 );
111
111
case "exec" :
112
112
name = args [1 ];
113
- String [] command = Arrays .copyOfRange (args , 1 , args .length );
113
+ String [] command = Arrays .copyOfRange (args , 2 , args .length );
114
114
KubectlExec e =
115
- exec (client ).namespace (ns ).name (name ).container (cli .getOptionValue ("c" , "" ));
116
- e .execute ();
117
- System .exit (e .exitCode ());
115
+ exec (client )
116
+ .namespace (ns )
117
+ .name (name )
118
+ .command (command )
119
+ .container (cli .getOptionValue ("c" , "" ));
120
+ System .exit (e .execute ());
118
121
default :
119
122
System .out .println ("Unknown verb: " + verb );
120
123
System .exit (-1 );
Original file line number Diff line number Diff line change 24
24
import org .apache .commons .lang .StringUtils ;
25
25
26
26
public class KubectlAnnotate <ApiType extends KubernetesObject >
27
- extends Kubectl .ResourceBuilder <KubectlAnnotate <ApiType >>
27
+ extends Kubectl .ResourceBuilder <ApiType , KubectlAnnotate <ApiType >>
28
28
implements Kubectl .Executable <ApiType > {
29
29
30
30
private final ApiClient apiClient ;
Original file line number Diff line number Diff line change 24
24
import java .io .OutputStream ;
25
25
26
26
public class KubectlExec extends Kubectl .ResourceAndContainerBuilder <V1Pod , KubectlExec >
27
- implements Kubectl .Executable <V1Pod > {
27
+ implements Kubectl .Executable <Integer > {
28
28
private String [] command ;
29
29
private boolean stdin ;
30
30
private boolean tty ;
31
- private int result ;
32
31
33
32
KubectlExec (ApiClient client ) {
34
33
super (client , V1Pod .class );
@@ -49,12 +48,8 @@ public KubectlExec tty(boolean tty) {
49
48
return this ;
50
49
}
51
50
52
- public int exitCode () {
53
- return result ;
54
- }
55
-
56
51
@ Override
57
- public V1Pod execute () throws KubectlException {
52
+ public Integer execute () throws KubectlException {
58
53
V1Pod pod = new V1Pod ().metadata (new V1ObjectMeta ().name (name ).namespace (namespace ));
59
54
60
55
Exec exec = new Exec (apiClient );
@@ -65,11 +60,10 @@ public V1Pod execute() throws KubectlException {
65
60
if (stdin ) {
66
61
copyAsync (System .in , proc .getOutputStream ());
67
62
}
68
- this . result = proc .waitFor ();
63
+ return proc .waitFor ();
69
64
} catch (InterruptedException | ApiException | IOException ex ) {
70
65
throw new KubectlException (ex );
71
66
}
72
- return pod ;
73
67
}
74
68
75
69
private static void copyAsync (InputStream in , OutputStream out ) {
You can’t perform that action at this time.
0 commit comments