/public-cloud-info-service

Find IPs of service endpoints, and information about published images.

Primary LanguageRubyGNU General Public License v3.0GPL-3.0

Public Cloud Info Service

Provides a list of servers hosted in a cloud framework, for properly limiting network egress.

Provides information about published images in cloud frameworks, including lifecycle (active/inactive/deprecated/deleted) states.

Server Design

All requests must be made via HTTPS. SSL certificate validation is recommended. HTTP requests will receive a 302 REDIRECT to an equivalent HTTPS URL.

API:

https://susepubliccloudinfo.suse.com/VERSION/FRAMEWORK/REGION/TYPE/DATA-TYPE.FMT

Where

VERSION is:

v1 for the API documented here.

FRAMEWORK is one of:

amazon, google, microsoft, or oracle

REGION is optional, one of the known regions in the cloud framework. Use the region identifiers as the provider describes them, for example "us-east-1" in Amazon EC2, or "East US 2" in Microsoft Azure.

TYPE is one of:

servers or images

DATA-TYPE is one of

smt or regionserver for the servers type

active, inactive, deprecated or deleted for the images type

Design decisions for the API

The API flows from generic to specific. The most generic query is for the cloud framework. More specific is the framework plus either querying server or image information and so on. When the optional part is omitted we will provide all information at that level.

For example:

Metadata APIs

https://susepubliccloudinfo.suse.com/v1/providers.json

Will return list of all providers in JSON format

https://susepubliccloudinfo.suse.com/v1/images/states.json

Will return list of all image states in JSON format

https://susepubliccloudinfo.suse.com/v1/amazon/servers/types.json

Will return list of all server types in Amazon in JSON format

https://susepubliccloudinfo.suse.com/v1/amazon/regions.json

Will return list of all known regions in Amazon in JSON format

Specific APIs

https://susepubliccloudinfo.suse.com/v1/microsoft/West%20US/servers/smt.json

Will return information about all of our SMT servers running in this region in Azure in JSON format

https://susepubliccloudinfo.suse.com/v1/amazon/servers/regionserver.xml

Will return information about all Region servers in Amazon in all regions in XML format.

https://susepubliccloudinfo.suse.com/v1/google/images/deprecated.xml

Will return information about all deprecated images in Google Compute Engine.

https://susepubliccloudinfo.suse.com/v1/hp/images/active.json

Will return information about all active images in HP Helion.

Service implementation

The service will be implemented using Ruby, Sinatra framework. The data provided will be driven by XML files, one file per cloud provider. The data is structured as follows:

<framework name="">
  <servers>
    <smt name="" ip="" region=""/>
    <regionserver name="" ip="" region=""/>
  </servers>
  <images>
    <image deletedon="" deprecatedon="" id="" name="" publishedon=""
     region="" replacementid="" replacementname="" state=""/>
  </images>
</framework>

The "truth" for this document is in the various cloud frameworks. For Amazon the tags used as described in the life cycle blog will be used. For Google we will use the image information provided by the framework. For Microsoft and Oracle, data will be based on our image naming convention.

The XML file will be generated by a script that queries the various frameworks. The script runs daily on a VM on our server in Provo.

The information service will return properly formatted XML or JSON data.

Client Implementation

pint, our Python-based client, is available in the Public Cloud Module, or in the Cloud:Tools project in OBS, as python-susepubliccloudinfo.

Development

The following steps are only recommended if you want to build this project from sources, work on the codebase or test the latest development changes

  1. Install Git

    $ sudo zypper in git
    
  2. Install basic Ruby environment

    $ sudo zypper in ruby
    
  3. Install dependencies

    Install packages needed to compile Gems with native extensions:

    $ sudo zypper in gcc make ruby-devel ruby2.5-rubygem-rack
    
  4. Clone public-cloud-info-service repository and install Gem dependencies

    $ git clone https://github.com/SUSE-Enceladus/public-cloud-info-service.git 
    $ cd public-cloud-info-service 
    $ bundle install
    
  5. In order to run REST APIs on the host

    $ cd public-cloud-info-service
    $ export FRAMEWORKS=spec/fixtures/framework*.xml
    $ rackup
    

    To run REST APIs, point your browser to http://127.0.0.1:9292/

  6. In order to run tests

    $ cd public-cloud-info-service
    $ rspec