Inversion of native
It is not uncommon in software circles to see a breakthrough in problem-solving when developers address a known problem in a way that is completely opposite to previous attempts. These "Aha!" moments of solving problems using the opposite approach are often captured as eye-catching “inversion” design principles such as inversion of control and dependency inversion.
Is it possible to apply inversion to the nativeness of functions to conquer their limitations?
Designers of programming languages like Java and JavaScript did this by adopting new language syntax elements to accept functions and lambdas as first-class language citizens. This removed the necessity of cumbersome coding constructs for functional programming and streamlined construction of truly functional applications.
Knative does this for cloud functions. Instead of requiring serverless applications to be native to the cloud systems, Knative provides a cloud ecosystem that is adapted (native) to functions in the cloud. The ecosystem supports multiple SDLC phases, that is, design, build, deployment, and execution. It comprises pluggable components that are already supported by all major cloud providers. Moreover, the plug-in architecture of these components allows for replacement and customization.
Knative can address business, software design, delivery, infrastructure, and security concerns separately and in a vendor-independent way.
These concerns map into components of major Knative features: build, eventing, and serving. These features allow containerization of serverless applications with their infrastructure, and Kubernetes is used as an orchestration engine. Knative relies on Istio for network routing, security, and monitoring.
Design and Coding with Knative
Knative serving uses a Sidecar cloud design pattern in which service hosts a function and plays the role of the application container. Containerization enables functions to be bundled while language-specific run times are programmed at build time.
With these features, according to Pivotal’s director of technical marketing, Dan Baskette, “Functions are the next abstraction you need to care about. . . Developers can focus entirely on their function code to process an event.” Functions could be written in many programming languages without any additional dependencies or special run-time libraries. GitHub features Knative functions written in C#, Go, Java, Node.js, PHP, Python, Ruby, and Rust. Designers can chain multiple cloud functions into powerful business workflows by connecting serving route-named endpoints.
Route supports HTTP and gRPC endpoints. The latter enables endpoints’ distributed streaming. Knative pluggable architecture lets open-source add-ons like Project Riff invokers connect streaming endpoints with multilingual streaming functions. The functions need only to have well-known stream primitives as parameters and return values similar to this sample. This way, Knative provides a native streaming platform for serverless applications.
Events and event sourcing are staples of modern software-distributed architectures. The Knative eventing feature enables invocation of loosely coupled cloud services and serverless applications in an asynchronous manner. Its powerful generic abstractions for cloud events and communication primitives, such as Knative events, channel, subscription, and bus, allow architects and developers to concentrate on designing asynchronous flows instead of wrestling with messaging infrastructures. Knative commitment to the standard CloudEvents nomenclature protects event-driven design investments from current and future proprietary event frameworks.