Merge pull request #20 from Mirantis/keystone-endpoint
Add keystone endpoint for ... keystone, document resources
This commit is contained in:
commit
dc11637125
72
README.md
72
README.md
@ -90,23 +90,19 @@ solar connections graph --start-with mariadb_service --end-with keystone_db
|
||||
solar resource validate
|
||||
```
|
||||
|
||||
* Disconnect
|
||||
```
|
||||
solar disconnect mariadb_service node1
|
||||
```
|
||||
|
||||
* Tag a resource:
|
||||
```
|
||||
solar resource tag node1 test-tags # Remove tags
|
||||
solar resource tag node1 test-tag --delete
|
||||
```
|
||||
|
||||
# Low level API
|
||||
|
||||
## HAProxy deployment (not maintained)
|
||||
|
||||
```
|
||||
cd /vagrant
|
||||
python cli.py deploy haproxy_deployment/haproxy-deployment.yaml
|
||||
```
|
||||
|
||||
or from Python shell:
|
||||
|
||||
```
|
||||
from x import deployment
|
||||
|
||||
deployment.deploy('/vagrant/haproxy_deployment/haproxy-deployment.yaml')
|
||||
```
|
||||
|
||||
## Usage:
|
||||
|
||||
Creating resources:
|
||||
@ -181,42 +177,18 @@ node1.ssh_key = '/vagrant/.vagrant/machines/solar-dev1/virtualbox/private_key'
|
||||
node1.ssh_user = 'vagrant'
|
||||
```
|
||||
|
||||
## CLI
|
||||
|
||||
You can do the above from the command-line client:
|
||||
## HAProxy deployment (not maintained)
|
||||
|
||||
```
|
||||
cd /vagrant
|
||||
|
||||
python cli.py resource create node1 x/resources/ro_node/ rs/ '{"ip":"10.0.0.3", "ssh_key" : "/vagrant/tmp/keys/ssh_private", "ssh_user":"vagrant"}'
|
||||
|
||||
python cli.py resource create node2 x/resources/ro_node/ rs/ '{"ip":"10.0.0.4", "ssh_key" : "/vagrant/tmp/keys/ssh_private", "ssh_user":"vagrant"}'
|
||||
|
||||
python cli.py resource create mariadb_keystone_data x/resources/data_container/ rs/ '{"image": "mariadb", "export_volumes" : ["/var/lib/mysql"], "ip": "", "ssh_user": "", "ssh_key": ""}'
|
||||
|
||||
python cli.py resource create mariadb_nova_data x/resources/data_container/ rs/ '{"image" : "mariadb", "export_volumes" : ["/var/lib/mysql"], "ip": "", "ssh_user": "", "ssh_key": ""}'
|
||||
|
||||
# View resourcespython cli.py resource show rs/mariadb_keystone_data
|
||||
# Show all resources at location rs/
|
||||
python cli.py resource show rs/ --all
|
||||
|
||||
# Show resources with specific tagspython cli.py resources show rs/ --tag test
|
||||
|
||||
# Connect resourcespython cli.py connect rs/node2 rs/mariadb_keystone_data
|
||||
python cli.py connect rs/node1 rs/mariadb_nova_data
|
||||
# Test updatepython cli.py update rs/node2 '{"ip": "1.1.1.1"}'
|
||||
python cli.py resource show rs/mariadb_keystone_data # --> IP is 1.1.1.1
|
||||
|
||||
# View connections
|
||||
python cli.py connections show
|
||||
|
||||
# Outputs graph to 'graph.png' file, please note that arrows don't have "normal" pointers, but just the line is thicker
|
||||
# please see http://networkx.lanl.gov/_modules/networkx/drawing/nx_pylab.html
|
||||
python cli.py connections graph
|
||||
|
||||
# Disconnect
|
||||
python cli.py disconnect rs/mariadb_nova_data rs/node1
|
||||
|
||||
# Tag a resource:
|
||||
python cli.py resource tag rs/node1 test-tags# Remove tagspython cli.py resource tag rs/node1 test-tag --delete
|
||||
solar deploy haproxy_deployment/haproxy-deployment.yaml
|
||||
```
|
||||
|
||||
or from Python shell:
|
||||
|
||||
```
|
||||
from solar.core import deployment
|
||||
|
||||
deployment.deploy('/vagrant/haproxy_deployment/haproxy-deployment.yaml')
|
||||
```
|
||||
|
||||
|
@ -48,6 +48,8 @@ def deploy():
|
||||
#keystone_puppet = vr.create('keystone_puppet', GitProvider(GIT_PUPPET_LIBS_URL, path='keystone'), {})[0]
|
||||
keystone_puppet = vr.create('keystone_puppet', 'resources/keystone_puppet', {})[0]
|
||||
|
||||
keystone_service_endpoint = vr.create('keystone_service_endpoint', 'resources/keystone_service_endpoint', {'endpoint_name': 'keystone', 'adminurl': 'http://{{admin_ip}}:{{admin_port}}/v2.0', 'internalurl': 'http://{{internal_ip}}:{{internal_port}}/v2.0', 'publicurl': 'http://{{public_ip}}:{{public_port}}/v2.0', 'description': 'OpenStack Identity Service', 'type': 'identity'})[0]
|
||||
|
||||
# # TODO: vhost cannot be specified in neutron Puppet manifests so this user has to be admin anyways
|
||||
# neutron_puppet = vr.create('neutron_puppet', GitProvider(GIT_PUPPET_LIBS_URL, path='neutron'), {'rabbitmq_user': 'guest', 'rabbitmq_password': 'guest'})[0]
|
||||
neutron_puppet = vr.create('neutron_puppet', 'resources/neutron_puppet', {'rabbitmq_user': 'guest', 'rabbitmq_password': 'guest'})[0]
|
||||
@ -60,7 +62,7 @@ def deploy():
|
||||
neutron_keystone_user = vr.create('neutron_keystone_user', 'resources/keystone_user', {'user_name': 'neutron', 'user_password': 'neutron'})[0]
|
||||
neutron_keystone_role = vr.create('neutron_keystone_role', 'resources/keystone_role', {'role_name': 'neutron'})[0]
|
||||
|
||||
neutron_keystone_service_endpoint = vr.create('neutron_keystone_service_endpoint', 'resources/keystone_service_endpoint', {'adminurl': 'http://{{admin_ip}}:{{admin_port}}', 'internalurl': 'http://{{internal_ip}}:{{internal_port}}', 'publicurl': 'http://{{public_ip}}:{{public_port}}', 'description': 'OpenStack Network Service', 'type': 'network'})[0]
|
||||
neutron_keystone_service_endpoint = vr.create('neutron_keystone_service_endpoint', 'resources/keystone_service_endpoint', {'endpoint_name': 'neutron', 'adminurl': 'http://{{admin_ip}}:{{admin_port}}', 'internalurl': 'http://{{internal_ip}}:{{internal_port}}', 'publicurl': 'http://{{public_ip}}:{{public_port}}', 'description': 'OpenStack Network Service', 'type': 'network'})[0]
|
||||
|
||||
# #cinder_puppet = vr.create('cinder_puppet', GitProvider(GIT_PUPPET_LIBS_URL, 'cinder'), {})[0]
|
||||
# cinder_puppet = vr.create('cinder_puppet', 'resources/cinder_puppet', {})[0]
|
||||
@ -96,6 +98,12 @@ def deploy():
|
||||
signals.connect(mariadb_service1, keystone_db_user, {'port': 'login_port', 'root_password': 'login_password'})
|
||||
signals.connect(keystone_db, keystone_db_user, {'db_name': 'db_name'})
|
||||
|
||||
signals.connect(node1, keystone_service_endpoint)
|
||||
signals.connect(keystone_puppet, keystone_service_endpoint, {'admin_token': 'admin_token', 'admin_port': 'keystone_admin_port', 'ip': 'keystone_host'})
|
||||
signals.connect(keystone_puppet, keystone_service_endpoint, {'admin_port': 'admin_port', 'ip': 'admin_ip'})
|
||||
signals.connect(keystone_puppet, keystone_service_endpoint, {'port': 'internal_port', 'ip': 'internal_ip'})
|
||||
signals.connect(keystone_puppet, keystone_service_endpoint, {'port': 'public_port', 'ip': 'public_ip'})
|
||||
|
||||
signals.connect(keystone_puppet, admin_tenant)
|
||||
signals.connect(keystone_puppet, admin_tenant, {'admin_port': 'keystone_port', 'ip': 'keystone_host'})
|
||||
signals.connect(admin_tenant, admin_user)
|
||||
@ -173,6 +181,8 @@ def deploy():
|
||||
actions.resource_action(admin_user, 'run')
|
||||
actions.resource_action(admin_role, 'run')
|
||||
|
||||
actions.resource_action(keystone_service_endpoint, 'run')
|
||||
|
||||
actions.resource_action(services_tenant, 'run')
|
||||
actions.resource_action(neutron_keystone_user, 'run')
|
||||
actions.resource_action(neutron_keystone_role, 'run')
|
||||
@ -198,9 +208,31 @@ def deploy():
|
||||
def undeploy():
|
||||
db = get_db()
|
||||
|
||||
to_remove = [
|
||||
'neutron_keystone_service_endpoint',
|
||||
'neutron_puppet',
|
||||
'neutron_keystone_role',
|
||||
'neutron_keystone_user',
|
||||
'services_tenant',
|
||||
'keystone_service_endpoint',
|
||||
'admin_role',
|
||||
'admin_user',
|
||||
'admin_tenant',
|
||||
'keystone_puppet',
|
||||
'keystone_db_user',
|
||||
'keystone_db',
|
||||
'mariadb_service1',
|
||||
'openstack_rabbitmq_user',
|
||||
'openstack_vhost',
|
||||
'rabbitmq_service1',
|
||||
]
|
||||
|
||||
resources = map(resource.wrap_resource, db.get_list(collection=db.COLLECTIONS.resource))
|
||||
resources = {r.name: r for r in resources}
|
||||
|
||||
for name in to_remove:
|
||||
actions.resource_action(resources[name], 'remove')
|
||||
|
||||
#actions.resource_action(resources['nova_keystone_service_endpoint'], 'remove' )
|
||||
# actions.resource_action(resources['nova_network_puppet'], 'remove' )
|
||||
|
||||
@ -209,29 +241,29 @@ def undeploy():
|
||||
|
||||
# actions.resource_action(resources['cinder_puppet'], 'remove' )
|
||||
|
||||
actions.resource_action(resources['neutron_keystone_service_endpoint'], 'remove' )
|
||||
actions.resource_action(resources['neutron_puppet'], 'remove' )
|
||||
# actions.resource_action(resources['neutron_keystone_service_endpoint'], 'remove' )
|
||||
# actions.resource_action(resources['neutron_puppet'], 'remove' )
|
||||
|
||||
# actions.resource_action(resources['cinder_keystone_role'], 'remove')
|
||||
# actions.resource_action(resources['cinder_keystone_user'], 'remove')
|
||||
|
||||
actions.resource_action(resources['neutron_keystone_role'], 'remove')
|
||||
actions.resource_action(resources['neutron_keystone_user'], 'remove')
|
||||
actions.resource_action(resources['services_tenant'], 'remove')
|
||||
# actions.resource_action(resources['neutron_keystone_role'], 'remove')
|
||||
# actions.resource_action(resources['neutron_keystone_user'], 'remove')
|
||||
# actions.resource_action(resources['services_tenant'], 'remove')
|
||||
|
||||
actions.resource_action(resources['admin_role'], 'remove')
|
||||
actions.resource_action(resources['admin_user'], 'remove')
|
||||
actions.resource_action(resources['admin_tenant'], 'remove')
|
||||
# actions.resource_action(resources['admin_role'], 'remove')
|
||||
# actions.resource_action(resources['admin_user'], 'remove')
|
||||
# actions.resource_action(resources['admin_tenant'], 'remove')
|
||||
|
||||
actions.resource_action(resources['keystone_puppet'], 'remove')
|
||||
actions.resource_action(resources['keystone_db_user'], 'remove')
|
||||
actions.resource_action(resources['keystone_db'], 'remove')
|
||||
# actions.resource_action(resources['keystone_puppet'], 'remove')
|
||||
# actions.resource_action(resources['keystone_db_user'], 'remove')
|
||||
# actions.resource_action(resources['keystone_db'], 'remove')
|
||||
|
||||
actions.resource_action(resources['mariadb_service1'], 'remove')
|
||||
# actions.resource_action(resources['mariadb_service1'], 'remove')
|
||||
|
||||
actions.resource_action(resources['openstack_rabbitmq_user'], 'remove')
|
||||
actions.resource_action(resources['openstack_vhost'], 'remove')
|
||||
actions.resource_action(resources['rabbitmq_service1'], 'remove')
|
||||
# actions.resource_action(resources['openstack_rabbitmq_user'], 'remove')
|
||||
# actions.resource_action(resources['openstack_vhost'], 'remove')
|
||||
# actions.resource_action(resources['rabbitmq_service1'], 'remove')
|
||||
|
||||
db.clear()
|
||||
|
||||
|
11
resources/haproxy_config/README.md
Normal file
11
resources/haproxy_config/README.md
Normal file
@ -0,0 +1,11 @@
|
||||
# `haproxy_config` resource
|
||||
|
||||
This resource represents configuration for the `haproxy_service` resource.
|
||||
Each service represented by Haproxy is connected to this resource via
|
||||
`haproxy_service_config` resource. This is because in Haproxy there is no
|
||||
support for something like `/etc/haproxy/conf.d` directory where you put
|
||||
each config in a separate file, but instead you must collect all configuration
|
||||
in one file.
|
||||
|
||||
So this resource renders this file from data provided by collecting individual
|
||||
`haproxy_service_config` data.
|
8
resources/haproxy_service/README.md
Normal file
8
resources/haproxy_service/README.md
Normal file
@ -0,0 +1,8 @@
|
||||
# `haproxy_service` resource
|
||||
|
||||
This resource sets up a Docker container with Haproxy code. It requires
|
||||
config to be provided by the `haproxy_config` resource (mounted under
|
||||
`/etc/haproxy`).
|
||||
|
||||
About container philosophy, see the `README.md` file in `keystone_service`
|
||||
resource.
|
5
resources/haproxy_service_config/README.md
Normal file
5
resources/haproxy_service_config/README.md
Normal file
@ -0,0 +1,5 @@
|
||||
# `haproxy_service_config` resource
|
||||
|
||||
This resource represents config for a single service handled by Haproxy.
|
||||
It connects into `haproxy_config`. It collects all services which are to
|
||||
be load-balanced by Haproxy.
|
6
resources/keystone_puppet/README.md
Normal file
6
resources/keystone_puppet/README.md
Normal file
@ -0,0 +1,6 @@
|
||||
# `keystone_puppet` resource
|
||||
|
||||
This resource implements inputs for the official OpenStack Keystone Puppet manifests
|
||||
from https://github.com/openstack/puppet-keystone (`stable/juno` branch).
|
||||
|
||||
Basic tests are present that test HTTP connectivity to the service.
|
11
resources/keystone_service/README.md
Normal file
11
resources/keystone_service/README.md
Normal file
@ -0,0 +1,11 @@
|
||||
# `keystone_service` resource
|
||||
|
||||
This resource sets up a Docker container with Keystone code. It requires
|
||||
config to be provided by the `keystone_config` resource (mounted under
|
||||
`/etc/keystone`).
|
||||
|
||||
Basically, the philosophy behind containers in Solar is to have stateless
|
||||
containers with service code and mount stateful resources with config,
|
||||
volumes, etc. to that container. Upgrade of code then would be just about
|
||||
replacing the stateless container with new one and remounting state to that
|
||||
new container.
|
@ -4,7 +4,7 @@
|
||||
- name: keystone service and endpoint
|
||||
keystone_service:
|
||||
token: {{admin_token}}
|
||||
name: {{resource_name}}
|
||||
name: {{endpoint_name}}
|
||||
type: {{type}}
|
||||
description: {{description}}
|
||||
publicurl: {{publicurl}}
|
||||
|
@ -12,6 +12,9 @@ input:
|
||||
schema: str!
|
||||
value:
|
||||
|
||||
endpoint_name:
|
||||
schema: str!
|
||||
value:
|
||||
type:
|
||||
schema: str!
|
||||
value:
|
||||
|
Loading…
Reference in New Issue
Block a user