Get the App
SLTechnology News&Howtos  ›  Servers  › 

Knative Serving Advanced: Knative Serving SDK

Shulou Source: shulou.com Published: 2022-06-03 02:01:19 09月11日 Update

Author | Niu Qiulin, technical expert of Aliyun Intelligent Business Group (Dongdao)

Introduction: through the previous series of articles, you already know how to manipulate various resources of Knative based on kubectl. But if you want to integrate Knative into your project, it is not enough to just use the command kubectl, and you also need to do integrated development based on Knative Serving SDK in your code. In this article, Dongdao, a technical expert of Aliyun Intelligent Business Group, will start with Knative Serving SDK and introduce how to develop serverless based on Knative SDK.

Golang Context

Before we officially introduce Knative Serving SDK, let's briefly introduce the mechanism of Golang Context. Because the initialization and information transmission of client and Informer in Knative Serving are completely based on Golang Context.

Golang is a Context introduced from version 1.7. the Context of Golang can simplify the data transmission, cancellation signal and expiration time between multiple goroutine and request domains. Context has two main functions:

Transfer necessary data; perform coordination control, such as terminating goroutein, setting timeout, etc. Context definition

Context itself is an interface.

Type Context interface {Deadline () (deadline time.Time, ok bool) Done ()

Tags: Code methods functions objects interfaces examples development logs time functions can be passed through data articles methods time resources procedures processing generation above Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Redmi Linux OPPO Reno Microsoft