Skip to content
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

Merged
merged 8 commits into from Aug 29, 2018

Conversation

kunmingg
Copy link
Contributor

@kunmingg kunmingg commented Aug 15, 2018

Update API calls to backend service.
Now all manual steps are covered by backend:

Update:

  1. one-click-to-deploy works now on any projects.
  2. use DM config based on the one used by kfctl.
  3. backend security enhancement: make sure auth token only shorted lived in memory.
  4. ingress compatibility: simplify ingress rule & handle health check.

Follow up:

  1. (recommended) auto redirect when detect that IAP is up.
  2. (optional) polish UI elements

This change is Reviewable

{
body: JSON.stringify(
{
Msg: 'Echo from web app?',
Copy link
Contributor

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);
Copy link
Contributor

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;
Copy link
Contributor

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);
Copy link
Contributor

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.

Copy link
Contributor Author

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);

Copy link
Contributor

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);
Copy link
Contributor

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.

@kunmingg
Copy link
Contributor Author

/hold
Will update DM configs and add apply call.

@jlewi
Copy link
Contributor

jlewi commented Aug 17, 2018

Thanks.

Copy link
Contributor

@jlewi jlewi left a 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?

@kunmingg
Copy link
Contributor Author

@jlewi
About DM configs:
Because our priority is making deploy app works properly, this PR focus on making everything works.
(Tested and now the app works properly).
So take a shortcut here to unblock @lluunn 's web app update.

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.

@jlewi
Copy link
Contributor

jlewi commented Aug 22, 2018

Makes sense thanks.

/lgtm
/approve

This looks good on my end.

@yebrahim Any additional comments?

/hold.

@jlewi
Copy link
Contributor

jlewi commented Aug 22, 2018

Looks like an Argo test failure
/test all

do {
initAttempts++;
await wait(initTimeout);
} while (!readiness && initAttempts < 10);
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're awaiting 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.

Copy link
Contributor

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.

Copy link
Contributor Author

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

Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

Copy link
Contributor

@yebrahim yebrahim Aug 27, 2018

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-in fetch), rather than manually wait in a loop.

Copy link
Contributor Author

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.

@yebrahim
Copy link
Contributor

Just the one comment. Otherwise
/lgtm

@k8s-ci-robot k8s-ci-robot added lgtm and removed lgtm labels Aug 23, 2018
@kunmingg kunmingg changed the title [gcp-deployer] frontend update to integrate with backend api change [kfctl web app] frontend & backend update to agree with api changes Aug 24, 2018
@kunmingg
Copy link
Contributor Author

/retest

@kunmingg
Copy link
Contributor Author

/retest

@jlewi
Copy link
Contributor

jlewi commented Aug 25, 2018

@kunmingg Has @yebrahim's comment about the request package been addressed? I looked and couldn't tell if the dependencies had been cleaned up.

I'll lgtm it and if there are no more changes needed you can just cancel the hold

/lgtm
/approve
/hold

@k8s-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@pdmack
Copy link
Member

pdmack commented Aug 26, 2018

/unassign @pdmack

@k8s-ci-robot k8s-ci-robot removed the request for review from pdmack August 26, 2018 15:32
@k8s-ci-robot k8s-ci-robot removed the lgtm label Aug 29, 2018
@lluunn
Copy link
Contributor

lluunn commented Aug 29, 2018

/lgtm

@kunmingg
Copy link
Contributor Author

/hold cancel

@kunmingg
Copy link
Contributor Author

/retest

@k8s-ci-robot k8s-ci-robot merged commit b4c341c into kubeflow:master Aug 29, 2018
saffaalvi pushed a commit to StatCan/kubeflow that referenced this pull request Feb 11, 2021
…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
yanniszark pushed a commit to arrikto/kubeflow that referenced this pull request Feb 15, 2021
* 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
surajkota pushed a commit to surajkota/kubeflow that referenced this pull request Jun 13, 2022
…rom the secret (kubeflow#1372)

* refactor: pipelines profile controller should get minio access keys from the secret

* do not print secrets in log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants