don’t talk to strangers: test isolation with containers

43
Don’t talk to strangers Test isolation with containers Hristo Iliev, Georgi Sabev | SAP Labs 18-19 November, Sofia

Upload: hristo-iliev

Post on 23-Jan-2018

394 views

Category:

Software


1 download

TRANSCRIPT

Page 1: Don’t talk to strangers: Test isolation with containers

Don’t talk to strangers

Test isolation with containers

Hristo Iliev, Georgi Sabev | SAP Labs 18-19 November, Sofia

Page 2: Don’t talk to strangers: Test isolation with containers

Hristo Iliev

ISTAcon.org 18-19 November, Sofia

SAP

• NetWeaver Application Server Java

• SAP HANA Cloud Platform

Open Source

• Eclipse Virgo

• Cloud Foundry (Diego & Abacus)

Page 3: Don’t talk to strangers: Test isolation with containers

Georgi Sabev

ISTAcon.org 18-19 November, Sofia

SAP

• SAP HANA Cloud Platform

Open Source

• Cloud Foundry (Diego & Abacus)

Page 4: Don’t talk to strangers: Test isolation with containers

PicturesCreative Commons @ Flickr

ISTAcon.org 18-19 November, Sofia

Page 5: Don’t talk to strangers: Test isolation with containers

Creating Working Software

ISTAcon.org 18-19 November, Sofia

Tests

Automation

Discipline

Page 6: Don’t talk to strangers: Test isolation with containers

Problems

ISTAcon.org 18-19 November, Sofia

Page 7: Don’t talk to strangers: Test isolation with containers

Test Pollution

ISTAcon.org 18-19 November, Sofia

Environment variables

Database records

Files

Programs / libraries

Page 8: Don’t talk to strangers: Test isolation with containers

Resource contention

ISTAcon.org 18-19 November, Sofia

Processes compete for

• CPU

• Memory

• I/O

Page 9: Don’t talk to strangers: Test isolation with containers

Multiple environments

ISTAcon.org 18-19 November, Sofia

OS

Mobile / Desktop

Cloud / Standalone

Databases

Versions

Page 10: Don’t talk to strangers: Test isolation with containers

Test problems summary

ISTAcon.org 18-19 November, Sofia

Test pollution

Resource contention

Multiple environments

Page 11: Don’t talk to strangers: Test isolation with containers

Solutions

ISTAcon.org 18-19 November, Sofia

Traditional

• Dedicated hardware

• Virtual machines

• Cloud: AWS, Azure

New tools

Page 12: Don’t talk to strangers: Test isolation with containers

Containersbuild, isolate, ship

ISTAcon.org 18-19 November, Sofia

Page 13: Don’t talk to strangers: Test isolation with containers

Container: Resource isolation

Tenant 1 Tenant 2 Tenant 3

Pro

cess

A

Pro

cess

B

Pro

cess

C

Pro

cess

D

Pro

cess

E

Pro

cess

F

CPU

Kernel

ISTAcon.org 18-19 November, Sofia

Page 14: Don’t talk to strangers: Test isolation with containers

Container: Resource isolation

Tenant 1 Tenant 2 Tenant 3

Pro

cess

A

Pro

cess

B

Pro

cess

C

Pro

cess

D

Pro

cess

E

Pro

cess

F

Kernel

A FEDCB

ISTAcon.org 18-19 November, Sofia

Page 15: Don’t talk to strangers: Test isolation with containers

Container: Resource isolation

Tenant 1 Tenant 2 Tenant 3

Pro

cess

A

Pro

cess

B

Pro

cess

C

Pro

cess

D

Pro

cess

E

Pro

cess

F

CPU

Kernel

A FEDCB

ISTAcon.org 18-19 November, Sofia

Page 16: Don’t talk to strangers: Test isolation with containers

Container: Resource isolation

Tenant 1 Tenant 2 Tenant 3

Pro

cess

A

Pro

cess

B

Pro

cess

C

Pro

cess

D

Pro

cess

E

Pro

cess

F

CPU

Kernel

A FEDCB

Linux Kernel

ISTAcon.org 18-19 November, Sofia

Page 17: Don’t talk to strangers: Test isolation with containers

Container: Namespace isolation

Tenant 1 Tenant 2 Tenant 3

Pro

cess

A

Pro

cess

B

Pro

cess

C

Pro

cess

A

Pro

cess

A

Pro

cess

B

PID, Network, Mount, User

Kernel

ISTAcon.org 18-19 November, Sofia

Page 18: Don’t talk to strangers: Test isolation with containers

Containerization = Lightweight Virtualization

ISTAcon.org 18-19 November, Sofia

Operating System

Hypervisor

Virtual Machine

Operating System

Bins / libs

App App

Virtual Machine

Operating System

Bins / libs

App App

Container Daemon

Container

Bins / libs

App App

Container

Bins / libs

App App

Virtualization Containerization

Operating System

Hardware Hardware

Page 19: Don’t talk to strangers: Test isolation with containers

Container

?

ISTAcon.org 18-19 November, Sofia

Page 20: Don’t talk to strangers: Test isolation with containers

Container

ISTAcon.org18-19 November, Sofia

Network

User

cgroups

PID

Isolation

Page 21: Don’t talk to strangers: Test isolation with containers

Container

+

Content

ISTAcon.org18-19 November, Sofia

Network

User

cgroups

PID

Isolation

Page 22: Don’t talk to strangers: Test isolation with containers

Container

++

Content Processes

ISTAcon.org18-19 November, Sofia

Network

User

cgroups

PID

Isolation

Page 23: Don’t talk to strangers: Test isolation with containers

Container

Network

User

cgroups

PID

ISTAcon.org 18-19 November, Sofia

Page 24: Don’t talk to strangers: Test isolation with containers

Container actions

Make me a container

ISTAcon.org 18-19 November, Sofia

Page 25: Don’t talk to strangers: Test isolation with containers

Container actions

Put this in itMake me a container

ISTAcon.org 18-19 November, Sofia

Page 26: Don’t talk to strangers: Test isolation with containers

Container actions

Put this in it Run this for meMake me a container

ISTAcon.org 18-19 November, Sofia

Page 27: Don’t talk to strangers: Test isolation with containers

Docker

ISTAcon.org 18-19 November, Sofia

“Build, Ship, Run” Containers

• Dockerfile

• Docker image

• Docker Hub

Page 28: Don’t talk to strangers: Test isolation with containers

Logos

ISTAcon.org 18-19 November, Sofia

Docker

Linux

Go lang

Page 29: Don’t talk to strangers: Test isolation with containers

Demo

ISTAcon.org 18-19 November, Sofia

Page 30: Don’t talk to strangers: Test isolation with containers

https://github.com/hsiliev/strangers

ISTAcon.org 18-19 November, Sofia

Page 31: Don’t talk to strangers: Test isolation with containers

Containers: Pros & Cons

ISTAcon.org 18-19 November, Sofia

Pros

• Isolation

• Reproducible environment

• Easy to maintain

Cons

• Multi-platform

• Discipline

Page 32: Don’t talk to strangers: Test isolation with containers

Software Production

ISTAcon.org 18-19 November, Sofia

Complexity

Tests

Automation

Page 33: Don’t talk to strangers: Test isolation with containers

PipelinesMultiple-builds

ISTAcon.org 18-19 November, Sofia

Page 34: Don’t talk to strangers: Test isolation with containers

Popular solutions

ISTAcon.org 18-19 November, Sofia

Build servers

Jenkins

Travis

Homegrown

Page 35: Don’t talk to strangers: Test isolation with containers

ConcourseCI, Pipelines, Delivery

ISTAcon.org 18-19 November, Sofia

Page 36: Don’t talk to strangers: Test isolation with containers

Concourse

ISTAcon.org 18-19 November, Sofia

Reproducible builds

Simple building blocks

Docker containers

Page 37: Don’t talk to strangers: Test isolation with containers

Concourse: Concepts

ISTAcon.org 18-19 November, Sofia

Resources

Tasks

Jobs

Build Job

ConfigureMakeInstall

Source Binary

Page 38: Don’t talk to strangers: Test isolation with containers

Concourse: Pipeline

ISTAcon.org 18-19 November, Sofia

resource

jobvalidated resource

Page 39: Don’t talk to strangers: Test isolation with containers

Demo

ISTAcon.org 18-19 November, Sofia

Page 40: Don’t talk to strangers: Test isolation with containers

https://github.com/hsiliev/strangers

ISTAcon.org 18-19 November, Sofia

Page 41: Don’t talk to strangers: Test isolation with containers

Concourse: Pros & Cons

ISTAcon.org 18-19 November, Sofia

Pros

• Reproducible environment

• Native pipeline support

• Release process modeling

Cons

• Maturity

• Scripting

Page 42: Don’t talk to strangers: Test isolation with containers

Q&AISTAcon.org 18-19 November, Sofia

Page 43: Don’t talk to strangers: Test isolation with containers

Thank you!

[email protected]

[email protected]

Hristo Iliev, Georgi Sabev | SAP Labs 18-19 November, Sofia