diff --git a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/ErrorChannelable.java b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/ErrorChannelable.java new file mode 100644 index 00000000000..f9ac0e2be39 --- /dev/null +++ b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/ErrorChannelable.java @@ -0,0 +1,31 @@ +/** + * Copyright (C) 2015 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.fabric8.kubernetes.client.dsl; + +/** + * @param Where to write errorChannel to. + * @param

Where to read errorChannel from. + * @param The return type. + */ +public interface ErrorChannelable { + + T writingErrorChannel(O in); + + T readingErrorChannel(P in); + + T redirectingErrorChannel(); +} diff --git a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/ExecWatch.java b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/ExecWatch.java index 9bf5d75ef9f..877ca52ead4 100644 --- a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/ExecWatch.java +++ b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/ExecWatch.java @@ -27,6 +27,8 @@ public interface ExecWatch extends Closeable { InputStream getError(); + InputStream getErrorChannel(); + /** * Close the Watch. */ diff --git a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/TtyExecErrorChannelable.java b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/TtyExecErrorChannelable.java new file mode 100644 index 00000000000..d3dbe1e4c81 --- /dev/null +++ b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/TtyExecErrorChannelable.java @@ -0,0 +1,27 @@ +/** + * Copyright (C) 2015 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.fabric8.kubernetes.client.dsl; + +/** + * @param The exec input. + * @param Where to write err channel to. + * @param

Where to read err channel from. + * @param The exec output. + */ +public interface TtyExecErrorChannelable extends + TtyExecable, + ErrorChannelable> { +} diff --git a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/TtyExecErrorable.java b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/TtyExecErrorable.java index dd8f4655759..71fe06935bd 100644 --- a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/TtyExecErrorable.java +++ b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/TtyExecErrorable.java @@ -24,7 +24,7 @@ * @param The exec output. */ public interface TtyExecErrorable extends - TtyExecable, - Errorable> { + TtyExecErrorChannelable, + Errorable> { } diff --git a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/ExecWebSocketListener.java b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/ExecWebSocketListener.java index 19418c4f2e2..1a1dad7a7cd 100644 --- a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/ExecWebSocketListener.java +++ b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/ExecWebSocketListener.java @@ -66,10 +66,12 @@ public class ExecWebSocketListener extends WebSocketListener implements ExecWatc private final InputStream in; private final OutputStream out; private final OutputStream err; + private final OutputStream errChannel; private final PipedOutputStream input; private final PipedInputStream output; private final PipedInputStream error; + private final PipedInputStream errorChannel; private final AtomicReference webSocketRef = new AtomicReference<>(); private final ExecutorService executorService = Executors.newSingleThreadExecutor(); @@ -92,16 +94,23 @@ public ExecWebSocketListener(InputStream in, OutputStream out, OutputStream err, this(new Config(), in, out, err, inputPipe, outputPipe, errorPipe, listener); } + @Deprecated public ExecWebSocketListener(Config config, InputStream in, OutputStream out, OutputStream err, PipedOutputStream inputPipe, PipedInputStream outputPipe, PipedInputStream errorPipe, ExecListener listener) { + this(config, in, out, err, null, inputPipe, outputPipe, errorPipe, null, listener); + } + + public ExecWebSocketListener(Config config, InputStream in, OutputStream out, OutputStream err, OutputStream errChannel, PipedOutputStream inputPipe, PipedInputStream outputPipe, PipedInputStream errorPipe, PipedInputStream errorChannelPipe, ExecListener listener) { this.config = config; this.listener = listener; this.in = inputStreamOrPipe(in, inputPipe, toClose); this.out = outputStreamOrPipe(out, outputPipe, toClose); this.err = outputStreamOrPipe(err, errorPipe, toClose); + this.errChannel = outputStreamOrPipe(errChannel, errorChannelPipe, toClose); this.input = inputPipe; this.output = outputPipe; this.error = errorPipe; + this.errorChannel = errorChannelPipe; this.pumper = new NonBlockingInputStreamPumper(this.in, new Callback() { @Override public void call(byte[] data) { @@ -182,6 +191,9 @@ public void onOpen(WebSocket webSocket, Response response) { if (err instanceof PipedOutputStream && error != null) { error.connect((PipedOutputStream) err); } + if (errChannel instanceof PipedOutputStream && errorChannel != null) { + errorChannel.connect((PipedOutputStream) errChannel); + } webSocketRef.set(webSocket); executorService.submit(pumper); @@ -242,8 +254,8 @@ public void onMessage(WebSocket webSocket, ByteString bytes) { } break; case 3: - if (err != null) { - err.write(byteString.toByteArray()); + if (errChannel != null) { + errChannel.write(byteString.toByteArray()); } break; default: @@ -290,6 +302,10 @@ public InputStream getError() { return error; } + public InputStream getErrorChannel() { + return errorChannel; + } + private void send(byte[] bytes) throws IOException { if (bytes.length > 0) { WebSocket ws = webSocketRef.get(); diff --git a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/PodOperationsImpl.java b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/PodOperationsImpl.java index f1b8894f8ac..26696e8e913 100644 --- a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/PodOperationsImpl.java +++ b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/PodOperationsImpl.java @@ -47,6 +47,7 @@ import io.fabric8.kubernetes.client.dsl.PrettyLoggable; import io.fabric8.kubernetes.client.dsl.TailPrettyLoggable; import io.fabric8.kubernetes.client.dsl.TimeTailPrettyLoggable; +import io.fabric8.kubernetes.client.dsl.TtyExecErrorChannelable; import io.fabric8.kubernetes.client.dsl.BytesLimitTerminateTimeTailPrettyLoggable; import io.fabric8.kubernetes.client.dsl.TtyExecErrorable; import io.fabric8.kubernetes.client.dsl.TtyExecOutputErrorable; @@ -65,10 +66,12 @@ public class PodOperationsImpl extends HasMetadataOperation labels, Map labelsNot, Map labelsIn, Map labelsNotIn, Map fields) { this(client, config, apiVersion, namespace, name, cascading, item, resourceVersion, reloadingFromServer, gracePeriodSeconds, labels, labelsNot, labelsIn, labelsNotIn, fields, - null, null, null, null, null, null, null, false, false, false, null, null, null, false, null, null); + null, null, null, null, null, null, null, null, null, false, false, false, null, null, null, false, null, null); } - public PodOperationsImpl(OkHttpClient client, Config config, String apiVersion, String namespace, String name, Boolean cascading, Pod item, String resourceVersion, Boolean reloadingFromServer, long gracePeriodSeconds, Map labels, Map labelsNot, Map labelsIn, Map labelsNotIn, Map fields, String containerId, InputStream in, PipedOutputStream inPipe, OutputStream out, PipedInputStream outPipe, OutputStream err, PipedInputStream errPipe, boolean withTTY, boolean withTerminatedStatus, boolean withTimestamps, String sinceTimestamp, Integer sinceSeconds, Integer withTailingLines, boolean withPrettyOutput, ExecListener execListener, Integer limitBytes) { + public PodOperationsImpl(OkHttpClient client, Config config, String apiVersion, String namespace, String name, Boolean cascading, Pod item, String resourceVersion, Boolean reloadingFromServer, long gracePeriodSeconds, Map labels, Map labelsNot, Map labelsIn, Map labelsNotIn, Map fields, String containerId, InputStream in, PipedOutputStream inPipe, OutputStream out, PipedInputStream outPipe, OutputStream err, PipedInputStream errPipe, OutputStream errChannel, PipedInputStream errChannelPipe, boolean withTTY, boolean withTerminatedStatus, boolean withTimestamps, String sinceTimestamp, Integer sinceSeconds, Integer withTailingLines, boolean withPrettyOutput, ExecListener execListener, Integer limitBytes) { super(client, config, null, apiVersion, "pods", namespace, name, cascading, item, resourceVersion, reloadingFromServer, gracePeriodSeconds, labels, labelsNot, labelsIn, labelsNotIn, fields); this.containerId = containerId; this.in = in; @@ -98,6 +101,8 @@ public PodOperationsImpl(OkHttpClient client, Config config, String apiVersion, this.outPipe = outPipe; this.err = err; this.errPipe = errPipe; + this.errChannel = errChannel; + this.errChannelPipe = errChannelPipe; this.withTTY = withTTY; this.withTerminatedStatus = withTerminatedStatus; this.withTimestamps = withTimestamps; @@ -166,7 +171,7 @@ public Reader getLogReader() { @Override public String getLog(Boolean isPretty) { - return new PodOperationsImpl(client, getConfig(), apiVersion, namespace, name, isCascading(), getItem(), getResourceVersion(), isReloadingFromServer(), getGracePeriodSeconds(), getLabels(), getLabelsNot(), getLabelsIn(), getLabelsNotIn(), getFields(), containerId, in, inPipe, out, outPipe, err, errPipe, withTTY, withTerminatedStatus, withTimestamps, sinceTimestamp, sinceSeconds, withTailingLines, isPretty, execListener, limitBytes).getLog(); + return new PodOperationsImpl(client, getConfig(), apiVersion, namespace, name, isCascading(), getItem(), getResourceVersion(), isReloadingFromServer(), getGracePeriodSeconds(), getLabels(), getLabelsNot(), getLabelsIn(), getLabelsNotIn(), getFields(), containerId, in, inPipe, out, outPipe, err, errPipe, errChannel, errChannelPipe, withTTY, withTerminatedStatus, withTimestamps, sinceTimestamp, sinceSeconds, withTailingLines, isPretty, execListener, limitBytes).getLog(); } @Override @@ -218,7 +223,7 @@ public LocalPortForward portForward(int port, int localPort) { @Override public ContainerResource inContainer(String containerId) { - return new PodOperationsImpl(client, getConfig(), apiVersion, namespace, name, isCascading(), getItem(), getResourceVersion(), isReloadingFromServer(), getGracePeriodSeconds(), getLabels(), getLabelsNot(), getLabelsIn(), getLabelsNotIn(), getFields(), containerId, in, inPipe, out, outPipe, err, errPipe, withTTY, withTerminatedStatus, withTimestamps, sinceTimestamp, sinceSeconds, withTailingLines, withPrettyOutput, execListener, limitBytes); + return new PodOperationsImpl(client, getConfig(), apiVersion, namespace, name, isCascading(), getItem(), getResourceVersion(), isReloadingFromServer(), getGracePeriodSeconds(), getLabels(), getLabelsNot(), getLabelsIn(), getLabelsNotIn(), getFields(), containerId, in, inPipe, out, outPipe, err, errPipe, errChannel, errChannelPipe, withTTY, withTerminatedStatus, withTimestamps, sinceTimestamp, sinceSeconds, withTailingLines, withPrettyOutput, execListener, limitBytes); } @Override @@ -256,9 +261,9 @@ public ExecWatch exec(String... command) { try { URL url = new URL(URLUtils.join(getResourceUrl().toString(), sb.toString())); - Request.Builder r = new Request.Builder().url(url).get(); + Request.Builder r = new Request.Builder().url(url).header("Sec-WebSocket-Protocol", "v4.channel.k8s.io").get(); OkHttpClient clone = client.newBuilder().readTimeout(0, TimeUnit.MILLISECONDS).build(); - final ExecWebSocketListener execWebSocketListener = new ExecWebSocketListener(in, out, err, inPipe, outPipe, errPipe, execListener); + final ExecWebSocketListener execWebSocketListener = new ExecWebSocketListener(new Config(), in, out, err, errChannel, inPipe, outPipe, errPipe, errChannelPipe, execListener); clone.newWebSocket(r.build(), execWebSocketListener); execWebSocketListener.waitUntilReady(); return execWebSocketListener; @@ -269,12 +274,12 @@ public ExecWatch exec(String... command) { @Override public TtyExecOutputErrorable readingInput(InputStream in) { - return new PodOperationsImpl(client, getConfig(), apiVersion, namespace, name, isCascading(), getItem(), getResourceVersion(), isReloadingFromServer(), getGracePeriodSeconds(), getLabels(), getLabelsNot(), getLabelsIn(), getLabelsNotIn(), getFields(), containerId, in, inPipe, out, outPipe, err, errPipe, withTTY, withTerminatedStatus, withTimestamps, sinceTimestamp, sinceSeconds, withTailingLines, withPrettyOutput, execListener, limitBytes); + return new PodOperationsImpl(client, getConfig(), apiVersion, namespace, name, isCascading(), getItem(), getResourceVersion(), isReloadingFromServer(), getGracePeriodSeconds(), getLabels(), getLabelsNot(), getLabelsIn(), getLabelsNotIn(), getFields(), containerId, in, inPipe, out, outPipe, err, errPipe, errChannel, errChannelPipe, withTTY, withTerminatedStatus, withTimestamps, sinceTimestamp, sinceSeconds, withTailingLines, withPrettyOutput, execListener, limitBytes); } @Override public TtyExecOutputErrorable writingInput(PipedOutputStream inPipe) { - return new PodOperationsImpl(client, getConfig(), apiVersion, namespace, name, isCascading(), getItem(), getResourceVersion(), isReloadingFromServer(), getGracePeriodSeconds(), getLabels(), getLabelsNot(), getLabelsIn(), getLabelsNotIn(), getFields(), containerId, in, inPipe, out, outPipe, err, errPipe, withTTY, withTerminatedStatus, withTimestamps, sinceTimestamp, sinceSeconds, withTailingLines, withPrettyOutput, execListener, limitBytes); + return new PodOperationsImpl(client, getConfig(), apiVersion, namespace, name, isCascading(), getItem(), getResourceVersion(), isReloadingFromServer(), getGracePeriodSeconds(), getLabels(), getLabelsNot(), getLabelsIn(), getLabelsNotIn(), getFields(), containerId, in, inPipe, out, outPipe, err, errPipe, errChannel, errChannelPipe, withTTY, withTerminatedStatus, withTimestamps, sinceTimestamp, sinceSeconds, withTailingLines, withPrettyOutput, execListener, limitBytes); } @Override @@ -284,12 +289,12 @@ public TtyExecOutputErrorable @Override public TtyExecErrorable writingOutput(OutputStream out) { - return new PodOperationsImpl(client, getConfig(), apiVersion, namespace, name, isCascading(), getItem(), getResourceVersion(), isReloadingFromServer(), getGracePeriodSeconds(), getLabels(), getLabelsNot(), getLabelsIn(), getLabelsNotIn(), getFields(), containerId, in, inPipe, out, outPipe, err, errPipe, withTTY, withTerminatedStatus, withTimestamps, sinceTimestamp, sinceSeconds, withTailingLines, withPrettyOutput, execListener, limitBytes); + return new PodOperationsImpl(client, getConfig(), apiVersion, namespace, name, isCascading(), getItem(), getResourceVersion(), isReloadingFromServer(), getGracePeriodSeconds(), getLabels(), getLabelsNot(), getLabelsIn(), getLabelsNotIn(), getFields(), containerId, in, inPipe, out, outPipe, err, errPipe, errChannel, errChannelPipe, withTTY, withTerminatedStatus, withTimestamps, sinceTimestamp, sinceSeconds, withTailingLines, withPrettyOutput, execListener, limitBytes); } @Override public TtyExecErrorable readingOutput(PipedInputStream outPipe) { - return new PodOperationsImpl(client, getConfig(), apiVersion, namespace, name, isCascading(), getItem(), getResourceVersion(), isReloadingFromServer(), getGracePeriodSeconds(), getLabels(), getLabelsNot(), getLabelsIn(), getLabelsNotIn(), getFields(), containerId, in, inPipe, out, outPipe, err, errPipe, withTTY, withTerminatedStatus, withTimestamps, sinceTimestamp, sinceSeconds, withTailingLines, withPrettyOutput, execListener, limitBytes); + return new PodOperationsImpl(client, getConfig(), apiVersion, namespace, name, isCascading(), getItem(), getResourceVersion(), isReloadingFromServer(), getGracePeriodSeconds(), getLabels(), getLabelsNot(), getLabelsIn(), getLabelsNotIn(), getFields(), containerId, in, inPipe, out, outPipe, err, errPipe, errChannel, errChannelPipe, withTTY, withTerminatedStatus, withTimestamps, sinceTimestamp, sinceSeconds, withTailingLines, withPrettyOutput, execListener, limitBytes); } @Override @@ -298,60 +303,76 @@ public TtyExecErrorable redir } @Override - public TtyExecable writingError(OutputStream err) { - return new PodOperationsImpl(client, getConfig(), apiVersion, namespace, name, isCascading(), getItem(), getResourceVersion(), isReloadingFromServer(), getGracePeriodSeconds(), getLabels(), getLabelsNot(), getLabelsIn(), getLabelsNotIn(), getFields(), containerId, in, inPipe, out, outPipe, err, errPipe, withTTY, withTerminatedStatus, withTimestamps, sinceTimestamp, sinceSeconds, withTailingLines, withPrettyOutput, execListener, limitBytes); + public TtyExecErrorChannelable writingError(OutputStream err) { + return new PodOperationsImpl(client, getConfig(), apiVersion, namespace, name, isCascading(), getItem(), getResourceVersion(), isReloadingFromServer(), getGracePeriodSeconds(), getLabels(), getLabelsNot(), getLabelsIn(), getLabelsNotIn(), getFields(), containerId, in, inPipe, out, outPipe, err, errPipe, errChannel, errChannelPipe, withTTY, withTerminatedStatus, withTimestamps, sinceTimestamp, sinceSeconds, withTailingLines, withPrettyOutput, execListener, limitBytes); } @Override - public TtyExecable readingError(PipedInputStream errPipe) { - return new PodOperationsImpl(client, getConfig(), apiVersion, namespace, name, isCascading(), getItem(), getResourceVersion(), isReloadingFromServer(), getGracePeriodSeconds(), getLabels(), getLabelsNot(), getLabelsIn(), getLabelsNotIn(), getFields(), containerId, in, inPipe, out, outPipe, err, errPipe, withTTY, withTerminatedStatus, withTimestamps, sinceTimestamp, sinceSeconds, withTailingLines, withPrettyOutput, execListener, limitBytes); + public TtyExecErrorChannelable readingError(PipedInputStream errPipe) { + return new PodOperationsImpl(client, getConfig(), apiVersion, namespace, name, isCascading(), getItem(), getResourceVersion(), isReloadingFromServer(), getGracePeriodSeconds(), getLabels(), getLabelsNot(), getLabelsIn(), getLabelsNotIn(), getFields(), containerId, in, inPipe, out, outPipe, err, errPipe, errChannel, errChannelPipe, withTTY, withTerminatedStatus, withTimestamps, sinceTimestamp, sinceSeconds, withTailingLines, withPrettyOutput, execListener, limitBytes); } @Override - public TtyExecable redirectingError() { + public TtyExecErrorChannelable redirectingError() { return readingError(new PipedInputStream()); } + @Override + public TtyExecable writingErrorChannel(OutputStream errChannel) { + return new PodOperationsImpl(client, getConfig(), apiVersion, namespace, name, isCascading(), getItem(), getResourceVersion(), isReloadingFromServer(), getGracePeriodSeconds(), getLabels(), getLabelsNot(), getLabelsIn(), getLabelsNotIn(), getFields(), containerId, in, inPipe, out, outPipe, err, errPipe, errChannel, errChannelPipe, withTTY, withTerminatedStatus, withTimestamps, sinceTimestamp, sinceSeconds, withTailingLines, withPrettyOutput, execListener, limitBytes); + } + + @Override + public TtyExecable readingErrorChannel(PipedInputStream errChannelPipe) { + return new PodOperationsImpl(client, getConfig(), apiVersion, namespace, name, isCascading(), getItem(), getResourceVersion(), isReloadingFromServer(), getGracePeriodSeconds(), getLabels(), getLabelsNot(), getLabelsIn(), getLabelsNotIn(), getFields(), containerId, in, inPipe, out, outPipe, err, errPipe, errChannel, errChannelPipe, withTTY, withTerminatedStatus, withTimestamps, sinceTimestamp, sinceSeconds, withTailingLines, withPrettyOutput, execListener, limitBytes); + } + + @Override + public TtyExecable redirectingErrorChannel() { + return readingErrorChannel(new PipedInputStream()); + } + + @Override public ExecListenable withTTY() { - return new PodOperationsImpl(client, getConfig(), apiVersion, namespace, name, isCascading(), getItem(), getResourceVersion(), isReloadingFromServer(), getGracePeriodSeconds(), getLabels(), getLabelsNot(), getLabelsIn(), getLabelsNotIn(), getFields(), containerId, in, inPipe, out, outPipe, err, errPipe, true, withTerminatedStatus, withTimestamps, sinceTimestamp, sinceSeconds, withTailingLines, withPrettyOutput, execListener, limitBytes); + return new PodOperationsImpl(client, getConfig(), apiVersion, namespace, name, isCascading(), getItem(), getResourceVersion(), isReloadingFromServer(), getGracePeriodSeconds(), getLabels(), getLabelsNot(), getLabelsIn(), getLabelsNotIn(), getFields(), containerId, in, inPipe, out, outPipe, err, errPipe, errChannel, errChannelPipe, true, withTerminatedStatus, withTimestamps, sinceTimestamp, sinceSeconds, withTailingLines, withPrettyOutput, execListener, limitBytes); } @Override public Loggable withPrettyOutput() { - return new PodOperationsImpl(client, getConfig(), apiVersion, namespace, name, isCascading(), getItem(), getResourceVersion(), isReloadingFromServer(), getGracePeriodSeconds(), getLabels(), getLabelsNot(), getLabelsIn(), getLabelsNotIn(), getFields(), containerId, in, inPipe, out, outPipe, err, errPipe, withTTY, withTerminatedStatus, withTimestamps, sinceTimestamp, sinceSeconds, withTailingLines, true, execListener, limitBytes); + return new PodOperationsImpl(client, getConfig(), apiVersion, namespace, name, isCascading(), getItem(), getResourceVersion(), isReloadingFromServer(), getGracePeriodSeconds(), getLabels(), getLabelsNot(), getLabelsIn(), getLabelsNotIn(), getFields(), containerId, in, inPipe, out, outPipe, err, errPipe, errChannel, errChannelPipe, withTTY, withTerminatedStatus, withTimestamps, sinceTimestamp, sinceSeconds, withTailingLines, true, execListener, limitBytes); } @Override public PrettyLoggable tailingLines(int withTailingLines) { - return new PodOperationsImpl(client, getConfig(), apiVersion, namespace, name, isCascading(), getItem(), getResourceVersion(), isReloadingFromServer(), getGracePeriodSeconds(), getLabels(), getLabelsNot(), getLabelsIn(), getLabelsNotIn(), getFields(), containerId, in, inPipe, out, outPipe, err, errPipe, withTTY, withTerminatedStatus, withTimestamps, sinceTimestamp, sinceSeconds, withTailingLines, withPrettyOutput, execListener, limitBytes); + return new PodOperationsImpl(client, getConfig(), apiVersion, namespace, name, isCascading(), getItem(), getResourceVersion(), isReloadingFromServer(), getGracePeriodSeconds(), getLabels(), getLabelsNot(), getLabelsIn(), getLabelsNotIn(), getFields(), containerId, in, inPipe, out, outPipe, err, errPipe, errChannel, errChannelPipe, withTTY, withTerminatedStatus, withTimestamps, sinceTimestamp, sinceSeconds, withTailingLines, withPrettyOutput, execListener, limitBytes); } @Override public TailPrettyLoggable sinceTime(String sinceTimestamp) { - return new PodOperationsImpl(client, getConfig(), apiVersion, namespace, name, isCascading(), getItem(), getResourceVersion(), isReloadingFromServer(), getGracePeriodSeconds(), getLabels(), getLabelsNot(), getLabelsIn(), getLabelsNotIn(), getFields(), containerId, in, inPipe, out, outPipe, err, errPipe, withTTY, withTerminatedStatus, withTimestamps, sinceTimestamp, sinceSeconds, withTailingLines, withPrettyOutput, execListener, limitBytes); + return new PodOperationsImpl(client, getConfig(), apiVersion, namespace, name, isCascading(), getItem(), getResourceVersion(), isReloadingFromServer(), getGracePeriodSeconds(), getLabels(), getLabelsNot(), getLabelsIn(), getLabelsNotIn(), getFields(), containerId, in, inPipe, out, outPipe, err, errPipe, errChannel, errChannelPipe, withTTY, withTerminatedStatus, withTimestamps, sinceTimestamp, sinceSeconds, withTailingLines, withPrettyOutput, execListener, limitBytes); } @Override public TailPrettyLoggable sinceSeconds(int sinceSeconds) { - return new PodOperationsImpl(client, getConfig(), apiVersion, namespace, name, isCascading(), getItem(), getResourceVersion(), isReloadingFromServer(), getGracePeriodSeconds(), getLabels(), getLabelsNot(), getLabelsIn(), getLabelsNotIn(), getFields(), containerId, in, inPipe, out, outPipe, err, errPipe, withTTY, withTerminatedStatus, withTimestamps, sinceTimestamp, sinceSeconds, withTailingLines, withPrettyOutput, execListener, limitBytes); + return new PodOperationsImpl(client, getConfig(), apiVersion, namespace, name, isCascading(), getItem(), getResourceVersion(), isReloadingFromServer(), getGracePeriodSeconds(), getLabels(), getLabelsNot(), getLabelsIn(), getLabelsNotIn(), getFields(), containerId, in, inPipe, out, outPipe, err, errPipe, errChannel, errChannelPipe, withTTY, withTerminatedStatus, withTimestamps, sinceTimestamp, sinceSeconds, withTailingLines, withPrettyOutput, execListener, limitBytes); } @Override public TimeTailPrettyLoggable terminated() { - return new PodOperationsImpl(client, getConfig(), apiVersion, namespace, name, isCascading(), getItem(), getResourceVersion(), isReloadingFromServer(), getGracePeriodSeconds(), getLabels(), getLabelsNot(), getLabelsIn(), getLabelsNotIn(), getFields(), containerId, in, inPipe, out, outPipe, err, errPipe, withTTY, true, withTimestamps, sinceTimestamp, sinceSeconds, withTailingLines, withPrettyOutput, execListener, limitBytes); + return new PodOperationsImpl(client, getConfig(), apiVersion, namespace, name, isCascading(), getItem(), getResourceVersion(), isReloadingFromServer(), getGracePeriodSeconds(), getLabels(), getLabelsNot(), getLabelsIn(), getLabelsNotIn(), getFields(), containerId, in, inPipe, out, outPipe, err, errPipe, errChannel, errChannelPipe, withTTY, true, withTimestamps, sinceTimestamp, sinceSeconds, withTailingLines, withPrettyOutput, execListener, limitBytes); } @Override public Execable usingListener(ExecListener execListener) { - return new PodOperationsImpl(client, getConfig(), apiVersion, namespace, name, isCascading(), getItem(), getResourceVersion(), isReloadingFromServer(), getGracePeriodSeconds(), getLabels(), getLabelsNot(), getLabelsIn(), getLabelsNotIn(), getFields(), containerId, in, inPipe, out, outPipe, err, errPipe, withTTY, withTerminatedStatus, withTimestamps, sinceTimestamp, sinceSeconds, withTailingLines, withPrettyOutput, execListener, limitBytes); + return new PodOperationsImpl(client, getConfig(), apiVersion, namespace, name, isCascading(), getItem(), getResourceVersion(), isReloadingFromServer(), getGracePeriodSeconds(), getLabels(), getLabelsNot(), getLabelsIn(), getLabelsNotIn(), getFields(), containerId, in, inPipe, out, outPipe, err, errPipe, errChannel, errChannelPipe, withTTY, withTerminatedStatus, withTimestamps, sinceTimestamp, sinceSeconds, withTailingLines, withPrettyOutput, execListener, limitBytes); } @Override public BytesLimitTerminateTimeTailPrettyLoggable limitBytes(int limitBytes) { - return new PodOperationsImpl(client, getConfig(), apiVersion, namespace, name, isCascading(), getItem(), getResourceVersion(), isReloadingFromServer(), getGracePeriodSeconds(), getLabels(), getLabelsNot(), getLabelsIn(), getLabelsNotIn(), getFields(), containerId, in, inPipe, out, outPipe, err, errPipe, withTTY, withTerminatedStatus, withTimestamps, sinceTimestamp, sinceSeconds, withTailingLines, withPrettyOutput, execListener, limitBytes); + return new PodOperationsImpl(client, getConfig(), apiVersion, namespace, name, isCascading(), getItem(), getResourceVersion(), isReloadingFromServer(), getGracePeriodSeconds(), getLabels(), getLabelsNot(), getLabelsIn(), getLabelsNotIn(), getFields(), containerId, in, inPipe, out, outPipe, err, errPipe, errChannel, errChannelPipe, withTTY, withTerminatedStatus, withTimestamps, sinceTimestamp, sinceSeconds, withTailingLines, withPrettyOutput, execListener, limitBytes); } } diff --git a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/handlers/PodHandler.java b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/handlers/PodHandler.java index 37a32761794..ad8467124c9 100644 --- a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/handlers/PodHandler.java +++ b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/handlers/PodHandler.java @@ -40,17 +40,17 @@ public String getKind() { @Override public Pod create(OkHttpClient client, Config config, String namespace, Pod item) { - return new PodOperationsImpl(client, config, null, namespace, null, true, item, null, false, -1, new TreeMap(), new TreeMap(), new TreeMap(), new TreeMap(), new TreeMap(), null, null, null, null, null, null, null, false, false, false, null, null, null, false, null, null).create(); + return new PodOperationsImpl(client, config, null, namespace, null, true, item, null, false, -1, new TreeMap(), new TreeMap(), new TreeMap(), new TreeMap(), new TreeMap(), null, null, null, null, null, null, null, null, null, false, false, false, null, null, null, false, null, null).create(); } @Override public Pod replace(OkHttpClient client, Config config, String namespace, Pod item) { - return new PodOperationsImpl(client, config, null, namespace, null, true, item, null, true, -1, new TreeMap(), new TreeMap(), new TreeMap(), new TreeMap(), new TreeMap(), null, null, null, null, null, null, null, false, false, false, null, null, null, false, null, null).replace(item); + return new PodOperationsImpl(client, config, null, namespace, null, true, item, null, true, -1, new TreeMap(), new TreeMap(), new TreeMap(), new TreeMap(), new TreeMap(), null, null, null, null, null, null, null, null, null, false, false, false, null, null, null, false, null, null).replace(item); } @Override public Pod reload(OkHttpClient client, Config config, String namespace, Pod item) { - return new PodOperationsImpl(client, config, null, namespace, null, true, item, null, false, -1, new TreeMap(), new TreeMap(), new TreeMap(), new TreeMap(), new TreeMap(), null, null, null, null, null, null, null, false, false, false, null, null, null, false, null, null).fromServer().get(); + return new PodOperationsImpl(client, config, null, namespace, null, true, item, null, false, -1, new TreeMap(), new TreeMap(), new TreeMap(), new TreeMap(), new TreeMap(), null, null, null, null, null, null, null, null, null, false, false, false, null, null, null, false, null, null).fromServer().get(); } @Override @@ -60,21 +60,21 @@ public PodBuilder edit(Pod item) { @Override public Boolean delete(OkHttpClient client, Config config, String namespace, Pod item) { - return new PodOperationsImpl(client, config, null, namespace, null, true, item, null, false, -1, new TreeMap(), new TreeMap(), new TreeMap(), new TreeMap(), new TreeMap(), null, null, null, null, null, null, null, false, false, false, null, null, null, false, null, null).delete(item); + return new PodOperationsImpl(client, config, null, namespace, null, true, item, null, false, -1, new TreeMap(), new TreeMap(), new TreeMap(), new TreeMap(), new TreeMap(), null, null, null, null, null, null, null, null, null, false, false, false, null, null, null, false, null, null).delete(item); } @Override public Watch watch(OkHttpClient client, Config config, String namespace, Pod item, Watcher watcher) { - return new PodOperationsImpl(client, config, null, namespace, null, true, item, null, false, -1, new TreeMap(), new TreeMap(), new TreeMap(), new TreeMap(), new TreeMap(), null, null, null, null, null, null, null, false, false, false, null, null, null, false, null, null).watch(watcher); + return new PodOperationsImpl(client, config, null, namespace, null, true, item, null, false, -1, new TreeMap(), new TreeMap(), new TreeMap(), new TreeMap(), new TreeMap(), null, null, null, null, null, null, null, null, null, false, false, false, null, null, null, false, null, null).watch(watcher); } @Override public Watch watch(OkHttpClient client, Config config, String namespace, Pod item, String resourceVersion, Watcher watcher) { - return new PodOperationsImpl(client, config, null, namespace, null, true, item, null, false, -1, new TreeMap(), new TreeMap(), new TreeMap(), new TreeMap(), new TreeMap(), null, null, null, null, null, null, null, false, false, false, null, null, null, false, null, null).watch(resourceVersion, watcher); + return new PodOperationsImpl(client, config, null, namespace, null, true, item, null, false, -1, new TreeMap(), new TreeMap(), new TreeMap(), new TreeMap(), new TreeMap(), null, null, null, null, null, null, null, null, null, false, false, false, null, null, null, false, null, null).watch(resourceVersion, watcher); } @Override public Pod waitUntilReady(OkHttpClient client, Config config, String namespace, Pod item, long amount, TimeUnit timeUnit) throws InterruptedException { - return new PodOperationsImpl(client, config, null, namespace, null, true, item, null, false, -1, new TreeMap(), new TreeMap(), new TreeMap(), new TreeMap(), new TreeMap(), null, null, null, null, null, null, null, false, false, false, null, null, null, false, null, null).waitUntilReady(amount,timeUnit); + return new PodOperationsImpl(client, config, null, namespace, null, true, item, null, false, -1, new TreeMap(), new TreeMap(), new TreeMap(), new TreeMap(), new TreeMap(), null, null, null, null, null, null, null, null, null, false, false, false, null, null, null, false, null, null).waitUntilReady(amount,timeUnit); } } diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/ExecLoopExample.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/ExecLoopExample.java index 92234d0d3d3..a86c4f04384 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/ExecLoopExample.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/ExecLoopExample.java @@ -18,7 +18,6 @@ import io.fabric8.kubernetes.client.Callback; import io.fabric8.kubernetes.client.Config; import io.fabric8.kubernetes.client.ConfigBuilder; - import io.fabric8.kubernetes.client.KubernetesClientException; import io.fabric8.kubernetes.client.dsl.ExecListener; import io.fabric8.kubernetes.client.dsl.ExecWatch; import io.fabric8.kubernetes.client.utils.InputStreamPumper; @@ -28,7 +27,6 @@ import java.io.IOException; import java.util.concurrent.CountDownLatch; - import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.ScheduledExecutorService; diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/ExecPipesExample.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/ExecPipesExample.java index 3e6d9dfe826..63bbd9592c4 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/ExecPipesExample.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/ExecPipesExample.java @@ -49,6 +49,8 @@ public static void main(String[] args) throws InterruptedException, IOException ExecWatch watch = client.pods().withName(podName) .redirectingInput() .redirectingOutput() + .redirectingError() + .redirectingErrorChannel() .exec(); InputStreamPumper pump = new InputStreamPumper(watch.getOutput(), new SystemOutCallback())) {