3. Powered
by
Megazone
Cloud
Micro Service Overview
Frontend
Backend
Plugins
console, console-api, console-assets
identity, secret, repository, plugin, config,
inventory, monitoring, statistics, billing,
cost-analysis
supervisor, plugin-xxxx
Github Repositories
standalone micro-services common library
relationship of
micro-services
python-core
api
SpaceONE consists of three micro service groups, Frontend, Backend, and Plugins
4. Powered
by
Megazone
Cloud
Micro Service Overview
Interface
CMP
Function
SpaceONE CMP Features
Management Portal
• Dashboard
• Reporting *
SDK
• API
• CLI
Inventory
• Resource Discovery
• Resource Classification
• On-premise integration *
• Multi-cloud
Identity
• User management
• Service Account mgmt.
• Project management
Monitoring
• Monitoring and Analysis
• Application Performance
monitoring *
Billing (Hyper billing)
• Consolidated billing
• Expense management
Basic features
Each component becomes standalone micro service.
ex) identity, inventory, monitoring, billing, console (Management portal)
Special functionality which supports other
micro services.
ex) secret, repository, plugin, config, supervisor
secret Saving encrypted credentials.
(ex. AWS secret_id, API_TOKEN …)
repository Provides available plugin
information. (ex. AWS collector)
Provides metadata like Policy,
Schema
plugin Manage running plugin list.
config Manage user or global variables.
supervisor Deploy plugins.
5. Powered
by
Megazone
Cloud
gRPC API
gRPC API gRPC API gRPC API
Plugin Interface
AWS Collector GCP Collector Azure Collector
...
Micro Service Overview
python-core
api
inventory
api
python-core
plugin-azure-cloud-services-inven-colle
ctor
Interface specification of
each micro service’s functionality
Backend micro service
framework
Implementation of micro service
inventory
micro service
inventory collector
micro services
Backend
Plugins
Github Repositories
Backend and Plugins has same S/W structure using API and python-core as common libraries. Each micro service implements API
spec.
10. Powered
by
Megazone
Cloud
SpaceONE API (gRPC protobuf)
https://github.com/spaceone-dev/api.git
gRPC (https://grpc.io)
● RPC based Framework from Google (Open-source version of Google
Stubby)
● Efficient communication protocol for distributed MSA
Proto
Buffer
(servicer)
gRPC
Server
Proto
Buffer
(stub)
gRPC
Client
Protobuf (IDL)
Protobuf Request
Protobuf Response
Interface Description between Server and Client
Byte stream communication with encoding message
Message size is 3~10 times smaller than XML, 20~100 times faster
Easy to implement different languages, C/C++, Java, Python, NodeJS,
Go
Interface Description Language based on Google
Protocol Buffer
Client Server
11. Powered
by
Megazone
Cloud
SpaceONE API (gRPC protobuf)
syntax = "proto3";
package spaceone.api.sample.v1;
// desc: The greeting service definition.
service HelloWorld {
// desc: Sends a greeting
rpc say_hello (HelloRequest) returns (HelloReply) {}
}
// desc: The request message containing the user's name.
message HelloRequest {
// is_required: true
string name = 1;
}
// desc: The response message containing the greetings
message HelloReply {
string message = 1;
}
https://github.com/spaceone-dev/api/blob/master/proto/spaceone/api/sample/v1/helloworld.proto
helloworld.proto
helloworld_pb2.py
helloworld_pb2_grpc.py
Compile
Descriptor of Messages
HelloRequest
HelloReply
Class of Service
HelloWorldStub
HelloWorldServicer
add_HelloWorldServicer_to_server
12. Powered
by
Megazone
Cloud
SpaceONE API (gRPC API)
SpaceONE API is a specification of each micro service’s functionalities.
gRPC API
The inventory micro service is a manipulation of cloud resources.
DB
micro service
name
Verb
(gRPC: method)
Resource
(gRPC: Service)
https://spaceone-dev.gitbook.io/spaceone-apis/inventory/v1
Server
Cloud Service
Job
…
…
For example, the inventory creates Server information on DB, and provides update, delete, list functionalities.
Resources
Verb
13. Powered
by
Megazone
Cloud
SpaceONE API (Plugin Interface)
Plugin Interface is an extension of micro service’s functionalities which are delegated to plugin micro services for scalability and
flexibility.
gRPC API For example, inventory micro service wants to collect multi cloud(AWS, Google, Azure)
resources.
https://spaceone-dev.gitbook.io/spaceone-apis/inventory/plugin/collector
Plugin Interface
gRPC API
AWS Collector
Resource: Collector
verb:
- init
- verify
- collect
Plugins
gRPC API
GCP Collector Verb
(gRPC: method)
Resource
(gRPC: Service)
Verb
(gRPC: method)
Resource
(gRPC: Service)
Every plugin should implement “init”, “verify”, and “collect” methods.
method parameters
(gRPC: message)
method return
(gRPC: message)
14. Powered
by
Megazone
Cloud
SpaceONE API (Plugin Interface)
gRPC API For example, inventory micro service wants to collect multi cloud(AWS, Google, Azure)
resources.
https://spaceone-dev.gitbook.io/spaceone-apis/
Plugin Interface
gRPC API
AWS Collector
Resource: Collector
verb:
- init
- verify
- collect
Plugins
Name Collector ID Plugin Info (metadata of collector plugin)
AWS Collector collector-1234 plugin_id: plugin-aws-collector
plugin version: 1.0.1
GCP Collector collector-5678 plugin_id: plugin-gcp-collector
plugin version: 1.2.3
…
inventory.Collector Table
gRPC API
GCP Collector
DB
Collector
API call: inventory.Collector( collector_id: collector-1234
).collect( )
micro service
name
Verb
(gRPC: method)
Resource
(gRPC: Service)
API call: plugin.Collector.collect( )
15. Powered
by
Megazone
Cloud
Hands-on Lab (2) build API
https://spaceone.org/docs/developers/api_sdk/api/
(2) make python
(1) git clone
https://github.com/spaceone-dev/api.git
16. Powered
by
Megazone
Cloud
SpaceONE Framework (Backend S/W Framework)
SpaceONE development team has created our own S/W framework like Python Django or Java Spring. We especially supports a
gRPC interface.
Layer Description
Interface
(API)
Entry point of Service Request
Handler Pre, Post processing of service call
Service Business logic of service
Cache Caching for manager
function(optional)
Manager Unit Operation for each service
function
Connector Interface for Data Source(ex. DB,
Other micro services)
https://spaceone.org/docs/developers/architecture/microservice_framework/
17. Powered
by
Megazone
Cloud
SpaceONE Framework (Software Skeleton)
Every backend and plugin micro services has same software directories.
Running micro service (gRPC)
COMMAND: spaceone grpc spaceone.<micro service name> <options>
service name Command
identity spaceone grpc spaceone.identity
inventory spaceone grpc spaceone.inventory
secret spaceone grpc spaceone.secret
sample spaceone grpc spaceone.sample
Software Skeleton
18. Powered
by
Megazone
Cloud
SpaceONE Framework (Server Type)
Backend S/W framework acts as various types, gRPC server, scheduler, worker, and rest server.
identity
(gRPC)
inventory
(gRPC)
inventory
(scheduler)
inventory
(worker)
monitoring
(gRPC)
monitoring
(rest)
Single code, use multiple
way!
identity service inventory service monitoring service
19. Powered
by
Megazone
Cloud
SpaceONE Framework (Handler)
Handler is pre/post processing of service
Handler is an annotation of service.
sequential processing
authentication → authorization →
mutation → event
Add annotation
handler implementation:
python-core
20. Powered
by
Megazone
Cloud
SpaceONE Framework (Handler)
Every micro services contacts identity, before executing API body.
inventory identity
Server.list( )
TOKEN: xxxx
Domain.get_public_key( )
@authentication
@authorization Authorization.verify(service, resource, verb )
domain_id, key, key_type
role_type, projects[],
project_groups[]
AUTHENTICATION_FAILURE
AUTHORIZATION_FAILURE
You are valid user!
Permit to execute this API
!
Execute main
body
Server list
21. Powered
by
Megazone
Cloud
SpaceONE Framework (Transaction)
Keep track of API call flow via Transaction ID.
inventory identity
Collector.collect( )
TOKEN: xxxx
@authentication, authorization
Execute main
body
Response
secret
Secret.get_data(
) plugin
Plugin.get_plugin_endpoint( )
tnx-1234
tnx-1234
tnx-1234
create New Transaction
transfer previous Transaction
Used as debugging and performance analysis
Transaction is automatically
created or delivered by core
framework. @transaction
22. Powered
by
Megazone
Cloud
SpaceONE Framework (Database Model)
Each micro service maintains its own database model.
micro service B
micro service A
Database (ex. MySQL)
micro service B
micro service A
Database
(ex. MySQL)
Database
(ex. NoSQL)
Conventional way, just separate Application only.
Easy to implement.
Separate Application and Database.
Each application has its own appropriate database.
Relationship is maintained by DB level.
ex. Primary key, secondary key
Relationship is maintained by Application
level.
ex. tenant_id, domain_id
V.S
23. Powered
by
Megazone
Cloud
SpaceONE Framework (Database Model)
Developer is not familiar with Database! No SQL statement in a program (Database Persistence Layer)
Database is abstracted as class.
from spaceone.inventory.model.server_model import Server
…
server_vo: Server = self.server_model.create(params)
just call class methods
ex) create, update, delete , list
Create class than call method!
DB table ⇒ Class
Field member ⇒ Class
member
25. Powered
by
Megazone
Cloud
[Hands-on Lab] Plugins
Create Service Account
Asset Inventory > Service Account
Create AWS Account
check AWS in Service
Providers
https://spaceone.org/docs/guides/service_account/aws_service_account_policy_management/