Slide 1

Slide 1 text

Living on the Edge with Spring Cloud Gateway By Ryan Baxter @ryanjbaxter By Cora Iberkleid @ciberkleid

Slide 2

Slide 2 text

Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Gateway Basics

Slide 3

Slide 3 text

Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ What Is An API Gateway? Server Side MVC App Microservice A JS or Mobile App Microservice B Microservice C

Slide 4

Slide 4 text

Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ What Is An API Gateway? Server Side MVC App Microservice A JS or Mobile App Microservice B Microservice C Gateway

Slide 5

Slide 5 text

Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Gateway Responsibilities ● Routing ● Security ● Monitoring ● Canarying ● Monolith Strangling ● Resiliency

Slide 6

Slide 6 text

Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Spring Cloud Gateway Basics

Slide 7

Slide 7 text

Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Spring Cloud Gateway Foundations

Slide 8

Slide 8 text

Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Reactive Gateway

Slide 9

Slide 9 text

Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Gateway Flow Client Predicates Pre-Filters Global Filters Post-Filters Downstream Service Gateway Handler Mapping Web Handler

Slide 10

Slide 10 text

Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Gateway Gateway Flow Client Predicates Pre-Filters Global Filters Post-Filters Downstream Service Handler Mapping Web Handler Predicates ● Path ● Host ● Date/Time ● Method ● Headers ● Query Params ● Cookies ● Read Body ● Anything….

Slide 11

Slide 11 text

Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Gateway Gateway Flow Client Predicates Pre-Filters Global Filters Post-Filters Downstream Service Handler Mapping Web Handler Pre-Filters ● Headers ● Path ● Rate Limiting ● Cookies ● Hystrix ● Modify Body ● Anything

Slide 12

Slide 12 text

Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Gateway Gateway Flow Client Predicates Pre-Filters Global Filters Post-Filters Downstream Service Handler Mapping Web Handler Global Filters ● Netty Router ● Web Sockets ● Load Balancer ● Metrics

Slide 13

Slide 13 text

Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Gateway Gateway Flow Client Predicates Pre-Filters Global Filters Post-Filters Downstream Service Handler Mapping Web Handler Post Filters ● Set status ● Headers ● Cookies ● Anything...

Slide 14

Slide 14 text

Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Design Decisions

Slide 15

Slide 15 text

Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ App Embedded Gate way Sample Use Case ● When latency is essential - no added network hops

Slide 16

Slide 16 text

Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Embedded App Sample Use Case ● Fine-grained access control for pay-per-use service or fragile backing service App Gate way App Gate way App Gate way App

Slide 17

Slide 17 text

Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Facade Gateway App Client Sample Use Cases ● Prevent direct access to apps ● Polyglot compatible

Slide 18

Slide 18 text

Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Facade Gateway App B Client Sample Use Cases ● Cross-cutting concerns ● Present common API to clients ● Shield clients from app refactoring (monolith → microservices) App C App A

Slide 19

Slide 19 text

Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Cross-Cutting + App-Specific App-Specific Gateway App B Client Sample Use Cases ● Delegate cross-cutting concerns to a separate common gateway (and a separate dev team!) App C App A App-Specific Gateway App E App F App D Common Gateway

Slide 20

Slide 20 text

Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Demo Part I: Spring Cloud Gateway Photo Credit: Aerosmith, Living On The Edge

Slide 21

Slide 21 text

Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Demo Architecture Gateway Blue Service Green Service Frontend App Client Service Discovery (Eureka)

Slide 22

Slide 22 text

Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Demo Architecture Gateway Blue Service Green Service Frontend App Client Service Discovery (Eureka) Yellow Service

Slide 23

Slide 23 text

Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Demo Part II: Gateway On Cloud Foundry

Slide 24

Slide 24 text

Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ User Stories - Subscription SLA Management ● As a consumer, I want features in accordance with my subscription. ● As a developer, I want to focus on my app. ● As a product owner, I want to ensure a consistent and unified consumer experience. ● As an operator, I want the the solution to be resilient and scalable.

Slide 25

Slide 25 text

Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ configs: - name: trial replenishRate: 2 burstCapacity: 2 - name: basic replenishRate: 10 burstCapacity: 15 - name: premium replenishRate: 50 burstCapacity: 100 Consumers… need subscriptions Trial Basic Premium

Slide 26

Slide 26 text

Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Developers want… Aut t a n Aut za Rat i n Req En i h t Req For d …as a service

Slide 27

Slide 27 text

Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Product Owners want… consistency Open Service Broker API Instances Bindings Catalog

Slide 28

Slide 28 text

Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Operators want… resilience and scalability 2 8  Rate Limiters (Redis) Service Instance Info (MongoDB) Service Broker + Gateway

Slide 29

Slide 29 text

Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ To the demo...

Slide 30

Slide 30 text

Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Thank You Scott Frederick Spencer Gibb Madhav Sathe Rob Winch

Slide 31

Slide 31 text

Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Feedback Please!

Slide 32

Slide 32 text

Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Q&A Spring Cloud Gateway: https://github.com/spring-cloud/spring-cloud-gateway Session Code: https://github.com/ryanjbaxter/gateway-s1p-2018 Slides: https://speakerdeck.com/ryanjbaxter

Slide 33

Slide 33 text

> Stay Connected. #springone @s1p

Slide 34

Slide 34 text

Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Cross-Cutting + App-Specific App-Specific Gateway App B Client App C App A App-Specific Gateway App E App F App D Common Gateway Service Broker (OSBAPI) Cloud Foundry Service Instance Info Rate Limiters Sessions