Skip to content

Commit

Permalink
Fix loading logs when ui and workflow are in different namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Matyushentsev authored and Alexander Matyushentsev committed Nov 1, 2018
1 parent 94910ef commit 37808b1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v2.2.1
6 changes: 5 additions & 1 deletion scripts/build_docker.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
#!/bin/bash

CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
GIT_COMMIT=`git rev-parse --short HEAD`
VERSION=`cat ${CURRENT_DIR}/../VERSION`

set -e

TAG=${IMAGE_TAG:-'latest'}
TAG=${IMAGE_TAG:-"$VERSION-$GIT_COMMIT"}

docker build --build-arg ARGO_VERSION=${TAG} -t ${IMAGE_NAMESPACE:-`whoami`}/argoui:${TAG} .

Expand Down
8 changes: 5 additions & 3 deletions src/api/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,18 +101,20 @@ export function create(
async (req, res) => serve(res, () => (forceNamespaceIsolation ? crd.ns(namespace) : crd.ns(req.params.namespace)).workflows.get(req.params.name)));

app.get('/api/workflows/live', async (req, res) => {
const ns = getNamespace(req);

let updatesSource = new Observable((observer: Observer<any>) => {
const labelSelector = getWorkflowLabelSelector(req);
let stream = crd.ns(req.params.namespace).workflows.getStream({ qs: { watch: true, labelSelector: labelSelector.join(',') } });
let stream = (ns ? crd.ns(ns) : crd).workflows.getStream({ qs: { watch: true, labelSelector: labelSelector.join(',') } });
stream.on('end', () => observer.complete());
stream.on('error', (e) => observer.error(e));
stream.on('close', () => observer.complete());
stream = stream.pipe(new JSONStream());
stream.on('data', (data) => data && observer.next(data));
});
if (forceNamespaceIsolation || req.query.namespace) {
if (ns) {
updatesSource = updatesSource.filter((change) => {
return change.object.metadata.namespace === forceNamespaceIsolation ? namespace : req.query.namespace;
return change.object.metadata.namespace === ns;
});
}
if (req.query.name) {
Expand Down

0 comments on commit 37808b1

Please sign in to comment.