4. Agenda
- Intro
- Why Functions?
- Why in Knative?
- Function characteristics
- Quick Demo
- Inner Loop
- Function Patterns
- Game Use Case
- Extended Use Case with Events
- Roadmap
5. Why Functions?
● A simple programming model
○ Single responsibility principle on steroids
○ Small and focused on doing only one thing
○ Receives input and returns output
● Portability
○ Unconcerned with networking, signals + other typical application concerns
● Powerful tooling
○ Functions CLI
○ Language Packs
● Developer productivity & happiness
6. Why in Knative?
● Knative provides the deployment platform
○ Kubernetes based
○ Containerized deployments
● Knative Serving
○ HTTP based applications
○ Ease of deployment and routing
○ Point in time deployment revisions
○ Autoscaling to and from zero containers
● Knative Eventing
○ Sources: Kafka, RabbitMQ, etc.
○ Channels and Triggers
○ CloudEvents
7. Knative Functions characteristics
- Built In runtimes
- Go, Node.js, Python, Quarkus, Rust, SpringBoot, TypeScript
- Language Packs
- Common invocation interfaces
- Customize tooling
- Build strategies
- Local: s2i, buildpacks
- On-cluster: buildpacks
- Typically stateless
- Invocations
- Imperative - typically HTTP based
- Reactive - typically Event based
8. Quick Demo
- New CloudEvent Function in VSCode
- Quick build and deploy to local Kind cluster
- Configuration
- Environment variables
- Secrets
- Volumes
- Labels
- Annotations
14. Takeaways and Challenges
- Our functions will be automatically scaled up and down based on demand
- We need a function orchestrator (game-frontend in this case)
- For synchronous interactions, the User Interface needs to wait for the function
to return, this include the network latency plus in this case Redis reads and
writes
- For this scenario, we can hit database bottlenecks if our functions are scaled
up without having a fixed upper bound, as the number of DB connections will
increase (one per function replica)
16. Takeaways and Challenges
- An Event-based approach enable developers to build more reactive,
decoupled and robust scenarios
- Knative Eventing deals with abstracting the underlying message broker
implementation, enabling developers to consume and produce events just
using HTTP requests
- CloudEvents provide a polyglot way of exchanging events as multiple
language SDKs are provided
- We need to be ready to deal with eventual consistency between our services
17. Roadmap
- Community working on 1.0
- Accepted into Knative Core!!! 🥳🥳🥳🥳🥳
- API and CLI maturing fast - backwards compatible
- New func.yaml format
- OnCluster Builds and better integration with CI/CD pipelines
- Dynamic Templates??
- Extras:
- Knative Plugins for VSCode and IntelliJ/Golang
- External template repositories with examples (http://github.com/knative-sandbox/func-tastic )