SlideShare a Scribd company logo
Let The Computer Do It
Usage Of Declarative APIs
Frank Müller
•Oldenburg, Germany


•Born 1965


•Working at Kubermatic


•Team Lead Development


•@themue
Introduction Frank Müller
The World Of APIs Today
• Since many years using imperative APIs is normal


• Examples are XML-RPC, RESTful APIs, and gRPC


• Have proven themselves in simple client/server scenarios


• The load of multiple related calls lies with the client


• This increases in increasingly distributed and integrative fields of
application
Most APIs Work Imperative Frank Müller
Imperative Environments Frank Müller
Service A
Service B
Service C
Service D
Client
• Heat 300 ml of milk to lukewarm ✔


• Dissolve a tablespoon of margarine in it ✔


• Crumble a block of yeast into a tall glass and pour a little warm
milk and sugar over it; stir the yeast and let everything warm ✔


• Put 500 gr of flour with the rest of the milk and one egg in a
mixing bowl and mix 👀


• Ouch, I don't have any flour anymore 😱
Recipe As An Example Frank Müller
• Complexity grows disproportionately in distributed environments


• Error handlings and rollbacks even more


• Keeping business logic on client side is hard to synchronize


• Implementations and version in web and apps will differ


• Runtime for business logic has to be scalable too
Complexity in Distributed Environments Frank Müller
Complexity In Distributed Environments
The Idea Of Declarative APIs
• Move responsibility from client to a controller


• Describe wanted state in a well defined document


• Store document in a database


• Notify interested controllers about wanted state changes


• Let controller perform changes and document them in database


• Let controller also perform rollback in error case
Don't Control, Just Describe Frank Müller
• Services care for low level tasks


• Controllers care for business logic


• Controllers continuously reconcile the wanted state with the
current state


• Two options:


‣ Call the services


‣ Write documents for nested common business logic
Responsibilities Frank Müller
apiVersion: api.bettercode.eu/v1


kind: BreadBaking


metadata:


name: raisin_mare


client: frank_mueller


spec:


count: 1


weight: 1000gr


template:


name: mare


addons:


- name: raisins


weight: 200gr
Example Of Document Frank Müller
Declarative Environments Frank Müller
API Server
Bread Bakery


Controller
1. ...


2. ...


3. ...


4. ...


5. ...
Stew


Controller
BBQ


Controller
• Define controller specification


• Implement controller specification as data structure


• Implement controller processing additions, changes, and
deletions of documents


• Start controller with subscription to changes of interested
documents (can also be others than the own ones)


• Listen to notifications and process them
Process Frank Müller
Take A Look At Kubernetes
• API server receives documents via HTTP


• Documents are stored in high-available database etcd


• Scheduler compares wanted with current state and assigns
based on resources, restrictions, locations, and dependencies to
nodes


• Controller Manager manages resources and deployments,
monitors differences between current and wanted cluster state
and performs changes via API
Kubernetes Master Frank Müller
• Kubelet on each node performs installation if needed


• Kube-Proxy retrieves container images from internet or own
repositories


• Container runtime like Docker or containerd run the individual
containers
Kubernetes Nodes Frank Müller
Kubernetes Architecture Frank Müller
Master
Controller


Manager
API Server
etcd
Client


(e.g. kubectl)
Scheduler


Internet
Node
kubelet kube-proxy
Docker Pod
Pod
Node
kubelet kube-proxy
Docker Pod
Pod
• Own controllers can run in a cluster


• They subscribe to changes of standard objects and/or self-
defined objects


• Subscriptions may be filtered by meta-data, e.g. to react only on
ConfigMaps labeled for own controller


• API documents are specified via Custom Resource Definitions
(CRD)


• Changes are applied as according Custom Resources
Controllers Frank Müller
apiVersion: apiextensions.k8s.io/v1


kind: CustomResourceDefinition


metadata:


name: talks.api.bettercode.eu


spec:


group: api.bettercode.eu


versions:


- name: v1


served: true


storage: true


schema:


openAPIV3Schema:


type: object


properties:


spec:
Custom Resource Definition Frank Müller
type: object


properties:


title:


type: string


speaker:


type: string


time:


type: integer


scope: Namespaced


names:


plural: talks


singular: talk


kind: Talk


shortNames:


- tlk
• Deployment of a microservice


• Configuration of staging, cloud provider, network, and scaling


• Configuration of needed backend resources like volumes,
databases, caches, queues, logging, monitoring, and search


• Applying document (Custom Resource) leads to installation,
update, or reconfiguration of microservice


• CRD became quite large
Example Of Controller Usage Frank Müller
Why Not Commercial APIs Too?
Declarative Business Environment Frank Müller
Service A
Service B
Service C
External


Service
Controller X
Controller Y
API Server
Controller


Manager
Scheduler
apiVersion: api.bettercode.eu/v1


kind: BreadBaking


metadata:


name: raisin_mare


client: frank_mueller


spec:


count: 1


weight: 1000gr


template:


name: mare


addons:


- name: raisins


weight: 200gr
Custom Resource For Baking Bread Frank Müller
factory := informers.NewSharedInformerFactory(client, time.Second*30)


svcInformer = factory.Core().V1().Services().Informer()


svcInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{


AddFunc: addServiceHandler,


UpdateFunc: updateServiceHandler,


DeleteFunc: deleteServiceHandler,


})


go cd.svcInformer.Run(wait.NeverStop)


Specification As Code Frank Müller
type BreadBakingSpec struct {


Count int


Weight BreadBakingWeightSpec


...


}


type BreadBaking struct {


metav1.TypeMeta `json:",inline"`


metav1.ObjectMeta `json:"metadata,omitempty"`


Spec BreadBakingSpec `json:"spec"`


}
factory := informers.NewSharedInformerFactory(client, time.Second*30)


svcInformer = factory.Core().V1().Services().Informer()


svcInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{


AddFunc: addServiceHandler,


UpdateFunc: updateServiceHandler,


DeleteFunc: deleteServiceHandler,


})


go cd.svcInformer.Run(wait.NeverStop)


Registering And Run The Controller Frank Müller
func (b *BreadBakery) Register() {


factory := informers.NewSharedInformerFactory(b.client, time.Second*30)


breadBakingInformer = factory.Query("v1", "BreadBaking").Informer()


breadBakingInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{


AddFunc: b.addHandler,


UpdateFunc: b.updateHandler,


DeleteFunc: b.deleteHandler,


})


go b.breadBakingInformer.Run(wait.NeverStop)


}
factory := informers.NewSharedInformerFactory(client, time.Second*30)


svcInformer = factory.Core().V1().Services().Informer()


svcInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{


AddFunc: addServiceHandler,


UpdateFunc: updateServiceHandler,


DeleteFunc: deleteServiceHandler,


})


go cd.svcInformer.Run(wait.NeverStop)


Handle Added Resource Frank Müller
func (b *BreadBakery) addHandler(obj interface{}) {


bb := obj.(*BreadBaking)


// Check client and more.


if bb.Client() != b.client {


return


}


...


// Bake bread by calling according services.


...


}
• Microservices and external software for individual business
domains


• Controller for business processes


• Controller runtime for call documentation and distribution


• Clients and controller send documents to API server


• Documents allow to be handled individually


• Status is always transparent
Overview Frank Müller
• Own runtime similar to Kubernetes has to be build


• Only cares for documentation and distribution of business
process documents


• Runtime alternatively could be Kubernetes itself


• Still a less technical wrapper for Kubernetes API would be
needed
Runtime Frank Müller
Closing
• Complex business process are handled central


• Processing is scalable


• Versions are possible


• Process calls are documented


• Still different kind of thinking
Closing Frank Müller
Thanks a lot and


have a nice


evening


Image Sources


123RF


Pexels


iStockphoto


Own photos

More Related Content

Similar to Let The Computer Do It

OSDC 2018 | Three years running containers with Kubernetes in Production by T...
OSDC 2018 | Three years running containers with Kubernetes in Production by T...OSDC 2018 | Three years running containers with Kubernetes in Production by T...
OSDC 2018 | Three years running containers with Kubernetes in Production by T...
NETWAYS
 
How kubernetes operators can rescue dev secops in midst of a pandemic updated
How kubernetes operators can rescue dev secops in midst of a pandemic updatedHow kubernetes operators can rescue dev secops in midst of a pandemic updated
How kubernetes operators can rescue dev secops in midst of a pandemic updated
Shikha Srivastava
 
Kubernetes-Presentation-Syed-Murtaza-Hassan
Kubernetes-Presentation-Syed-Murtaza-HassanKubernetes-Presentation-Syed-Murtaza-Hassan
Kubernetes-Presentation-Syed-Murtaza-Hassan
Syed Murtaza Hassan
 
IBM Bluemix OpenWhisk: Serverless Conference 2016, London, UK: The Future of ...
IBM Bluemix OpenWhisk: Serverless Conference 2016, London, UK: The Future of ...IBM Bluemix OpenWhisk: Serverless Conference 2016, London, UK: The Future of ...
IBM Bluemix OpenWhisk: Serverless Conference 2016, London, UK: The Future of ...
OpenWhisk
 
18th Athens Big Data Meetup - 2nd Talk - Run Spark and Flink Jobs on Kubernetes
18th Athens Big Data Meetup - 2nd Talk - Run Spark and Flink Jobs on Kubernetes18th Athens Big Data Meetup - 2nd Talk - Run Spark and Flink Jobs on Kubernetes
18th Athens Big Data Meetup - 2nd Talk - Run Spark and Flink Jobs on Kubernetes
Athens Big Data
 
K8s in 3h - Kubernetes Fundamentals Training
K8s in 3h - Kubernetes Fundamentals TrainingK8s in 3h - Kubernetes Fundamentals Training
K8s in 3h - Kubernetes Fundamentals Training
Piotr Perzyna
 
9th docker meetup 2016.07.13
9th docker meetup 2016.07.139th docker meetup 2016.07.13
9th docker meetup 2016.07.13
Amrita Prasad
 
Deploy your machine learning models to production with Kubernetes
Deploy your machine learning models to production with KubernetesDeploy your machine learning models to production with Kubernetes
Deploy your machine learning models to production with Kubernetes
cnvrg.io AI OS - Hands-on ML Workshops
 
KFServing and Feast
KFServing and FeastKFServing and Feast
KFServing and Feast
Animesh Singh
 
[Workshop] API Management in Microservices Architecture
[Workshop] API Management in Microservices Architecture[Workshop] API Management in Microservices Architecture
[Workshop] API Management in Microservices Architecture
WSO2
 
Tech talk specflow_bddx_hassa_nagy
Tech talk specflow_bddx_hassa_nagyTech talk specflow_bddx_hassa_nagy
Tech talk specflow_bddx_hassa_nagy
Skills Matter
 
Francisco Javier Ramirez Urea - Hopla - OSL19
Francisco Javier Ramirez Urea - Hopla - OSL19Francisco Javier Ramirez Urea - Hopla - OSL19
Francisco Javier Ramirez Urea - Hopla - OSL19
marketingsyone
 
Kube Overview and Kube Conformance Certification OpenSource101 Raleigh
Kube Overview and Kube Conformance Certification OpenSource101 RaleighKube Overview and Kube Conformance Certification OpenSource101 Raleigh
Kube Overview and Kube Conformance Certification OpenSource101 Raleigh
Brad Topol
 
ClusterAPI Overview - Managing multi-cloud Kubernetes Clusters - k8s Meetup@v...
ClusterAPI Overview - Managing multi-cloud Kubernetes Clusters - k8s Meetup@v...ClusterAPI Overview - Managing multi-cloud Kubernetes Clusters - k8s Meetup@v...
ClusterAPI Overview - Managing multi-cloud Kubernetes Clusters - k8s Meetup@v...
Tobias Schneck
 
Kubernetes "Ubernetes" Cluster Federation by Quinton Hoole (Google, Inc) Huaw...
Kubernetes "Ubernetes" Cluster Federation by Quinton Hoole (Google, Inc) Huaw...Kubernetes "Ubernetes" Cluster Federation by Quinton Hoole (Google, Inc) Huaw...
Kubernetes "Ubernetes" Cluster Federation by Quinton Hoole (Google, Inc) Huaw...
Quinton Hoole
 
Edge 2016 Session 1886 Building your own docker container cloud on ibm power...
Edge 2016 Session 1886  Building your own docker container cloud on ibm power...Edge 2016 Session 1886  Building your own docker container cloud on ibm power...
Edge 2016 Session 1886 Building your own docker container cloud on ibm power...
Yong Feng
 
The Evolution of Distributed Systems on Kubernetes
The Evolution of Distributed Systems on KubernetesThe Evolution of Distributed Systems on Kubernetes
The Evolution of Distributed Systems on Kubernetes
Bilgin Ibryam
 
Develop and deploy Kubernetes applications with Docker - IBM Index 2018
Develop and deploy Kubernetes  applications with Docker - IBM Index 2018Develop and deploy Kubernetes  applications with Docker - IBM Index 2018
Develop and deploy Kubernetes applications with Docker - IBM Index 2018
Patrick Chanezon
 
Docker on docker leveraging kubernetes in docker ee
Docker on docker leveraging kubernetes in docker eeDocker on docker leveraging kubernetes in docker ee
Docker on docker leveraging kubernetes in docker ee
Docker, Inc.
 
Mattia Gandolfi - Improving utilization and portability with Containers and C...
Mattia Gandolfi - Improving utilization and portability with Containers and C...Mattia Gandolfi - Improving utilization and portability with Containers and C...
Mattia Gandolfi - Improving utilization and portability with Containers and C...
Codemotion
 

Similar to Let The Computer Do It (20)

OSDC 2018 | Three years running containers with Kubernetes in Production by T...
OSDC 2018 | Three years running containers with Kubernetes in Production by T...OSDC 2018 | Three years running containers with Kubernetes in Production by T...
OSDC 2018 | Three years running containers with Kubernetes in Production by T...
 
How kubernetes operators can rescue dev secops in midst of a pandemic updated
How kubernetes operators can rescue dev secops in midst of a pandemic updatedHow kubernetes operators can rescue dev secops in midst of a pandemic updated
How kubernetes operators can rescue dev secops in midst of a pandemic updated
 
Kubernetes-Presentation-Syed-Murtaza-Hassan
Kubernetes-Presentation-Syed-Murtaza-HassanKubernetes-Presentation-Syed-Murtaza-Hassan
Kubernetes-Presentation-Syed-Murtaza-Hassan
 
IBM Bluemix OpenWhisk: Serverless Conference 2016, London, UK: The Future of ...
IBM Bluemix OpenWhisk: Serverless Conference 2016, London, UK: The Future of ...IBM Bluemix OpenWhisk: Serverless Conference 2016, London, UK: The Future of ...
IBM Bluemix OpenWhisk: Serverless Conference 2016, London, UK: The Future of ...
 
18th Athens Big Data Meetup - 2nd Talk - Run Spark and Flink Jobs on Kubernetes
18th Athens Big Data Meetup - 2nd Talk - Run Spark and Flink Jobs on Kubernetes18th Athens Big Data Meetup - 2nd Talk - Run Spark and Flink Jobs on Kubernetes
18th Athens Big Data Meetup - 2nd Talk - Run Spark and Flink Jobs on Kubernetes
 
K8s in 3h - Kubernetes Fundamentals Training
K8s in 3h - Kubernetes Fundamentals TrainingK8s in 3h - Kubernetes Fundamentals Training
K8s in 3h - Kubernetes Fundamentals Training
 
9th docker meetup 2016.07.13
9th docker meetup 2016.07.139th docker meetup 2016.07.13
9th docker meetup 2016.07.13
 
Deploy your machine learning models to production with Kubernetes
Deploy your machine learning models to production with KubernetesDeploy your machine learning models to production with Kubernetes
Deploy your machine learning models to production with Kubernetes
 
KFServing and Feast
KFServing and FeastKFServing and Feast
KFServing and Feast
 
[Workshop] API Management in Microservices Architecture
[Workshop] API Management in Microservices Architecture[Workshop] API Management in Microservices Architecture
[Workshop] API Management in Microservices Architecture
 
Tech talk specflow_bddx_hassa_nagy
Tech talk specflow_bddx_hassa_nagyTech talk specflow_bddx_hassa_nagy
Tech talk specflow_bddx_hassa_nagy
 
Francisco Javier Ramirez Urea - Hopla - OSL19
Francisco Javier Ramirez Urea - Hopla - OSL19Francisco Javier Ramirez Urea - Hopla - OSL19
Francisco Javier Ramirez Urea - Hopla - OSL19
 
Kube Overview and Kube Conformance Certification OpenSource101 Raleigh
Kube Overview and Kube Conformance Certification OpenSource101 RaleighKube Overview and Kube Conformance Certification OpenSource101 Raleigh
Kube Overview and Kube Conformance Certification OpenSource101 Raleigh
 
ClusterAPI Overview - Managing multi-cloud Kubernetes Clusters - k8s Meetup@v...
ClusterAPI Overview - Managing multi-cloud Kubernetes Clusters - k8s Meetup@v...ClusterAPI Overview - Managing multi-cloud Kubernetes Clusters - k8s Meetup@v...
ClusterAPI Overview - Managing multi-cloud Kubernetes Clusters - k8s Meetup@v...
 
Kubernetes "Ubernetes" Cluster Federation by Quinton Hoole (Google, Inc) Huaw...
Kubernetes "Ubernetes" Cluster Federation by Quinton Hoole (Google, Inc) Huaw...Kubernetes "Ubernetes" Cluster Federation by Quinton Hoole (Google, Inc) Huaw...
Kubernetes "Ubernetes" Cluster Federation by Quinton Hoole (Google, Inc) Huaw...
 
Edge 2016 Session 1886 Building your own docker container cloud on ibm power...
Edge 2016 Session 1886  Building your own docker container cloud on ibm power...Edge 2016 Session 1886  Building your own docker container cloud on ibm power...
Edge 2016 Session 1886 Building your own docker container cloud on ibm power...
 
The Evolution of Distributed Systems on Kubernetes
The Evolution of Distributed Systems on KubernetesThe Evolution of Distributed Systems on Kubernetes
The Evolution of Distributed Systems on Kubernetes
 
Develop and deploy Kubernetes applications with Docker - IBM Index 2018
Develop and deploy Kubernetes  applications with Docker - IBM Index 2018Develop and deploy Kubernetes  applications with Docker - IBM Index 2018
Develop and deploy Kubernetes applications with Docker - IBM Index 2018
 
Docker on docker leveraging kubernetes in docker ee
Docker on docker leveraging kubernetes in docker eeDocker on docker leveraging kubernetes in docker ee
Docker on docker leveraging kubernetes in docker ee
 
Mattia Gandolfi - Improving utilization and portability with Containers and C...
Mattia Gandolfi - Improving utilization and portability with Containers and C...Mattia Gandolfi - Improving utilization and portability with Containers and C...
Mattia Gandolfi - Improving utilization and portability with Containers and C...
 

More from Frank Müller

JAX 2023 - Cloud Provider APIs
JAX 2023 - Cloud Provider APIsJAX 2023 - Cloud Provider APIs
JAX 2023 - Cloud Provider APIs
Frank Müller
 
JAX 2023 - Generics in Go
JAX 2023 - Generics in GoJAX 2023 - Generics in Go
JAX 2023 - Generics in Go
Frank Müller
 
Concurrency with Go
Concurrency with GoConcurrency with Go
Concurrency with Go
Frank Müller
 
2021 OOP - Kubernetes Operatoren
2021   OOP - Kubernetes Operatoren2021   OOP - Kubernetes Operatoren
2021 OOP - Kubernetes Operatoren
Frank Müller
 
DevOpsCon - Verteilte Entwicklung in Go
DevOpsCon - Verteilte Entwicklung in GoDevOpsCon - Verteilte Entwicklung in Go
DevOpsCon - Verteilte Entwicklung in Go
Frank Müller
 
Devs@Home - Einführung in Go
Devs@Home - Einführung in GoDevs@Home - Einführung in Go
Devs@Home - Einführung in Go
Frank Müller
 
Fun with functions
Fun with functionsFun with functions
Fun with functions
Frank Müller
 
Ein Gopher im Netz
Ein Gopher im NetzEin Gopher im Netz
Ein Gopher im Netz
Frank Müller
 
Blockchains - Mehr als nur digitale Währungen
Blockchains - Mehr als nur digitale WährungenBlockchains - Mehr als nur digitale Währungen
Blockchains - Mehr als nur digitale Währungen
Frank Müller
 
Spaß an der Nebenläufigkeit
Spaß an der NebenläufigkeitSpaß an der Nebenläufigkeit
Spaß an der Nebenläufigkeit
Frank Müller
 
Go - Googles Sprache für skalierbare Systeme
Go - Googles Sprache für skalierbare SystemeGo - Googles Sprache für skalierbare Systeme
Go - Googles Sprache für skalierbare Systeme
Frank Müller
 
Cloud Provisioning mit Juju
Cloud Provisioning mit JujuCloud Provisioning mit Juju
Cloud Provisioning mit Juju
Frank Müller
 
Juju - Scalable Software with Google Go
Juju - Scalable Software with Google GoJuju - Scalable Software with Google Go
Juju - Scalable Software with Google Go
Frank Müller
 
RESTful Web Applications with Google Go
RESTful Web Applications with Google GoRESTful Web Applications with Google Go
RESTful Web Applications with Google Go
Frank Müller
 
Clouds, leicht beherrschbar
Clouds, leicht beherrschbarClouds, leicht beherrschbar
Clouds, leicht beherrschbar
Frank Müller
 
Skalierbare Anwendungen mit Google Go
Skalierbare Anwendungen mit Google GoSkalierbare Anwendungen mit Google Go
Skalierbare Anwendungen mit Google Go
Frank Müller
 
WTC 2013 - Juju - Mit etwas Magie zur perfekten Cloud
WTC 2013 - Juju - Mit etwas Magie zur perfekten CloudWTC 2013 - Juju - Mit etwas Magie zur perfekten Cloud
WTC 2013 - Juju - Mit etwas Magie zur perfekten Cloud
Frank Müller
 
Juju - Google Go in a scalable Environment
Juju - Google Go in a scalable EnvironmentJuju - Google Go in a scalable Environment
Juju - Google Go in a scalable Environment
Frank Müller
 
OOP 2013 - Weltweite Entwicklung von Open Source Software
OOP 2013 - Weltweite Entwicklung von Open Source SoftwareOOP 2013 - Weltweite Entwicklung von Open Source Software
OOP 2013 - Weltweite Entwicklung von Open Source Software
Frank Müller
 
Beauty and Power of Go
Beauty and Power of GoBeauty and Power of Go
Beauty and Power of Go
Frank Müller
 

More from Frank Müller (20)

JAX 2023 - Cloud Provider APIs
JAX 2023 - Cloud Provider APIsJAX 2023 - Cloud Provider APIs
JAX 2023 - Cloud Provider APIs
 
JAX 2023 - Generics in Go
JAX 2023 - Generics in GoJAX 2023 - Generics in Go
JAX 2023 - Generics in Go
 
Concurrency with Go
Concurrency with GoConcurrency with Go
Concurrency with Go
 
2021 OOP - Kubernetes Operatoren
2021   OOP - Kubernetes Operatoren2021   OOP - Kubernetes Operatoren
2021 OOP - Kubernetes Operatoren
 
DevOpsCon - Verteilte Entwicklung in Go
DevOpsCon - Verteilte Entwicklung in GoDevOpsCon - Verteilte Entwicklung in Go
DevOpsCon - Verteilte Entwicklung in Go
 
Devs@Home - Einführung in Go
Devs@Home - Einführung in GoDevs@Home - Einführung in Go
Devs@Home - Einführung in Go
 
Fun with functions
Fun with functionsFun with functions
Fun with functions
 
Ein Gopher im Netz
Ein Gopher im NetzEin Gopher im Netz
Ein Gopher im Netz
 
Blockchains - Mehr als nur digitale Währungen
Blockchains - Mehr als nur digitale WährungenBlockchains - Mehr als nur digitale Währungen
Blockchains - Mehr als nur digitale Währungen
 
Spaß an der Nebenläufigkeit
Spaß an der NebenläufigkeitSpaß an der Nebenläufigkeit
Spaß an der Nebenläufigkeit
 
Go - Googles Sprache für skalierbare Systeme
Go - Googles Sprache für skalierbare SystemeGo - Googles Sprache für skalierbare Systeme
Go - Googles Sprache für skalierbare Systeme
 
Cloud Provisioning mit Juju
Cloud Provisioning mit JujuCloud Provisioning mit Juju
Cloud Provisioning mit Juju
 
Juju - Scalable Software with Google Go
Juju - Scalable Software with Google GoJuju - Scalable Software with Google Go
Juju - Scalable Software with Google Go
 
RESTful Web Applications with Google Go
RESTful Web Applications with Google GoRESTful Web Applications with Google Go
RESTful Web Applications with Google Go
 
Clouds, leicht beherrschbar
Clouds, leicht beherrschbarClouds, leicht beherrschbar
Clouds, leicht beherrschbar
 
Skalierbare Anwendungen mit Google Go
Skalierbare Anwendungen mit Google GoSkalierbare Anwendungen mit Google Go
Skalierbare Anwendungen mit Google Go
 
WTC 2013 - Juju - Mit etwas Magie zur perfekten Cloud
WTC 2013 - Juju - Mit etwas Magie zur perfekten CloudWTC 2013 - Juju - Mit etwas Magie zur perfekten Cloud
WTC 2013 - Juju - Mit etwas Magie zur perfekten Cloud
 
Juju - Google Go in a scalable Environment
Juju - Google Go in a scalable EnvironmentJuju - Google Go in a scalable Environment
Juju - Google Go in a scalable Environment
 
OOP 2013 - Weltweite Entwicklung von Open Source Software
OOP 2013 - Weltweite Entwicklung von Open Source SoftwareOOP 2013 - Weltweite Entwicklung von Open Source Software
OOP 2013 - Weltweite Entwicklung von Open Source Software
 
Beauty and Power of Go
Beauty and Power of GoBeauty and Power of Go
Beauty and Power of Go
 

Recently uploaded

Manyata Tech Park Bangalore_ Infrastructure, Facilities and More
Manyata Tech Park Bangalore_ Infrastructure, Facilities and MoreManyata Tech Park Bangalore_ Infrastructure, Facilities and More
Manyata Tech Park Bangalore_ Infrastructure, Facilities and More
narinav14
 
Going AOT: Everything you need to know about GraalVM for Java applications
Going AOT: Everything you need to know about GraalVM for Java applicationsGoing AOT: Everything you need to know about GraalVM for Java applications
Going AOT: Everything you need to know about GraalVM for Java applications
Alina Yurenko
 
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
Bert Jan Schrijver
 
Modelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - AmsterdamModelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - Amsterdam
Alberto Brandolini
 
How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?
ToXSL Technologies
 
The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...
The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...
The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...
kalichargn70th171
 
Building API data products on top of your real-time data infrastructure
Building API data products on top of your real-time data infrastructureBuilding API data products on top of your real-time data infrastructure
Building API data products on top of your real-time data infrastructure
confluent
 
What is Continuous Testing in DevOps - A Definitive Guide.pdf
What is Continuous Testing in DevOps - A Definitive Guide.pdfWhat is Continuous Testing in DevOps - A Definitive Guide.pdf
What is Continuous Testing in DevOps - A Definitive Guide.pdf
kalichargn70th171
 
14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision
ShulagnaSarkar2
 
Boost Your Savings with These Money Management Apps
Boost Your Savings with These Money Management AppsBoost Your Savings with These Money Management Apps
Boost Your Savings with These Money Management Apps
Jhone kinadey
 
Operational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptx
Operational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptxOperational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptx
Operational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptx
sandeepmenon62
 
Alluxio Webinar | 10x Faster Trino Queries on Your Data Platform
Alluxio Webinar | 10x Faster Trino Queries on Your Data PlatformAlluxio Webinar | 10x Faster Trino Queries on Your Data Platform
Alluxio Webinar | 10x Faster Trino Queries on Your Data Platform
Alluxio, Inc.
 
42 Ways to Generate Real Estate Leads - Sellxpert
42 Ways to Generate Real Estate Leads - Sellxpert42 Ways to Generate Real Estate Leads - Sellxpert
42 Ways to Generate Real Estate Leads - Sellxpert
vaishalijagtap12
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
dakas1
 
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
Paul Brebner
 
Migration From CH 1.0 to CH 2.0 and Mule 4.6 & Java 17 Upgrade.pptx
Migration From CH 1.0 to CH 2.0 and  Mule 4.6 & Java 17 Upgrade.pptxMigration From CH 1.0 to CH 2.0 and  Mule 4.6 & Java 17 Upgrade.pptx
Migration From CH 1.0 to CH 2.0 and Mule 4.6 & Java 17 Upgrade.pptx
ervikas4
 
WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...
WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...
WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...
Luigi Fugaro
 
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
The Third Creative Media
 
Beginner's Guide to Observability@Devoxx PL 2024
Beginner's  Guide to Observability@Devoxx PL 2024Beginner's  Guide to Observability@Devoxx PL 2024
Beginner's Guide to Observability@Devoxx PL 2024
michniczscribd
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 

Recently uploaded (20)

Manyata Tech Park Bangalore_ Infrastructure, Facilities and More
Manyata Tech Park Bangalore_ Infrastructure, Facilities and MoreManyata Tech Park Bangalore_ Infrastructure, Facilities and More
Manyata Tech Park Bangalore_ Infrastructure, Facilities and More
 
Going AOT: Everything you need to know about GraalVM for Java applications
Going AOT: Everything you need to know about GraalVM for Java applicationsGoing AOT: Everything you need to know about GraalVM for Java applications
Going AOT: Everything you need to know about GraalVM for Java applications
 
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
 
Modelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - AmsterdamModelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - Amsterdam
 
How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?
 
The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...
The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...
The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...
 
Building API data products on top of your real-time data infrastructure
Building API data products on top of your real-time data infrastructureBuilding API data products on top of your real-time data infrastructure
Building API data products on top of your real-time data infrastructure
 
What is Continuous Testing in DevOps - A Definitive Guide.pdf
What is Continuous Testing in DevOps - A Definitive Guide.pdfWhat is Continuous Testing in DevOps - A Definitive Guide.pdf
What is Continuous Testing in DevOps - A Definitive Guide.pdf
 
14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision
 
Boost Your Savings with These Money Management Apps
Boost Your Savings with These Money Management AppsBoost Your Savings with These Money Management Apps
Boost Your Savings with These Money Management Apps
 
Operational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptx
Operational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptxOperational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptx
Operational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptx
 
Alluxio Webinar | 10x Faster Trino Queries on Your Data Platform
Alluxio Webinar | 10x Faster Trino Queries on Your Data PlatformAlluxio Webinar | 10x Faster Trino Queries on Your Data Platform
Alluxio Webinar | 10x Faster Trino Queries on Your Data Platform
 
42 Ways to Generate Real Estate Leads - Sellxpert
42 Ways to Generate Real Estate Leads - Sellxpert42 Ways to Generate Real Estate Leads - Sellxpert
42 Ways to Generate Real Estate Leads - Sellxpert
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
 
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
 
Migration From CH 1.0 to CH 2.0 and Mule 4.6 & Java 17 Upgrade.pptx
Migration From CH 1.0 to CH 2.0 and  Mule 4.6 & Java 17 Upgrade.pptxMigration From CH 1.0 to CH 2.0 and  Mule 4.6 & Java 17 Upgrade.pptx
Migration From CH 1.0 to CH 2.0 and Mule 4.6 & Java 17 Upgrade.pptx
 
WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...
WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...
WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...
 
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
 
Beginner's Guide to Observability@Devoxx PL 2024
Beginner's  Guide to Observability@Devoxx PL 2024Beginner's  Guide to Observability@Devoxx PL 2024
Beginner's Guide to Observability@Devoxx PL 2024
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
 

Let The Computer Do It

  • 1. Let The Computer Do It Usage Of Declarative APIs Frank Müller
  • 2. •Oldenburg, Germany •Born 1965 •Working at Kubermatic •Team Lead Development •@themue Introduction Frank Müller
  • 3. The World Of APIs Today
  • 4. • Since many years using imperative APIs is normal • Examples are XML-RPC, RESTful APIs, and gRPC • Have proven themselves in simple client/server scenarios • The load of multiple related calls lies with the client • This increases in increasingly distributed and integrative fields of application Most APIs Work Imperative Frank Müller
  • 5. Imperative Environments Frank Müller Service A Service B Service C Service D Client
  • 6. • Heat 300 ml of milk to lukewarm ✔ • Dissolve a tablespoon of margarine in it ✔ • Crumble a block of yeast into a tall glass and pour a little warm milk and sugar over it; stir the yeast and let everything warm ✔ • Put 500 gr of flour with the rest of the milk and one egg in a mixing bowl and mix 👀 • Ouch, I don't have any flour anymore 😱 Recipe As An Example Frank Müller
  • 7. • Complexity grows disproportionately in distributed environments • Error handlings and rollbacks even more • Keeping business logic on client side is hard to synchronize • Implementations and version in web and apps will differ • Runtime for business logic has to be scalable too Complexity in Distributed Environments Frank Müller Complexity In Distributed Environments
  • 8. The Idea Of Declarative APIs
  • 9. • Move responsibility from client to a controller • Describe wanted state in a well defined document • Store document in a database • Notify interested controllers about wanted state changes • Let controller perform changes and document them in database • Let controller also perform rollback in error case Don't Control, Just Describe Frank Müller
  • 10. • Services care for low level tasks • Controllers care for business logic • Controllers continuously reconcile the wanted state with the current state • Two options: ‣ Call the services ‣ Write documents for nested common business logic Responsibilities Frank Müller
  • 11. apiVersion: api.bettercode.eu/v1 kind: BreadBaking metadata: name: raisin_mare client: frank_mueller spec: count: 1 weight: 1000gr template: name: mare addons: - name: raisins weight: 200gr Example Of Document Frank Müller
  • 12. Declarative Environments Frank Müller API Server Bread Bakery 
 Controller 1. ... 2. ... 3. ... 4. ... 5. ... Stew 
 Controller BBQ 
 Controller
  • 13. • Define controller specification • Implement controller specification as data structure • Implement controller processing additions, changes, and deletions of documents • Start controller with subscription to changes of interested documents (can also be others than the own ones) • Listen to notifications and process them Process Frank Müller
  • 14. Take A Look At Kubernetes
  • 15. • API server receives documents via HTTP • Documents are stored in high-available database etcd • Scheduler compares wanted with current state and assigns based on resources, restrictions, locations, and dependencies to nodes • Controller Manager manages resources and deployments, monitors differences between current and wanted cluster state and performs changes via API Kubernetes Master Frank Müller
  • 16. • Kubelet on each node performs installation if needed • Kube-Proxy retrieves container images from internet or own repositories • Container runtime like Docker or containerd run the individual containers Kubernetes Nodes Frank Müller
  • 17. Kubernetes Architecture Frank Müller Master Controller 
 Manager API Server etcd Client 
 (e.g. kubectl) Scheduler 
 Internet Node kubelet kube-proxy Docker Pod Pod Node kubelet kube-proxy Docker Pod Pod
  • 18. • Own controllers can run in a cluster • They subscribe to changes of standard objects and/or self- defined objects • Subscriptions may be filtered by meta-data, e.g. to react only on ConfigMaps labeled for own controller • API documents are specified via Custom Resource Definitions (CRD) • Changes are applied as according Custom Resources Controllers Frank Müller
  • 19. apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: name: talks.api.bettercode.eu spec: group: api.bettercode.eu versions: - name: v1 served: true storage: true schema: openAPIV3Schema: type: object properties: spec: Custom Resource Definition Frank Müller type: object properties: title: type: string speaker: type: string time: type: integer scope: Namespaced names: plural: talks singular: talk kind: Talk shortNames: - tlk
  • 20. • Deployment of a microservice • Configuration of staging, cloud provider, network, and scaling • Configuration of needed backend resources like volumes, databases, caches, queues, logging, monitoring, and search • Applying document (Custom Resource) leads to installation, update, or reconfiguration of microservice • CRD became quite large Example Of Controller Usage Frank Müller
  • 21. Why Not Commercial APIs Too?
  • 22. Declarative Business Environment Frank Müller Service A Service B Service C External 
 Service Controller X Controller Y API Server Controller 
 Manager Scheduler
  • 23. apiVersion: api.bettercode.eu/v1 kind: BreadBaking metadata: name: raisin_mare client: frank_mueller spec: count: 1 weight: 1000gr template: name: mare addons: - name: raisins weight: 200gr Custom Resource For Baking Bread Frank Müller
  • 24. factory := informers.NewSharedInformerFactory(client, time.Second*30) svcInformer = factory.Core().V1().Services().Informer() svcInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{ AddFunc: addServiceHandler, UpdateFunc: updateServiceHandler, DeleteFunc: deleteServiceHandler, }) go cd.svcInformer.Run(wait.NeverStop) Specification As Code Frank Müller type BreadBakingSpec struct { Count int Weight BreadBakingWeightSpec ... } type BreadBaking struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` Spec BreadBakingSpec `json:"spec"` }
  • 25. factory := informers.NewSharedInformerFactory(client, time.Second*30) svcInformer = factory.Core().V1().Services().Informer() svcInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{ AddFunc: addServiceHandler, UpdateFunc: updateServiceHandler, DeleteFunc: deleteServiceHandler, }) go cd.svcInformer.Run(wait.NeverStop) Registering And Run The Controller Frank Müller func (b *BreadBakery) Register() { factory := informers.NewSharedInformerFactory(b.client, time.Second*30) breadBakingInformer = factory.Query("v1", "BreadBaking").Informer() breadBakingInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{ AddFunc: b.addHandler, UpdateFunc: b.updateHandler, DeleteFunc: b.deleteHandler, }) go b.breadBakingInformer.Run(wait.NeverStop) }
  • 26. factory := informers.NewSharedInformerFactory(client, time.Second*30) svcInformer = factory.Core().V1().Services().Informer() svcInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{ AddFunc: addServiceHandler, UpdateFunc: updateServiceHandler, DeleteFunc: deleteServiceHandler, }) go cd.svcInformer.Run(wait.NeverStop) Handle Added Resource Frank Müller func (b *BreadBakery) addHandler(obj interface{}) { bb := obj.(*BreadBaking) // Check client and more. if bb.Client() != b.client { return } ... // Bake bread by calling according services. ... }
  • 27. • Microservices and external software for individual business domains • Controller for business processes • Controller runtime for call documentation and distribution • Clients and controller send documents to API server • Documents allow to be handled individually • Status is always transparent Overview Frank Müller
  • 28. • Own runtime similar to Kubernetes has to be build • Only cares for documentation and distribution of business process documents • Runtime alternatively could be Kubernetes itself • Still a less technical wrapper for Kubernetes API would be needed Runtime Frank Müller
  • 30. • Complex business process are handled central • Processing is scalable • Versions are possible • Process calls are documented • Still different kind of thinking Closing Frank Müller
  • 31. Thanks a lot and have a nice evening Image Sources 123RF Pexels iStockphoto Own photos