Add function in payload instead of just metadata (#1919)

Passing information of function from router to executor is more efficient than calling the K8S API. This change does that instead of passing only metadata and then executor calling the K8S API again.
This commit is contained in:
Rahul Bhati
2021-03-10 14:52:23 +05:30
committed by GitHub
parent c7d448ca49
commit cc552d9777
4 changed files with 8 additions and 20 deletions
+2 -2
View File
@@ -70,10 +70,10 @@ func MakeClient(logger *zap.Logger, executorURL string) *Client {
}
// GetServiceForFunction returns the service name for a given function.
func (c *Client) GetServiceForFunction(ctx context.Context, metadata *metav1.ObjectMeta) (string, error) {
func (c *Client) GetServiceForFunction(ctx context.Context, fn *fv1.Function) (string, error) {
executorURL := c.executorURL + "/v2/getServiceForFunction"
body, err := json.Marshal(metadata)
body, err := json.Marshal(fn)
if err != nil {
return "", errors.Wrap(err, "could not marshal request body for getting service for function")
}