New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[kfctl web app] frontend & backend update to agree with api changes #1372
Conversation
{ | ||
body: JSON.stringify( | ||
{ | ||
Msg: 'Echo from web app?', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer the communication with the Go backend is transparent to the user. Echoes would seem strange here, we can just display a message saying "Could not reach server" or something.
const msg = JSON.parse(response.body).Reply; | ||
this._appendLine('From Backend' + msg); | ||
} else { | ||
this._appendLine('Backend error: ' + response.statusCode); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably fail the deployment at this point, no? What's the point of continuing if we won't be able to pass on the token and create the service account key, etc?
}, | ||
(error, response, body) => { | ||
if (!error) { | ||
const msg = JSON.parse(response.body).Reply; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's always wrap JSON.parse
calls in a try/catch
, especially since we don't have string API typings (protos or such). If the server decides to return something else here, the client should handle this gracefully by showing an error dialog, instead of things just stopping to work.
do { | ||
getAttempts++; | ||
await wait(getTimeout); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why move the wait up here? We should only wait after each call fails right? I think that's what the old code does.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want to always wait:
even call succeeded, if the returned status is "RUNNING", we will still wait for 20s.
So in total we wait up to 20*30 (10 min), till deployment manager successfully set up every thing (usually finish within 5 min).
continue; | ||
} | ||
status = curStatus.operation!.status!; | ||
} while (status !== 'DONE' && getAttempts < 20); | ||
this._appendLine(`Status of ${deploymentName}: ` + status); | ||
} while (status !== 'DONE' && getAttempts < 30); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add one more check on getAttempts
after the while
loop is done. If it's equal to 30, that means we've waited too long, and we should show a suitable timeout error message.
continue; | ||
} | ||
status = curStatus.operation!.status!; | ||
} while (status !== 'DONE' && getAttempts < 20); | ||
this._appendLine(`Status of ${deploymentName}: ` + status); | ||
} while (status !== 'DONE' && getAttempts < 30); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to check other values of the deployment status, and exit the loop with an error if the deployment failed for example.
/hold |
Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 10 files reviewed, 8 unresolved discussions (waiting on @yebrahim, @kunmingg, @pdmack, @lluunn, and @jlewi)
bootstrap/cmd/bootstrap/app/ksServer.go, line 569 at r2 (raw file):
defer a.mux.Unlock() roleBinding := v1.ClusterRoleBinding{
Can you add a TODO to create a K8s yaml file in the app directory that defines the cluster role binding?
components/gcp-click-to-deploy/src/configs/cluster.jinja, line 25 at r2 (raw file):
#} {% set TYPE_NAME = NAME_PREFIX + '-type' %} {% set NAMESPACE_COLLECTION = '/api/v1/namespaces' %}
Do we still need a copy of the DM configs in cluster gcp-click-to-deploy-app?
I think we use to be loading them into the frontend and doing the DM substitution in the JS frontend; but I thought that's no longer the case.
Isn't the go backend doing the substitution now?
Can the go backend download the DM configs from the GitHub URL?
If we need a copy of the DM configs, can we just have the build process copy the existing configs into the container so we don't have have to worry about them getting out of sync?
@jlewi DM config update is the only piece left on frontend side, will migrate to backend, and merge with script's DM config in following PRs of this sprint. |
Makes sense thanks. /lgtm This looks good on my end. @yebrahim Any additional comments? /hold. |
Looks like an Argo test failure |
do { | ||
initAttempts++; | ||
await wait(initTimeout); | ||
} while (!readiness && initAttempts < 10); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this work? readiness
isn't being changed in the loop body. This will always either wait for 10*2000 ms or not wait at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
readiness
is changed in previous call back function, here the loop is to make sure call back updated the status.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you're await
ing the request call (line 426), then the next code block will execute only when that call is finished and the callback is executed. It seems to me what you're trying to do here is run the request in parallel to this code block (starting line 456), which isn't how you should do this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In fact, I just noticed the request
library isn't installed as a dependency, only it's typings. This should not be working.
You can just use the built-in fetch
API. It's supported by all major browsers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which one is not working? This PR has been deployed to kubeflow.dev
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code that calls request(...
has not been deployed to kubeflow.dev. It's been a while since there's been a deployment as far as I'm aware.
The code I meant by not working is the call using request
, that library isn't installed as part of the app, and this call will fail if the execution gets to it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We deployed this PR earlier on a new domain name. request
seems works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems request pkg was installed via @kubernetes/client-node
as a dependency, but we don't call k8s from js any more. Let me clean up unused dependencies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I see, that makes sense then, although we should explicitly install
request
as a dependency rather than rely on its existence by chance. - Can you send me the new domain name?
- My original comment is still valid I believe. If you want to wait for the request to come back use a Promise (either using
request
or using the build-infetch
), rather than manually wait in a loop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new address is: kfdeploy.kubeflow.dev
merge PR to unblock @lluunn
Will use promise in following PRs.
Just the one comment. Otherwise |
/retest |
/retest |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jlewi The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/unassign @pdmack |
/lgtm |
/hold cancel |
/retest |
…ubeflow#1372) * frontend update to integrate with backend api change * handle review feedbacks * more frontend & backend api update; deployment manager config update * update image name; update UI default value * secuirty update; use ksonnet api to apply components instead of run through bash * edit path for ingress * update for ingress rules * clean up js dependencies; update GKE version
* Change kubeflow-images-public to kubeflowkatib * Remove kubeflow-images-public from setup-katib script * Add test for early stopping * Fix early stopping settings * Add tags to all examples * Fix Katib config * Fix empty var in UI * Fix comment * Trigger Travis
…rom the secret (kubeflow#1372) * refactor: pipelines profile controller should get minio access keys from the secret * do not print secrets in log
Update API calls to backend service.
Now all manual steps are covered by backend:
Update:
Follow up:
This change is