node-triton icon indicating copy to clipboard operation
node-triton copied to clipboard

Multiple related datacenter handling could use some elegance

Open bahamat opened this issue 8 years ago • 5 comments

I now have 16 profiles among 5 different clouds. The intent is to have some sort of grouping for datacenters within the same cloud.

Some ideas

  • Use ListDatacenters to identify related DCs
  • Some sort of profile grouping tag

Advantages

  • Grouped datacenters/profiles could use a single auth declaration. Changing the key would require updating a single file rather than many
  • Cloud/group-wide operations (e.g., list everything, create N instances per dc)

bahamat avatar Jan 13 '17 22:01 bahamat

Yah, I feel your pain:

$ triton profiles -H | wc -l
      31

For example, as discussed, I have this blunt instrument:

tritons-jpc ()
{
   for prof in east3b ams1 east1 sw1 west1 east2 east3;
   do
       echo "# $prof" 1>&2;
       triton -p $prof $*;
   done
}

But that is slow and ugly.

Changing the key would require updating a single file rather than many

Or perhaps a single 'triton profile update ...' command (rather than updating profile files directly).

trentm avatar Jan 13 '17 22:01 trentm

Do we have the region information exposed today about a datacenter so we can automatically use that to help group things?

rmustacc avatar Jan 13 '17 22:01 rmustacc

@rmustacc

$ triton -p east1 datacenters
NAME       URL
eu-ams-1   https://eu-ams-1.api.joyentcloud.com
us-east-1  https://us-east-1.api.joyentcloud.com
us-east-2  https://us-east-2.api.joyentcloud.com
us-east-3  https://us-east-3.api.joyentcloud.com
us-sw-1    https://us-sw-1.api.joyentcloud.com
us-west-1  https://us-west-1.api.joyentcloud.com

trentm avatar Jan 13 '17 22:01 trentm

A first think on Triton CLI profile groups:

$ triton profile group create jpc west1 east1 east2 east3
Profile group 'jpc' created: west1, east1, east2, east3

$ triton profile group add jpc ams1
Added profile 'ams1' to profile group 'jpc'

$ triton profile groups
GROUP  PROFILES
jpc    west1, east1, east2, east3, ams1

$ triton -p jpc ls
PROFILE  SHORTID   NAME   IMG                        STATE    FLAGS  AGE
east1    2bc60065  foo0   [email protected]  running  -      50w
east2    6b50782c  blah1  [email protected]  running  -      45w
...

and similar for other triton commands. Some things to feel out:

Some commands would need to error out:

$ triton -p jpc create ...
triton create: error (AmbiguousProfile): Which profile in profile group 'jpc' should be used here??

Or perhaps we could have a default profile set in a group for things like this.

$ triton profile group set-default jpc east1

Not sure what profile commands should do in some cases:

$ triton -p jpc profile get
???

Should that error out, or possibly emit the "default" profile for that group if it has one.

trentm avatar Jan 13 '17 22:01 trentm

Then perhaps would like to use ListDatacenters output to make it easy to go from triton profile create of a profile for, say, us-east-1, and get a set of profiles for all the DCs and a group for all of them.

trentm avatar Jan 13 '17 22:01 trentm