This doc covers how to configure spaceone api endpoints and environments of spacectl.
- environment
- each environment is isolated each other.
- this is a unit of spaceconfig
- this includes api_key, endpoints
- api_key - an API Key which spacectl will use
- endpoints - all endpoints which spacectl will use.
This is just a sample for my local environment. I installed SpaceONE by helm3 on minikube and port-forwarded each service. So I can access eache microservice through its name and port number 50051. For example, if a microservice is identity
, I can access it through grpc://identity:50051
on my local.
# default.yml
# You should change the api_key. This is just a sample api_key
api_key: xxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxx
endpoints:
config: grpc://config:50051
identity: grpc://identity:50051
inventory: grpc://inventory:50051
monitoring: grpc://monitoring:50051
plugin: grpc://plugin:50051
repository: grpc://repository:50051
secret: grpc://secret:50051
statistics: grpc://statistics:50051
$ spacectl config init -f default.yaml
Environment [default]:
$ spacectl config init
Environment [default]:
$ spacectl config set api_key api_key: xxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxx
$ spacectl config endpoint add config grpc://config:50051
$ spacectl config endpoint add identity grpc://identity:50051
$ spacectl config endpoint add inventory grpc://inventory:50051
... # config other endpoints in the same way
# get the version of a microservice
$ spacectl exec get_version repository.ServerInfo
---
version: 1.2.1
# get all available apis
$ spacectl api_resources
...
We covered how to add endpoints. Let's edit endpoints now. We don't support edit command so you should delete an existing endpoint and create a new endpoint.
$ spacectl config endpoint show
Service | Endpoint
------------+-------------------------
config | grpc://config:50051
identity | grpc://identity:50051
...
$ spacectl config endpoint remove identity
$ spacectl config endpoint add identity grpc://spaceship:50051
$ spacectl config endpoint show
Service | Endpoint
------------+-------------------------
config | grpc://config:50051
identity | grpc://spacecship:50051
...
# You can see help message
$ spacectl config environment --help
$ spacectl config environment
default
helm-root (current)
$ spacectl config environment -s default
Switched to 'default' environment.