+ All Categories
Home > Technology > Vancouver presentation

Vancouver presentation

Date post: 07-Aug-2015
Category:
Upload: colleenmurphy
View: 149 times
Download: 0 times
Share this document with a friend
37
Developing OpenStack Tooling ...without Python Colleen Murphy, HP
Transcript
Page 1: Vancouver presentation

Developing OpenStack Tooling

...without PythonColleen Murphy, HP

Page 2: Vancouver presentation

The problem

We need to manage OpenStack resources with puppet

Page 3: Vancouver presentation

Lightning intro to puppet

● resource - something being managed on a system

● type - the interface of the resource● provider - the backend implementation of the

resource

Page 4: Vancouver presentation

Example: file

file { '/root/example':

ensure => present,

content => 'A file resource managed by puppet',

mode => '0644',

}

Page 5: Vancouver presentation

Example: mysql_database

mysql_database { 'keystone':

ensure => present,

charset => 'utf8',

collate => 'utf8_general_ci',

}

Page 6: Vancouver presentation

Example: mysql_database# puppet apply mysql.pp --debug

Debug: Prefetching mysql resources for mysql_database

Debug: Executing '/usr/bin/mysql --defaults-extra-file=/root/.my.cnf

-NBe show databases'

Debug: Executing '/usr/bin/mysql --defaults-extra-file=/root/.my.cnf

-NBe create database if not exists `keystone` character set `utf8`

collate `utf8_general_ci`'

Notice: /Stage[main]/Main/Mysql_database[keystone]/ensure: created

#

Page 7: Vancouver presentation

Example: keystone_tenant

keystone_tenant { 'services':

ensure => present,

description => 'The services tenant',

enabled => true,

}

Page 8: Vancouver presentation

Requirements

● features● restrictions

Page 9: Vancouver presentation

We’re not alone

● terraform● other config mgmt

○ chef○ salt○ ansible

● internal ops tools

Page 10: Vancouver presentation

Stage 1

Page 11: Vancouver presentation

Shelling out to the CLIcommands :keystone => "keystone"

def self.auth_keystone(*args)

authenv = {:OS_SERVICE_TOKEN => admin_token}

withenv authenv do

remove_warnings(keystone('--os-endpoint', admin_endpoint, args))

end

end

results = auth_keystone('tenant-create', '--name', resource[:name],

'--enabled', resource[:

enabled])

Page 12: Vancouver presentation

Shelling out to the CLI# puppet apply keystone.pp --debug

Debug: Prefetching keystone resources for keystone_tenant

Debug: Executing '/usr/local/bin/keystone --os-endpoint http://127.

0.0.1:35357/v2.0/ tenant-list'

Debug: Executing '/usr/local/bin/keystone --os-endpoint http://127.

0.0.1:35357/v2.0/ tenant-create --name services --enabled True --

description The services tenant'

Notice: /Stage[main]/Main/Keystone_tenant[services]/ensure: created

#

Page 13: Vancouver presentation

What was good

● Idiomatic● Debuggable

Page 14: Vancouver presentation

What was bad

● Instability● Duplicated code

Page 15: Vancouver presentation

Why we switched

Instability

Page 16: Vancouver presentation

Stage 2

Page 17: Vancouver presentation

curl?curl -H 'Content-Type: application/json' -X POST -d '{

"auth": {

"tenantName": "admin",

"passwordCredentials": {

"username": "admin",

"password": "passw0rd"

}

}

}' http://127.0.0.1:35357/v2.0/tokens

Page 18: Vancouver presentation

curl - Update a project (v2)curl -H 'X-Auth-Token: 8bc163' -H 'Content-Type: application/json' \

-X POST -d '{

"tenant": {

"description": "new description",

"enabled": true

}

}' http://localhost:35357/v2.0/tenants/28551b

Page 19: Vancouver presentation

curl - Update a network (v2)curl -H 'X-Auth-Token: 5a072f' -H 'Content-Type: application/json' \

-X PUT -d '{

"network": {

"admin_state_up": true

}

}' http://127.0.0.1:9696/v2.0/networks/ff9cc0

Page 20: Vancouver presentation

curl - Update an image (v1)

curl -H 'X-Auth-Token: c23ea2d' \

-H 'x-image-meta-disk_format: vhd' \

-X PUT http://localhost:9292/v1/images/7d863c

Page 21: Vancouver presentation

curl - Update an image (v2)

curl -H 'X-Auth-Token: 7ac5c8' \

-H 'Content-Type:

application/openstack-images-v2.1-json-patch' \

-d '[{

"path": "/disk_format", "value": "vhd", "op": "replace"

}]' \

-X PATCH http://127.0.0.1:9292/v2/images/40de3a

Page 22: Vancouver presentation

curl?

Let’s not reinvent a framework

Page 23: Vancouver presentation

An SDK?

“A set of language bindings that provide a language-level API for accessing OpenStack in a manner consistent with language standards.” https://wiki.openstack.org/wiki/SDKs

Page 24: Vancouver presentation
Page 25: Vancouver presentation
Page 26: Vancouver presentation

An SDK?

“Currently, OpenStack's user stories for both command-line and application developer consumers of OpenStack based clouds is confusing, fractured, and inconsistent.”https://wiki.openstack.org/wiki/SDK-Development/PythonOpenStackSDK

Page 27: Vancouver presentation

fog?

● too big, too general-purpose

Page 28: Vancouver presentation

aviator

session = ::Aviator::Session.new(:config => configuration)

session.authenticate

response = session.request(:identity,

:create_tenant, options) do |params|

params.name = resource[:name]

params.enabled = resource[:enabled]

params.description = resource[:description]

end

Page 29: Vancouver presentation

What was good

● OpenStack-focused● responsive maintainer

Page 30: Vancouver presentation

What was bad

● session management● vendoring the gem● question of sustainability

Page 31: Vancouver presentation

Why we switched

keystone v3

Page 32: Vancouver presentation

Stage 3

Page 33: Vancouver presentation

OpenStackClient (...another CLI)# puppet apply keystone.pp --debug

Debug: Executing '/usr/local/bin/openstack project list --quiet

--format csv --long --os-token sosp-kyl --os-url http://127.

0.0.1:35357/v2.0/'

Debug: Executing '/usr/local/bin/openstack project create --

format shell services --enable --description The services tenant

--os-url http://127.0.0.1:35357/v2.0/'

Notice: /Stage[main]/Main/Keystone_tenant[services]/ensure:

created

#

Page 34: Vancouver presentation

What was good

● keystone v3 support● distro packages● well-supported● consistency across modules

Page 35: Vancouver presentation

What was bad

● laggy support from distros● stability is ?

Page 36: Vancouver presentation

Status

Incomplete

Page 37: Vancouver presentation

Colleen [email protected]: crinkle - #puppet-openstacktwitter: @pdx_krinkle

Questions or comments?


Recommended