~vila/ubuntu/precise/keystone/fix-922954

« back to all changes in this revision

Viewing changes to doc/source/endpoints.rst

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2011-12-02 09:40:35 UTC
  • mfrom: (1.1.5)
  • Revision ID: package-import@ubuntu.com-20111202094035-2x7v0jmc00vn3k6s
Tags: 2012.1~e2~20111202.1379-0ubuntu1
* New upstream release.
* debian/control:
  + Fix dependencies. 
* keystone.postinst:
  + Fix bashism.
  + Remove keystone-manage db sync.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
..
 
2
      Copyright 2011 OpenStack, LLC
 
3
      All Rights Reserved.
 
4
 
 
5
      Licensed under the Apache License, Version 2.0 (the "License"); you may
 
6
      not use this file except in compliance with the License. You may obtain
 
7
      a copy of the License at
 
8
 
 
9
          http://www.apache.org/licenses/LICENSE-2.0
 
10
 
 
11
      Unless required by applicable law or agreed to in writing, software
 
12
      distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 
13
      WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 
14
      License for the specific language governing permissions and limitations
 
15
      under the License.
 
16
 
 
17
================================
 
18
Endpoints and Endpoint Templates
 
19
================================
 
20
 
 
21
.. toctree::
 
22
   :maxdepth: 1
 
23
 
 
24
What are Endpoints?
 
25
-------------------
 
26
 
 
27
Simply, endpoints are URLs that point to OpenStack services. When you
 
28
authenticate to Keystone you get back a token which has a service catalog in
 
29
it. The service catalog is basically a list of the OpenStack services that
 
30
you have access to and the URLs you can use to get to them; their endpoints.
 
31
 
 
32
Here is an example response from Keystone when you authenticate::
 
33
 
 
34
    {
 
35
        "access":{
 
36
            "token":{
 
37
                "id":"ab48a9efdfedb23ty3494",
 
38
                "expires":"2010-11-01T03:32:15-05:00",
 
39
                "tenant":{
 
40
                    "id": "t1000",
 
41
                    "name": "My Project"
 
42
                }
 
43
            },
 
44
            "user":{
 
45
                "id":"u123",
 
46
                "name":"jqsmith",
 
47
                "roles":[{
 
48
                        "id":"100",
 
49
                        "name":"compute:admin"
 
50
                    },
 
51
                    {
 
52
                        "id":"101",
 
53
                        "name":"object-store:admin",
 
54
                        "tenantId":"t1000"
 
55
                    }
 
56
                ],
 
57
                "roles_links":[]
 
58
            },
 
59
            "serviceCatalog":[{
 
60
                    "name":"Nova",
 
61
                    "type":"compute",
 
62
                    "endpoints":[{
 
63
                            "tenantId":"t1000",
 
64
                            "publicURL":"https://compute.north.host.com/v1/t1000",
 
65
                            "internalURL":"https://compute.north.internal/v1/t1000",
 
66
                            "region":"North",
 
67
                            "versionId":"1",
 
68
                            "versionInfo":"https://compute.north.host.com/v1/",
 
69
                            "versionList":"https://compute.north.host.com/"
 
70
                        },
 
71
                        {
 
72
                            "tenantId":"t1000",
 
73
                            "publicURL":"https://compute.north.host.com/v1.1/t1000",
 
74
                            "internalURL":"https://compute.north.internal/v1.1/t1000",
 
75
                            "region":"North",
 
76
                            "versionId":"1.1",
 
77
                            "versionInfo":"https://compute.north.host.com/v1.1/",
 
78
                            "versionList":"https://compute.north.host.com/"
 
79
                        }
 
80
                    ],
 
81
                    "endpoints_links":[]
 
82
                },
 
83
                {
 
84
                    "name":"Swift",
 
85
                    "type":"object-store",
 
86
                    "endpoints":[{
 
87
                            "tenantId":"t1000",
 
88
                            "publicURL":"https://storage.north.host.com/v1/t1000",
 
89
                            "internalURL":"https://storage.north.internal/v1/t1000",
 
90
                            "region":"North",
 
91
                            "versionId":"1",
 
92
                            "versionInfo":"https://storage.north.host.com/v1/",
 
93
                            "versionList":"https://storage.north.host.com/"
 
94
                        },
 
95
                        {
 
96
                            "tenantId":"t1000",
 
97
                            "publicURL":"https://storage.south.host.com/v1/t1000",
 
98
                            "internalURL":"https://storage.south.internal/v1/t1000",
 
99
                            "region":"South",
 
100
                            "versionId":"1",
 
101
                            "versionInfo":"https://storage.south.host.com/v1/",
 
102
                            "versionList":"https://storage.south.host.com/"
 
103
                        }
 
104
                    ]
 
105
                },
 
106
                {
 
107
                    "name":"DNS-as-a-Service",
 
108
                    "type":"dnsextension:dns",
 
109
                    "endpoints":[{
 
110
                            "tenantId":"t1000",
 
111
                            "publicURL":"https://dns.host.com/v2.0/t1000",
 
112
                            "versionId":"2.0",
 
113
                            "versionInfo":"https://dns.host.com/v2.0/",
 
114
                            "versionList":"https://dns.host.com/"
 
115
                        }
 
116
                    ]
 
117
                }
 
118
            ]
 
119
        }
 
120
    }
 
121
 
 
122
Note the following about this response:
 
123
 
 
124
#. There are two endpoints given to the Nova compute service. The only
 
125
   difference between them is the version (1.0 vs. 1.1). This allows for code
 
126
   written to look for the version 1.0 endpoint to still work even after the 1.1
 
127
   version is released.
 
128
 
 
129
#. There are two endpoints for the Swift object-store service. The difference
 
130
   between them is they are in different regions (North and South).
 
131
 
 
132
#. Note the DNS service is global; it does not have a Region. Also, since DNS
 
133
   is not a core OpenStack service, the endpoint type is "dnsextension:dns"
 
134
   showing it is coming from an extension to the Keystone service.
 
135
 
 
136
#. The Region, Tenant, and versionId are listed under the endpoint. You do not
 
137
   (and should not) have to parse those out of the URL. In fact, they may not be
 
138
   embedded in the URL if the service developer so chooses.
 
139
 
 
140
 
 
141
What do the fields in an Endpoint mean?
 
142
---------------------------------------
 
143
 
 
144
The schema definition for an endpoint is in endpoints.xsd under
 
145
keystone/content/common/xsd in the Keystone code repo. The fields are:
 
146
 
 
147
id
 
148
    A unique ID for the endpoint.
 
149
 
 
150
type
 
151
    The OpenStack-registered type (ex. 'compute', 'object-store', 'image service')
 
152
    This can also be extended using the OpenStack Extension mechanism to support
 
153
    non-core services. Extended services will be in the form ``extension:type``
 
154
    (e.g. ``dnsextension:dns``)
 
155
 
 
156
name
 
157
    This can be anything that the operator of OpenStack chooses. It could be a
 
158
    brand or marketing name (ex. Rackspace Cloud Servers).
 
159
 
 
160
region
 
161
    This is a string that identifies the region where this endpoint exists.
 
162
    Examples are 'North America', 'Europe', 'Asia'. Or 'North' and 'South'. Or
 
163
    'Data Center 1', 'Data Center 2'.
 
164
    The list of regions and what a region means is decided by the operator. The
 
165
    spec treats them as opaque strings.
 
166
 
 
167
publicURL
 
168
    This is the URL to use to access that endpoint over the internet.
 
169
 
 
170
internalURL
 
171
    This is the URL to use to communicate between services. This is genenrally
 
172
    a way to communicate between services over a high bandwidth, low latency,
 
173
    unmetered (free, no bandwidth charges) network. An example would be if you
 
174
    want to access a swift cluster from inside your Nova VMs and want to make
 
175
    sure the communication stays local and does not go over a public network
 
176
    and rack up your bandwidth charges.
 
177
 
 
178
adminURL
 
179
    This is the URL to use to administer the service. In Keystone, this URL
 
180
    is only shown to users with the appropriate rights.
 
181
 
 
182
tenantId
 
183
    If an endpoint is specific to a tenant, the tenantId field identifies the
 
184
    tenant that URL applies to. Some operators include the tenant in the
 
185
    URLs for a service, while others may provide one endpoint and use some
 
186
    other mechanism to identify the tenant. This field is therefore optional.
 
187
    Having this field also means you do not have to parse the URL to identify
 
188
    a tenant if the operator includes it in the URL.
 
189
 
 
190
versionId
 
191
    This identifies the version of the API contract that endpoint supports.
 
192
    While many APIs include the version in the URL (ex: https://compute.host/v1),
 
193
    this field allows you to identify the version without parsing the URL. It
 
194
    therefore also allows operators and service developers to publish endpoints
 
195
    that do not have versions embedded in the URL.
 
196
 
 
197
versionInfo
 
198
    This is the URL to call to get some information on the version. This returns
 
199
    information in this format::
 
200
 
 
201
        {
 
202
        "version": {
 
203
          "id": "v2.0",
 
204
          "status": "CURRENT",
 
205
          "updated": "2011-01-21T11:33:21-06:00",
 
206
          "links": [
 
207
            {
 
208
              "rel": "self",
 
209
              "href": "http://identity.api.openstack.org/v2.0/"
 
210
            }, {
 
211
              "rel": "describedby",
 
212
              "type": "application/pdf",
 
213
              "href": "http://docs.openstack.org/identity/api/v2.0/identity-latest.pdf"
 
214
            }, {
 
215
              "rel": "describedby",
 
216
              "type": "application/vnd.sun.wadl+xml",
 
217
              "href": "http://docs.openstack.org/identity/api/v2.0/identity.wadl"
 
218
            }
 
219
          ],
 
220
            "media-types": [
 
221
              {
 
222
                "base": "application/xml",
 
223
                "type": "application/vnd.openstack.identity+xml;version=2.0"
 
224
              }, {
 
225
                "base": "application/json",
 
226
                "type": "application/vnd.openstack.identity+json;version=2.0"
 
227
              }
 
228
            ]
 
229
          }
 
230
        }
 
231
 
 
232
versionList
 
233
 
 
234
    This is the URL to call to find out which versions are supported at that
 
235
    endpoint. The response is in this format::
 
236
 
 
237
        {
 
238
            "versions":[{
 
239
                    "id":"v1.0",
 
240
                    "status":"DEPRECATED",
 
241
                    "updated":"2009-10-09T11:30:00Z",
 
242
                    "links":[{
 
243
                            "rel":"self",
 
244
                            "href":"http://identity.api.openstack.org/v1.0/"
 
245
                        }
 
246
                    ]
 
247
                },
 
248
                {
 
249
                    "id":"v1.1",
 
250
                    "status":"CURRENT",
 
251
                    "updated":"2010-12-12T18:30:02.25Z",
 
252
                    "links":[{
 
253
                            "rel":"self",
 
254
                            "href":"http://identity.api.openstack.org/v1.1/"
 
255
                        }
 
256
                    ]
 
257
                },
 
258
                {
 
259
                    "id":"v2.0",
 
260
                    "status":"BETA",
 
261
                    "updated":"2011-05-27T20:22:02.25Z",
 
262
                    "links":[{
 
263
                            "rel":"self",
 
264
                            "href":"http://identity.api.openstack.org/v2.0/"
 
265
                        }
 
266
                    ]
 
267
                }
 
268
            ],
 
269
            "versions_links":[]
 
270
        }
 
271
 
 
272
    Here, the response shows that the endpoint supports version 1.0, 1.1, and 2.0.
 
273
    It also shows that 1.0 is in DEPRECTAED status and 2.0 is in BETA.
 
274
 
 
275
What are Endpoint Templates?
 
276
----------------------------
 
277
 
 
278
Endpoint Templates are a way for an administrator to manage endpoints en masse.
 
279
They provide a way to define Endpoints that apply to many or all tenants
 
280
without having to a create each endpoint on each tenant manually. Without
 
281
Endpoint Templates, if I wanted to create Endpoints for each tenant in my
 
282
OpenStack deployment, I'd have to manually create a bunch of endpoints on
 
283
each tenant (probably when I created the tenant). And then I'd have to go change
 
284
them all whenever a service changed versions or I added a new service.
 
285
 
 
286
To provide a simpler mechanism to manage endpoints on tenants, Keystone uses
 
287
Endpoint Templates. I can, for example, define a template with parametrized URLs
 
288
and set it's `global` to true and that will show up as an endpoint on all the tenants
 
289
I have. Here is an example:
 
290
 
 
291
Define a global Endpoint Template::
 
292
 
 
293
    $ ./keystone-manage endpointTemplates add North nova https://compute.north.example.com/v1/%tenant_id%/ https://compute.north.example.corp/v1/ https://compute.north.example.local/v1/%tenant_id%/ 1 1
 
294
 
 
295
    The arguments are: object_type action 'region' 'service_name' 'publicURL' 'adminURL' 'internalURL' 'enabled' 'global'
 
296
 
 
297
This creates a global endpoint (global means it gets applied to all tenants automatically).
 
298
 
 
299
Now, when a user authenticates, they get that endpoint in their service catalog. Here's an example
 
300
authentication request for use against tenant 1::
 
301
 
 
302
    $ curl -H "Content-type: application/json" -d '{"auth":{"passwordCredentials":{"username":"joeuser","password":"secrete"}, "tenantId": "1"}}' http://localhost:5000/v2.0/tokens
 
303
 
 
304
The response is::
 
305
 
 
306
    {
 
307
        "access": {
 
308
            "serviceCatalog": [
 
309
                {
 
310
                    "endpoints": [
 
311
                        {
 
312
                            "internalURL": "https://compute.north.example.local",
 
313
                            "publicURL": "https://compute.north.example.com/v1/1/",
 
314
                            "region": "North"
 
315
                        }
 
316
                    ],
 
317
                    "name": "nova",
 
318
                    "type": "compute"
 
319
                }
 
320
            ],
 
321
            "token": {
 
322
                "expires": "2012-02-05T00:00:00",
 
323
                "id": "887665443383838",
 
324
                "tenant": {
 
325
                    "id": "1",
 
326
                    "name": "customer-x"
 
327
                }
 
328
            },
 
329
            "user": {
 
330
                "id": "1",
 
331
                "name": "joeuser",
 
332
                "roles": [
 
333
                    {
 
334
                        "id": "3",
 
335
                        "name": "Member",
 
336
                        "tenantId": "1"
 
337
                    }
 
338
                ]
 
339
            }
 
340
        }
 
341
    }
 
342
 
 
343
Notice the adminURL is not showing (this user is a regular user and does not
 
344
have rights to see the adminURL) and the tenant ID has been substituted in the
 
345
URL::
 
346
 
 
347
    "publicURL": "https://compute.north.example.com/v1/1/",
 
348
 
 
349
This endpoint will show up for all tenants. The OpenStack administrator does
 
350
not need to create the endpoint manually.
 
351
 
 
352
.. note:: Endpoint Templates are not part of the core Keystone API (but Endpoints are).
 
353
 
 
354
 
 
355
What parameters can I use in a Template URL
 
356
-------------------------------------------
 
357
 
 
358
Currently the only parameterization available is %tenant_id% which gets
 
359
substituted by the Tenant ID.
 
360
 
 
361
 
 
362
Endpoint Template Types: Global or not
 
363
--------------------------------------
 
364
 
 
365
When the global flag is set to true on an Endpoint Template, it means it should
 
366
be available to all tenants. Whenever someone authenticates to a tenant, they
 
367
will see the Endpoint generated by that template.
 
368
 
 
369
When the global flag is not set, the template only shows up when it is added to
 
370
a tenant manually. To add an endpoint to a tenant manually, you must create
 
371
the Endpoint and supply the Endpoint Template ID:
 
372
 
 
373
Create the Endpoint Template::
 
374
 
 
375
    $ ./keystone-manage endpointTemplates add West nova https://compute.west.example.com/v1/%tenant_id%/ https://compute.west.example.corp https://compute.west.example.local 1 0
 
376
 
 
377
    Note the 0 at the end - this Endpoint Template is not global. So it will not show up for users authenticating.
 
378
 
 
379
Find the Endpoint Template ID::
 
380
 
 
381
    $ ./keystone-manage endpointTemplates list
 
382
 
 
383
    All EndpointTemplates
 
384
    id    service    type    region    enabled    is_global    Public URL    Admin URL
 
385
    -------------------------------------------------------------------------------
 
386
    15    nova    compute    North    True    True    https://compute.north.example.com/v1/%tenant_id%/    https://compute.north.example.corp
 
387
    16    nova    compute    West    True    False    https://compute.west.example.com/v1/%tenant_id%/    https://compute.west.example.corp
 
388
 
 
389
Add the Endpoint to the tenant::
 
390
 
 
391
    $ ./keystone-manage endpoint add customer-x 16
 
392
 
 
393
Now, when the user authenticates, they get the endpoint::
 
394
 
 
395
    {
 
396
        "internalURL": "https://compute.west.example.local",
 
397
        "publicURL": "https://compute.west.example.com/v1/1/",
 
398
        "region": "West"
 
399
    }
 
400
 
 
401
Who can see the AdminURL?
 
402
-------------------------
 
403
 
 
404
Users who have the Keystone `Admin` or `Service Admin` roles will see the
 
405
AdminURL when they authenticate or when they retrieve token information:
 
406
 
 
407
Using an administrator token to authenticate, GET a client token's endpoints::
 
408
 
 
409
    $ curl -H "X-Auth-Token: 999888777666" http://localhost:35357/v2.0/tokens/887665443383838/endpoints
 
410
 
 
411
    {
 
412
        "endpoints": [
 
413
            {
 
414
                "adminURL": "https://compute.west.example.corp",
 
415
                "id": 6,
 
416
                "internalURL": "https://compute.west.example.local",
 
417
                "name": "nova",
 
418
                "publicURL": "https://compute.west.example.com/v1/1/",
 
419
                "region": "West",
 
420
                "tenantId": 1,
 
421
                "type": "compute"
 
422
            }
 
423
        ],
 
424
        "endpoints_links": [
 
425
            {
 
426
                "href": "http://127.0.0.1:35357/tokens/887665443383838/endpoints?marker=6&limit=10", 
 
427
                "rel": "next"
 
428
            }
 
429
        ]
 
430
    }