Moving to Microservices: Visualising Technical Debt, Kubernetes, … · 2020-02-27 · Monolith...

Post on 20-May-2020

3 views 0 download

Transcript of Moving to Microservices: Visualising Technical Debt, Kubernetes, … · 2020-02-27 · Monolith...

Moving to Microservices:

Visualising Technical Debt,

Kubernetes, and GraphQL with Michelle Krejci

PA

NT

HE

ON

.IO

Moving to Microservices:

Visualising Technical

Debt, Kubernetes, and

GraphQL

PA

NT

HE

ON

.IO

I have been on a journey of discovery

through a difficult challenge of upgrading a

successful but inflexible monolithic system and I want to tell you how I have approached

this problem in part by leveraging the

capabilities of Kubernetes and GraphQL and

other fun toys which sound good in a

presentation proposal.

PA

NT

HE

ON

.IO

Here is a compressed 30 minute tutorial

and some

incantations you can use when you get back to

your office

of

how to use these things

that will solve all of your

problems and guarantee that you feel good

about coming to this talk.

PA

NT

HE

ON

.IO

I’ll wait.

PA

NT

HE

ON

.IO

6

Michelle

Software Engineer @getpantheon

PA

NT

HE

ON

.IO

PA

NT

HE

ON

.IO

Let’s start with the ending.

PA

NT

HE

ON

.IO

Build how

you build on

pace with what

you build.

PA

NT

HE

ON

.IO

Build how

you build on

pace with what

you build.

PA

NT

HE

ON

.IO

Act 1

Build it quick.

Actual footage of an early stage startup.

Everyone has the same resources.

Every team member is working on building a viable product that won’t tip over.

The build process is: have an idea, try it, see if it can stand up + people like it.

PA

NT

HE

ON

.IO

Pantheon at this stage

Frontend

(node.js)

Monolith

(twistd python)

Two languages

Two repositories

Two prod environments

PA

NT

HE

ON

.IO

How we build

Dev on

clone of

prod

Push to

Master

runs CI

Jenkins

kicks off

Chef

run

PA

NT

HE

ON

.IO

We did it!

Now, no one touch it.

PA

NT

HE

ON

.IO

Act 2

When you

need to touch

it.

PA

NT

HE

ON

.IO

At this stage, should the existing

production system

be the spec?

PA

NT

HE

ON

.IO

Write a bunch of

tests to check that if it’s not this -------------

-------->

it’s broken.

PA

NT

HE

ON

.IO

PA

NT

HE

ON

.IO

feature or bug?

PA

NT

HE

ON

.IO

22

PA

NT

HE

ON

.IO

Break up what

you build

PA

NT

HE

ON

.IO

Moving to Microservices:

Visualising Technical

Debt, Kubernetes, and

GraphQL

PA

NT

HE

ON

.IO

Pantheon at this stage

Frontend

(node.js)

Monolith

(twistd python)

Service A

(python)

Service B

(python)

Service C

(go)

Service C

(go)

Many languages

Many repos

Many prod environments

WINS

Domains that can be event

driven are a good starting

place.

PA

NT

HE

ON

.IO

But this will force

you to change how you build

PA

NT

HE

ON

.IO

PA

NT

HE

ON

.IO

Moving to Microservices:

Visualising Technical

Debt, Kubernetes, and

GraphQL

PA

NT

HE

ON

.IO

How we build

Dev on

clone of

prod -

copied

into k8

ns

Push to

branch

runs CI

CI

builds

image +

pushes

CI

applies

k8s

config

Service

defines

build with

common

make

WINS

Common repo of Makefiles

Leverage namespaces in

k8s

Internal tool for building dev

PA

NT

HE

ON

.IO

Cool but...

feature or bug?

PA

NT

HE

ON

.IO

Act 3

The Spec.

PA

NT

HE

ON

.IO

PA

NT

HE

ON

.IO

PA

NT

HE

ON

.IO

Ideal specs

unrealistic testing suites

artifacts of an optimistic past

are used to build

that add so much friction they became

PA

NT

HE

ON

.IO

PA

NT

HE

ON

.IO

#I don’t know how it

#works but don’t

#touch it. Trust me.

PA

NT

HE

ON

.IO

Moving to Microservices:

Visualising Technical

Debt, Kubernetes, and

GraphQL

PA

NT

HE

ON

.IO

#I don’t know how it

#works but don’t

#touch it. Trust me.

PA

NT

HE

ON

.IO

{

Antenna(id: "123") {

marshmallow {

fluffiness

}

spaghetti {

}

}

}

{

MiddleBit(id: "123") {

spaghetti(id: “456”) {

bendiness

}

}

}

{

Base(id: "123") {

tape {

length

}

}

}

Client Backend

s

PA

NT

HE

ON

.IO

Pantheon at this stage

Frontend

(node.js)

Monolith

(twistd python)

Service A

(python)

Service B

(python)

Service C

(go)

Service C

(go)

REST→ GraphQL

Schema-first

API Gateway to strangle monolith

API Gateway

(Apollo Server)

Schema

{

[...]

}

PA

NT

HE

ON

.IO

How we build

Dev on

clone of

prod -

copied

into k8

ns

Push to

branch

runs CI

CI

builds

image +

pushes

CI

applies

k8s

config

Service

defines

build with

common

make

Define

schema Check

against

schema

Update

to

schema

merged

PA

NT

HE

ON

.IO

PA

NT

HE

ON

.IO

Act 4

The Exit.

PA

NT

HE

ON

.IO

Switch to language the rest of the business

understands.

PA

NT

HE

ON

.IO

So you want to exit...

PA

NT

HE

ON

.IO

soon-

ish.

PA

NT

HE

ON

.IO

But you have a

gap.

PA

NT

HE

ON

.IO

Maybe you can fill

that gap by adding

new features!

Cool

thing

1

Cool

thing

1

Cool

thing

2

Cool

thing

3

Cool

thing

2

Cool

thing

1

PA

NT

HE

ON

.IO

Moving to Microservices:

Visualising Technical

Debt, Kubernetes, and

GraphQL

PA

NT

HE

ON

.IO

“if you develop a program for a long period of time by only adding

features and never reorganizing it

to reflect your understanding of

those features, then eventually that

program simply does not contain any understanding and all efforts to work

on it take longer and longer”

- Ward Cunningham

PA

NT

HE

ON

.IO

Maybe you can fill

that gap by adding

new features…?

Cool

thing

1

Cool

thing

1

Cool

thing

2

Cool

thing

3

Cool

thing

2

Cool

thing

1

PA

NT

HE

ON

.IO

Cool thing 1

If you have not built

your build on pace...

probably not.

PA

NT

HE

ON

.IO

You need to invest in

teams to ship the

things.

Cool

team

1

Cool

team

2

Cool

team

3

PA

NT

HE

ON

.IO

AND you’re going to

build infrastructure to

support the product

being shipped.

Cool

Thing

1

Cool

Thing

2

Cool

Thing

3

PA

NT

HE

ON

.IO

AND you’re going to build

the tools to support the

infrastructure that

supports the product

being shipped.

Cool

Thing

1

Cool

Thing

2

Cool

Thing

3

Cool

Tool

1

Cool

Tool

2

PA

NT

HE

ON

.IO

AND you’re going to need

teams to support the tools

that support the

infrastructure that supports

the product being

shipped....

Cool

Thing

1

Cool

Thing

2

Cool

Thing

3

Cool

Tool

1

Cool

Tool

2

PA

NT

HE

ON

.IO

PA

NT

HE

ON

.IO

Sales knows to grow their team and

their process as complexity

increases.

PA

NT

HE

ON

.IO

Build how

you build on

pace with what

you build.

PA

NT

HE

ON

.IO

Incidentally,

PA

NT

HE

ON

.IO

I am terrible at this.

PA

NT

HE

ON

.IO

62

@mcraychee