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

[gcp-deployer] add service account key handler and a check health handler #1329

Merged
merged 3 commits into from
Aug 8, 2018

Conversation

kunmingg
Copy link
Contributor

@kunmingg kunmingg commented Aug 8, 2018

Add 2 handlers to web app go backend:

service account key handler:
given service account and tmp token, create service account key and insert into GKE cluster.

check health handler
check if backend respond to post request.


This change is Reviewable

@kunmingg
Copy link
Contributor Author

kunmingg commented Aug 8, 2018

/assign @jlewi @yebrahim

@@ -534,6 +566,7 @@ func decodeCreateAppRequest(_ context.Context, r *http.Request) (interface{}, er

// The same encoder can be used for all RPC responses.
func encodeResponse(_ context.Context, w http.ResponseWriter, response interface{}) error {
log.Info("encode response: ")
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you meant to add this? It'll be very noisy.

http.Handle("/apps/create", createAppHandler)
http.Handle("/liveness", livenessHandler)
Copy link
Contributor

Choose a reason for hiding this comment

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

Use /healthz?

Copy link
Contributor

Choose a reason for hiding this comment

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

Similarly, can makeLivenessEndpoint be makeHealthzEndpoint.. etc?

return func(ctx context.Context, request interface{}) (interface{}, error) {
req := request.(LiveRequest)
r := &LiveResponse{}
r.Reply = req.Msg + "accepted! Sill alive!"
Copy link
Contributor

Choose a reason for hiding this comment

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

Are there no other checks we want to perform here to make sure the entire system is up and running? If the endpoint returns a success code, can the caller then assume that all other services are up.. etc?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Currently this one only indicate backend is reachable and have cycles to respond to requests.

We can keep a server status variable to indicate backend status, which should kill the pod if needed so we have auto-start.
Let's create issue for it.


c, err := iamadmin.NewIamClient(ctx, option.WithTokenSource(ts))
if err != nil {
log.Errorf("Can now create iam admin client: %v", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

"Cannot"*

Name: request.SecretName,
},
Data: secretData,
})
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this call synchronous? What does the caller of the SA key endpoint expect to happen after making the API call? Do they then have to wait or poll somehow if they want to block on this operation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's synchronous. When handler returns, either the sa key already inserted into GKE or an error happened and included in response.

@jlewi
Copy link
Contributor

jlewi commented Aug 8, 2018

I took a look; I don't have anything to add beyond @yebrahim's comments.

Copy link
Contributor

@yebrahim yebrahim left a comment

Choose a reason for hiding this comment

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

nit: rename LiveRequest and LiveResponse too? LGTM otherwise, thanks.

@yebrahim
Copy link
Contributor

yebrahim commented Aug 8, 2018

Awesome, thanks!
/lgtm

@kunmingg
Copy link
Contributor Author

kunmingg commented Aug 8, 2018

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: kunmingg

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

@k8s-ci-robot k8s-ci-robot merged commit 1e9aa94 into kubeflow:master Aug 8, 2018
saffaalvi pushed a commit to StatCan/kubeflow that referenced this pull request Feb 11, 2021
…dler (kubeflow#1329)

* add service account key handler to go backend, and a check health handler

* handle review feedback

* update struct name
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.

5 participants