-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Conversation
@@ -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: ") |
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.
Did you meant to add this? It'll be very noisy.
http.Handle("/apps/create", createAppHandler) | ||
http.Handle("/liveness", livenessHandler) |
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.
Use /healthz
?
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.
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!" |
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.
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?
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.
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.
bootstrap/cmd/bootstrap/app/SaKey.go
Outdated
|
||
c, err := iamadmin.NewIamClient(ctx, option.WithTokenSource(ts)) | ||
if err != nil { | ||
log.Errorf("Can now create iam admin client: %v", err) |
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.
"Cannot"*
Name: request.SecretName, | ||
}, | ||
Data: secretData, | ||
}) |
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.
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?
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.
It's synchronous. When handler returns, either the sa key already inserted into GKE or an error happened and included in response.
I took a look; I don't have anything to add beyond @yebrahim's comments. |
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.
nit: rename LiveRequest
and LiveResponse
too? LGTM otherwise, thanks.
Awesome, thanks! |
/approve |
[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 |
…dler (kubeflow#1329) * add service account key handler to go backend, and a check health handler * handle review feedback * update struct name
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