Transcript
Page 1: Cloud Orchestration with RightScale Cloud Workflow

CLOUD ORCHESTRATION

WITH

RIGHTSCALE CLOUD WORKFLOW

Page 2: Cloud Orchestration with RightScale Cloud Workflow

• Raphael Simon

• Chief Architect, RightScale

• Ryan O’Leary

• Senior Director Product, RightScale

Speakers

Page 3: Cloud Orchestration with RightScale Cloud Workflow

• Why Cloud Orchestration Matters

• Use Cases

• Overview of Cloud Workflow

• Behind the Scenes

• Demo

• Extending Cloud Workflow with Plugins

Agenda

Page 4: Cloud Orchestration with RightScale Cloud Workflow

Cloud Workflow Orchestrating the Clouds

Page 5: Cloud Orchestration with RightScale Cloud Workflow

• Complexity of cloud applications has been increasing • Micro-services, SaaS, PaaS, IaaS, containers, etc

• Orchestration is a requirement for the entire application

lifecycle • Must be code-based (no manual steps)

• From provisioning to operational actions and maintenance to

shutdown/cleanup

• Orchestration technology must be vendor-agnostic • Agility to use new services and optimize targets is a requirement

Introduction

Page 6: Cloud Orchestration with RightScale Cloud Workflow

Use Cases Why Cloud Workflow

Page 7: Cloud Orchestration with RightScale Cloud Workflow

• Resource dependency

• Sequential/concurrent actions

• Dealing with failures/errors

• Provision “N” number of a given resource

Orchestrated Provisioning

Complex applications require multi-service

orchestration to launch and configure correctly

Page 8: Cloud Orchestration with RightScale Cloud Workflow

• Environment-specific policies

• Complex quotas (user/group, core/memory, cost)

• Multi-resource policy definitions

• Multiple policy levels, including automated and man-in-the-

loop

Smart Policies

Cloud usage must be governed to ensure compliance

and minimize waste

Page 9: Cloud Orchestration with RightScale Cloud Workflow

• Automated runbook execution for dealing with known

problems

• Resolution attempts with multiple escalation paths

• Correlating alert information from multiple sources for more

informed responses

Contextual Alert Actions

Increase operational efficiency by automating alert

actions

Page 10: Cloud Orchestration with RightScale Cloud Workflow

• Scale relative to the event

• Scale down intelligently, removing the ideal nodes for the

application

• Scale up cost effectively, leveraging spot and/or discounted

instance types

Optimized Array Scaling

Save cost and improve performance by reacting

appropriately to load/usage events

Page 11: Cloud Orchestration with RightScale Cloud Workflow

• Runbook automation for regularly performed maintenance

tasks

• Include dependencies on other parts of the

application/environment

• Notify stakeholders via multiple channels and trigger other

actions in case of unexpected behavior

Operational Scheduled Actions

Automate regular maintenance tasks with visibility and

reporting

Page 12: Cloud Orchestration with RightScale Cloud Workflow

Overview What is Cloud Workflow?

Page 13: Cloud Orchestration with RightScale Cloud Workflow

● Goal: robust orchestration of cloud services

● Mean: code centered around the concept of resources ○ RightScale resources (servers, volumes, networks, applications etc.)

○ Arbitrary service resources via plugins (UPCOMING)

● Code in RCL (RightScale Cloud Workflow Language ○ Built-in functions to control resources lifetime (provision and delete)

○ Resource specific actions that make requests to arbitrary APIs

○ Scoping, variables, control flow, error handling, concurrency ...

Overview

Page 14: Cloud Orchestration with RightScale Cloud Workflow

Example

@deployment = rs_cm.deployment.create(name: “CWF rocks!”) @deployment.lock() # make API request to “lock” action delete(@deployment) # delete destroys the resource

API resource action parameters

Page 15: Cloud Orchestration with RightScale Cloud Workflow

Where does it fit?

Cloud

Workflow

Cloud Templates (CloudFormation, Azure

Templates)

Config. Mgmt (Puppet, Chef)

Client Tools (Terraform, ad-hoc

scripts)

Code type Imperative Declarative Mix Depends

Error Handling Explicit Implicit Implicit Depends

Multicloud? Yes No Yes Yes (w/ caveats)

Scope Systems Systems Servers Systems

Execution Hosted Hosted Mix Client / CI

Failure Modes Catastrophic Catastrophic SPOF SPOF

Introspection Full Basic No Basic

Page 16: Cloud Orchestration with RightScale Cloud Workflow

● Script like syntax

● Robust error handling

● Built-in timeout support

● Simple and explicit concurrency control

● Functions for making arbitrary HTTP requests

● Extensible via plugins

● Can be used together with Self-Service Cloud Applications

(CATs) to mix declarative with imperative code

Cloud Workflow Benefits

Page 17: Cloud Orchestration with RightScale Cloud Workflow

Error Handling

01 define main() do

02 @server = rs_cm.get(href: "/api/servers/123")

03 $attempts = 0

04

05 sub on_error: rescue($attempts) do

06 $attempts = $attempts + 1

07 @instance = @server.launch()

08 end

09 end

10

11 define rescue($attempts) do

12 if $attempts < 3

13 $_error_behavior = "retry"

14 end

15 end

Page 18: Cloud Orchestration with RightScale Cloud Workflow

Timeout

01 define main() do

02 @server = rs_cm.get(href: "/api/servers/123")

03 $atts = 0

04

05 sub timeout: 30s, on_timeout: rescue($atts), on_error:

rescue($atts) do

06 $atts = $atts + 1

07 @instance = @server.launch()

08 end

09 end

10

11 define rescue($attempts) do

12 if $attempts < 3

13 $_error_behavior = "retry"

14 end

15 end

Page 19: Cloud Orchestration with RightScale Cloud Workflow

Concurrency

1 define launch($serv1, $serv2, $serv3) return @inst1, @inst2,

@inst3 do

2 concurrent do

3 @inst1 = provision($server1) # blocks until @inst1 is

operational

4 @inst2 = provision($server2)

5 end

6 @inst3 = @serv3.launch()

7 end

Page 20: Cloud Orchestration with RightScale Cloud Workflow

Making HTTP requests

1 define random_text() return $body do

2 $resp = http_get(url: "http://loripsum.net/api")

3 $body = $resp["body"]["value"] # $resp contains the parsed

JSON

4 end

Page 21: Cloud Orchestration with RightScale Cloud Workflow

Behind the Scenes Cloud Workflow

Page 22: Cloud Orchestration with RightScale Cloud Workflow

Process Execution Flow

RCL Cloud

Workflow

External

API

Parse

Store

AST

Run

one expression Cloud

Workflow

Load / Save

one expression

Page 23: Cloud Orchestration with RightScale Cloud Workflow

No external state affected until step #4 ⇒ step #2 can be retried idempotently

This algorithm guarantees that the state of a process is

always consistent even when system failures occur.

Process Execution Algorithm

1. Load expression

2. Evaluate

3. Save expression

4. Apply evaluation outcome: make API requests, sleep,

raise error ...

5. Repeat until all expressions have completed

Page 24: Cloud Orchestration with RightScale Cloud Workflow

● A single process can run a number of concurrent tasks

● Code is not run concurrently, API requests are made concurrently

● Only one expression runs at any given time in the scope of a process to

guarantee that the state remains consistent even when system failures

occur.

Use concurrency to run flows concurrently, think workflow split and join

Process Concurrency

Parent

task

Parent

task

exp exp

exp exp exp

concurrent

Page 25: Cloud Orchestration with RightScale Cloud Workflow

Process Concurrency (2)

Parent Parent

activity (API requests)

T 1 T 2 T 1

activity

T 2

Concurrent execution

Page 26: Cloud Orchestration with RightScale Cloud Workflow

Demo

Page 27: Cloud Orchestration with RightScale Cloud Workflow

define main() do

task_label("Creating deployment")

@deployment = rs_cm.deployments.create(deployment: {"name": "CWF webinar"})

task_label("Waiting for deployment name to change to 'GO'")

sleep_until(@deployment.name == "GO")

task_label("Attempting to delete deployment ")

delete(@deployment)

task_label("Done!")

end

Page 28: Cloud Orchestration with RightScale Cloud Workflow

define main() do

task_label("Creating deployment")

@deployment = rs_cm.deployments.create(deployment: {"name": "CWF webinar"})

task_label("Waiting for deployment name to change to 'GO'")

sleep_until(@deployment.name == "GO")

$attempt = 1

sub on_error: handle_error(@deployment) do

task_label("Attempting to delete deployment (attempt " + $attempt + ")")

$attempt = $attempt + 1

delete(@deployment)

sleep(5)

end

task_label("Done!")

end

define handle_error(@deployment) do

task_label("Unlocking deployment")

@deployment.unlock()

sleep(5)

$_error_behavior = "retry"

end

Page 29: Cloud Orchestration with RightScale Cloud Workflow

Plugins Extending Cloud Workflow

Page 30: Cloud Orchestration with RightScale Cloud Workflow

RCL has the following built-in namespaces (a.k.a. APIs):

● rs_cm: RightScale Cloud Management APIs

● rs_ss: RightScale Self-Service APIs

● rs_ca: RightScale Cloud Analytics APIs (UPCOMING)

RCL also supports making HTTP requests to arbitrary

endpoints via the http_xxx functions.

Built-in Support

Page 31: Cloud Orchestration with RightScale Cloud Workflow

Describe resources hosted in external services, including:

● List of fields required to create resource

● List of output fields contained in created resource

● JMESPath expression for extracting output fields from responses

● List of actions supported by the resource (HTTP endpoints and

mapping of resource output fields to HTTP request)

● RCL definitions for provisioning and deleting resources

Plugins

Page 32: Cloud Orchestration with RightScale Cloud Workflow

Plugins - Example

plugin "digo" do

type "droplet" do

provision "provd"

delete "deld"

field "name" do

type "string", required: true

end

field "api_version" do

type "string"

location "header"

end

output_path "droplet"

output "id", "name"

...

...

action "show", "create",

"destroy"

action "kernels" do

verb "GET"

path "$href/kernels"

end

end

end

define provd($droplet) return @droplet

do

@droplet =

digo.droplet.create($droplet)

sleep_until(@droplet.status ==

"active")

end

define deld(@droplet) do

@droplet.detroy()

end

Page 33: Cloud Orchestration with RightScale Cloud Workflow

Plugins - Usage

define launch($droplet) return @droplet do

@droplet = provision($droplet)

@action = digo.actions.create(type: "enable_ipv6")

sleep_until(@action.status == "completed")

end

define main() return $name do

$fields = { "name" : "my droplet" }

$droplet = { "namespace": "digo", "type": "droplet", "fields":

$fields }

@droplet = launch($droplet)

$name = @droplet.name

end

Page 34: Cloud Orchestration with RightScale Cloud Workflow

• Need help optimizing cloud costs?

[email protected]

• Learn More • Plugin Webinar: https://www.rightscale.com/webinars (search “plugins”)

Q&A


Top Related