Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Como Kubernetes Operators pode me ajudar na criação e testes de APIs usando Open API Specification

Como Kubernetes Operators pode me ajudar na criação e testes de APIs usando Open API Specification

Vou fazer uma breve introdução a definição de Operators Patterns, criando um operador que pode ajudar na criação, definição e testes/mocks de APIs habilitando a utilizacao do conceito denominado API First Design bastante importante na criacao de APIs X Microservices.

Transcript

  1. K8s Operators & Open APIs Como Kubernetes Operators pode me

    ajudar na criação e testes de APIs usando Open API Specification
  2. Claudio E. de Oliveira Sr. Software Engineer @ZUP Innovation Java

    & Golang K8s, Docker & Mesh
  3. 1 - Open API Spec 4 - Putting all together

    3 - k8s Operator 2 - API First Principle Agenda Agenda
  4. Microservices Explosion Microservices Explosion

  5. None
  6. Things to think about... ▰ Microservices are developed by !=

    teams (communication) ▰ Many interactions between services ▰ Ecosystem turns to complex and hard to understand
  7. Documentation should be the way that teams “talking”

  8. Do it using Open API Spec… for REST APIs

  9. The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface

    description for REST APIs, which allows both humans and computers to discover and understand the capabilities of a service without requiring access to source code What is Open API Spec
  10. None
  11. None
  12. API First Design API First Design

  13. What API First Means??? An API-first approach means that for

    any given development project, your APIs are treated as “first-class citizens.”
  14. Your API should be designed with with users in mind.

    Think in consumption in first place.
  15. How it works??? An API-first approach involves developing APIs that

    are consistent and reusable, which can be accomplished by using an API description language to establish a contract for how the API is supposed to behave
  16. None
  17. Advantages ▰ Increase the speed to market ▰ Ensures good

    developer experiences Development teams can work in parallel How to achieve it???
  18. API Mocks can be a good way to deliver API

    consumption for other teams
  19. For Contract Tests Consumption Tests Test API Design

  20. How we can create automatization for it???

  21. Open API has a example section that make our service

    clearer to consumption also we can use some tool to help with mocks
  22. None
  23. k8s Controllers

  24. Everything in kubernetes are events

  25. Kubernetes Controllers Kubernetes controllers receive these events and then we

    can extend kubernetes features It is a program that can react a k8s events golang, python, java...etc
  26. None
  27. None
  28. wait...what is Desired State???

  29. None
  30. Custom Resource A resource is an endpoint in the Kubernetes

    API that stores a collection of API objects of a certain kind POD is built-in Kind Deployment is built-in Kind Service is built-in Kind APIMock is not a built-in kind is a Custom Resource
  31. Custom Resource Definition C - Custom R - Resource D

    - Definition
  32. CRD is the way to tell instructions to kubernetes some

    Custom Resources properties like “template”
  33. k8s Operator “An Operator is a Controller that uses a

    CRD to encapsulate operational knowledge for a specific application in an algorithmic and automated form. The Operator pattern allows us to extend the Controller pattern from the preceding chapter for more flexibility and greater expressiveness.” from Kubernetes Patterns Book
  34. Let’s put everything together Let’s put everything together

  35. None
  36. None
  37. None
  38. None
  39. None
  40. Obrigad_!