Cloud Orchestration with RightScale Cloud Workflow

Download Cloud Orchestration with RightScale Cloud Workflow

Post on 15-Apr-2017

142 views

Category:

Technology

3 download

Embed Size (px)

TRANSCRIPT

<ul><li><p>CLOUD ORCHESTRATION </p><p>WITH </p><p>RIGHTSCALE CLOUD WORKFLOW </p></li><li><p> Raphael Simon </p><p> Chief Architect, RightScale </p><p> Ryan OLeary </p><p> Senior Director Product, RightScale </p><p>Speakers </p></li><li><p> Why Cloud Orchestration Matters </p><p> Use Cases </p><p> Overview of Cloud Workflow </p><p> Behind the Scenes </p><p> Demo </p><p> Extending Cloud Workflow with Plugins </p><p>Agenda </p></li><li><p>Cloud Workflow Orchestrating the Clouds </p></li><li><p> Complexity of cloud applications has been increasing Micro-services, SaaS, PaaS, IaaS, containers, etc </p><p> Orchestration is a requirement for the entire application </p><p>lifecycle Must be code-based (no manual steps) </p><p> From provisioning to operational actions and maintenance to </p><p>shutdown/cleanup </p><p> Orchestration technology must be vendor-agnostic Agility to use new services and optimize targets is a requirement </p><p>Introduction </p></li><li><p>Use Cases Why Cloud Workflow </p></li><li><p> Resource dependency </p><p> Sequential/concurrent actions </p><p> Dealing with failures/errors </p><p> Provision N number of a given resource </p><p>Orchestrated Provisioning </p><p>Complex applications require multi-service </p><p>orchestration to launch and configure correctly </p></li><li><p> Environment-specific policies </p><p> Complex quotas (user/group, core/memory, cost) </p><p> Multi-resource policy definitions </p><p> Multiple policy levels, including automated and man-in-the-</p><p>loop </p><p>Smart Policies </p><p>Cloud usage must be governed to ensure compliance </p><p>and minimize waste </p></li><li><p> Automated runbook execution for dealing with known </p><p>problems </p><p> Resolution attempts with multiple escalation paths </p><p> Correlating alert information from multiple sources for more </p><p>informed responses </p><p>Contextual Alert Actions </p><p>Increase operational efficiency by automating alert </p><p>actions </p></li><li><p> Scale relative to the event </p><p> Scale down intelligently, removing the ideal nodes for the </p><p>application </p><p> Scale up cost effectively, leveraging spot and/or discounted </p><p>instance types </p><p>Optimized Array Scaling </p><p>Save cost and improve performance by reacting </p><p>appropriately to load/usage events </p></li><li><p> Runbook automation for regularly performed maintenance </p><p>tasks </p><p> Include dependencies on other parts of the </p><p>application/environment </p><p> Notify stakeholders via multiple channels and trigger other </p><p>actions in case of unexpected behavior </p><p>Operational Scheduled Actions </p><p>Automate regular maintenance tasks with visibility and </p><p>reporting </p></li><li><p>Overview What is Cloud Workflow? </p></li><li><p> Goal: robust orchestration of cloud services </p><p> Mean: code centered around the concept of resources RightScale resources (servers, volumes, networks, applications etc.) </p><p> Arbitrary service resources via plugins (UPCOMING) </p><p> Code in RCL (RightScale Cloud Workflow Language Built-in functions to control resources lifetime (provision and delete) </p><p> Resource specific actions that make requests to arbitrary APIs </p><p> Scoping, variables, control flow, error handling, concurrency ... </p><p>Overview </p></li><li><p>Example </p><p>@deployment = rs_cm.deployment.create(name: CWF rocks!) @deployment.lock() # make API request to lock action delete(@deployment) # delete destroys the resource </p><p>API resource action parameters </p></li><li><p>Where does it fit? </p><p>Cloud </p><p>Workflow </p><p>Cloud Templates (CloudFormation, Azure </p><p>Templates) </p><p>Config. Mgmt (Puppet, Chef) </p><p>Client Tools (Terraform, ad-hoc </p><p>scripts) </p><p>Code type Imperative Declarative Mix Depends </p><p>Error Handling Explicit Implicit Implicit Depends </p><p>Multicloud? Yes No Yes Yes (w/ caveats) </p><p>Scope Systems Systems Servers Systems </p><p>Execution Hosted Hosted Mix Client / CI </p><p>Failure Modes Catastrophic Catastrophic SPOF SPOF </p><p>Introspection Full Basic No Basic </p></li><li><p> Script like syntax </p><p> Robust error handling </p><p> Built-in timeout support </p><p> Simple and explicit concurrency control </p><p> Functions for making arbitrary HTTP requests </p><p> Extensible via plugins </p><p> Can be used together with Self-Service Cloud Applications </p><p>(CATs) to mix declarative with imperative code </p><p>Cloud Workflow Benefits </p></li><li><p>Error Handling </p><p>01 define main() do </p><p>02 @server = rs_cm.get(href: "/api/servers/123") </p><p>03 $attempts = 0 </p><p>04 </p><p>05 sub on_error: rescue($attempts) do </p><p>06 $attempts = $attempts + 1 </p><p>07 @instance = @server.launch() </p><p>08 end </p><p>09 end </p><p>10 </p><p>11 define rescue($attempts) do </p><p>12 if $attempts &lt; 3 </p><p>13 $_error_behavior = "retry" </p><p>14 end </p><p>15 end </p></li><li><p>Timeout </p><p>01 define main() do </p><p>02 @server = rs_cm.get(href: "/api/servers/123") </p><p>03 $atts = 0 </p><p>04 </p><p>05 sub timeout: 30s, on_timeout: rescue($atts), on_error: </p><p>rescue($atts) do </p><p>06 $atts = $atts + 1 </p><p>07 @instance = @server.launch() </p><p>08 end </p><p>09 end </p><p>10 </p><p>11 define rescue($attempts) do </p><p>12 if $attempts &lt; 3 </p><p>13 $_error_behavior = "retry" </p><p>14 end </p><p>15 end </p></li><li><p>Concurrency </p><p>1 define launch($serv1, $serv2, $serv3) return @inst1, @inst2, </p><p>@inst3 do </p><p>2 concurrent do </p><p>3 @inst1 = provision($server1) # blocks until @inst1 is </p><p>operational </p><p>4 @inst2 = provision($server2) </p><p>5 end </p><p>6 @inst3 = @serv3.launch() </p><p>7 end </p></li><li><p>Making HTTP requests </p><p>1 define random_text() return $body do </p><p>2 $resp = http_get(url: "http://loripsum.net/api") </p><p>3 $body = $resp["body"]["value"] # $resp contains the parsed </p><p>JSON </p><p>4 end </p></li><li><p>Behind the Scenes Cloud Workflow </p></li><li><p>Process Execution Flow </p><p>RCL Cloud </p><p>Workflow </p><p>External </p><p>API </p><p>Parse </p><p>Store </p><p>AST </p><p>Run </p><p>one expression Cloud </p><p>Workflow </p><p>Load / Save </p><p>one expression </p></li><li><p>No external state affected until step #4 step #2 can be retried idempotently </p><p>This algorithm guarantees that the state of a process is </p><p>always consistent even when system failures occur. </p><p>Process Execution Algorithm </p><p>1. Load expression </p><p>2. Evaluate </p><p>3. Save expression </p><p>4. Apply evaluation outcome: make API requests, sleep, </p><p>raise error ... </p><p>5. Repeat until all expressions have completed </p></li><li><p> A single process can run a number of concurrent tasks </p><p> Code is not run concurrently, API requests are made concurrently </p><p> Only one expression runs at any given time in the scope of a process to </p><p>guarantee that the state remains consistent even when system failures </p><p>occur. </p><p>Use concurrency to run flows concurrently, think workflow split and join </p><p>Process Concurrency </p><p>Parent </p><p>task </p><p>Parent </p><p>task </p><p>exp exp </p><p>exp exp exp </p><p>concurrent </p></li><li><p>Process Concurrency (2) </p><p>Parent Parent </p><p>activity (API requests) </p><p>T 1 T 2 T 1 </p><p>activity </p><p>T 2 </p><p>Concurrent execution </p></li><li><p>Demo </p></li><li><p>define main() do </p><p> task_label("Creating deployment") </p><p> @deployment = rs_cm.deployments.create(deployment: {"name": "CWF webinar"}) </p><p> task_label("Waiting for deployment name to change to 'GO'") </p><p> sleep_until(@deployment.name == "GO") </p><p> task_label("Attempting to delete deployment ") </p><p> delete(@deployment) </p><p> task_label("Done!") </p><p>end </p></li><li><p>define main() do </p><p> task_label("Creating deployment") </p><p> @deployment = rs_cm.deployments.create(deployment: {"name": "CWF webinar"}) </p><p> task_label("Waiting for deployment name to change to 'GO'") </p><p> sleep_until(@deployment.name == "GO") </p><p> $attempt = 1 </p><p> sub on_error: handle_error(@deployment) do </p><p> task_label("Attempting to delete deployment (attempt " + $attempt + ")") </p><p> $attempt = $attempt + 1 </p><p> delete(@deployment) </p><p> sleep(5) </p><p> end </p><p> task_label("Done!") </p><p>end </p><p>define handle_error(@deployment) do </p><p> task_label("Unlocking deployment") </p><p> @deployment.unlock() </p><p> sleep(5) </p><p> $_error_behavior = "retry" </p><p>end </p></li><li><p>Plugins Extending Cloud Workflow </p></li><li><p>RCL has the following built-in namespaces (a.k.a. APIs): </p><p> rs_cm: RightScale Cloud Management APIs </p><p> rs_ss: RightScale Self-Service APIs </p><p> rs_ca: RightScale Cloud Analytics APIs (UPCOMING) </p><p>RCL also supports making HTTP requests to arbitrary </p><p>endpoints via the http_xxx functions. </p><p>Built-in Support </p></li><li><p>Describe resources hosted in external services, including: </p><p> List of fields required to create resource </p><p> List of output fields contained in created resource </p><p> JMESPath expression for extracting output fields from responses </p><p> List of actions supported by the resource (HTTP endpoints and </p><p>mapping of resource output fields to HTTP request) </p><p> RCL definitions for provisioning and deleting resources </p><p>Plugins </p></li><li><p>Plugins - Example </p><p>plugin "digo" do </p><p> type "droplet" do </p><p> provision "provd" </p><p> delete "deld" </p><p> field "name" do </p><p> type "string", required: true </p><p> end </p><p> field "api_version" do </p><p> type "string" </p><p> location "header" </p><p> end </p><p> output_path "droplet" </p><p> output "id", "name" </p><p> ... </p><p> ... </p><p> action "show", "create", </p><p>"destroy" </p><p> action "kernels" do </p><p> verb "GET" </p><p> path "$href/kernels" </p><p> end </p><p> end </p><p>end </p><p>define provd($droplet) return @droplet </p><p>do </p><p> @droplet = </p><p>digo.droplet.create($droplet) </p><p> sleep_until(@droplet.status == </p><p>"active") </p><p>end </p><p>define deld(@droplet) do </p><p> @droplet.detroy() </p><p>end </p></li><li><p>Plugins - Usage </p><p>define launch($droplet) return @droplet do </p><p> @droplet = provision($droplet) </p><p> @action = digo.actions.create(type: "enable_ipv6") </p><p> sleep_until(@action.status == "completed") </p><p>end </p><p>define main() return $name do </p><p> $fields = { "name" : "my droplet" } </p><p> $droplet = { "namespace": "digo", "type": "droplet", "fields": </p><p>$fields } </p><p> @droplet = launch($droplet) </p><p> $name = @droplet.name </p><p>end </p></li><li><p> Need help optimizing cloud costs? </p><p> sales@rightscale.com </p><p> Learn More Plugin Webinar: https://www.rightscale.com/webinars (search plugins) </p><p>Q&amp;A </p><p>mailto:sales@rightscale.comhttps://www.rightscale.com/webinarshttps://www.rightscale.com/webinarshttps://www.rightscale.com/webinars</p></li></ul>