mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-12-15 08:05:19 -05:00
Remove cli/ec2
This commit is contained in:
parent
064151a956
commit
6a9419e89c
19 changed files with 6 additions and 1804 deletions
|
|
@ -13,8 +13,6 @@ import (
|
|||
|
||||
func GetScalingGroupsFromConfig(stat state.ConstellationState, config *configc.Config) (coordinators, nodes cmdc.ScalingGroup, err error) {
|
||||
switch {
|
||||
case len(stat.EC2Instances) != 0:
|
||||
return getAWSInstances(stat, config)
|
||||
case len(stat.GCPCoordinators) != 0:
|
||||
return getGCPInstances(stat, config)
|
||||
case len(stat.AzureCoordinators) != 0:
|
||||
|
|
@ -26,38 +24,6 @@ func GetScalingGroupsFromConfig(stat state.ConstellationState, config *configc.C
|
|||
}
|
||||
}
|
||||
|
||||
func getAWSInstances(stat state.ConstellationState, _ *configc.Config) (coordinators, nodes cmdc.ScalingGroup, err error) {
|
||||
coordinatorID, _, err := stat.EC2Instances.GetOne()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
coordinatorMap := stat.EC2Instances
|
||||
var coordinatorInstances cmdc.Instances
|
||||
for _, node := range coordinatorMap {
|
||||
coordinatorInstances = append(coordinatorInstances, cmdc.Instance(node))
|
||||
}
|
||||
// GroupID of coordinators is empty, since they currently do not scale.
|
||||
coordinators = cmdc.ScalingGroup{
|
||||
Instances: coordinatorInstances,
|
||||
GroupID: "",
|
||||
}
|
||||
nodeMap := stat.EC2Instances.GetOthers(coordinatorID)
|
||||
if len(nodeMap) == 0 {
|
||||
return cmdc.ScalingGroup{}, cmdc.ScalingGroup{}, errors.New("no nodes available, can't create Constellation with one instance")
|
||||
}
|
||||
|
||||
var nodeInstances cmdc.Instances
|
||||
for _, node := range nodeMap {
|
||||
nodeInstances = append(nodeInstances, cmdc.Instance(node))
|
||||
}
|
||||
|
||||
// TODO: make min / max configurable and abstract autoscaling for different cloud providers
|
||||
// TODO: GroupID of nodes is empty, since they currently do not scale.
|
||||
nodes = cmdc.ScalingGroup{Instances: nodeInstances}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func getGCPInstances(stat state.ConstellationState, config *configc.Config) (coordinators, nodes cmdc.ScalingGroup, err error) {
|
||||
coordinatorMap := stat.GCPCoordinators
|
||||
if len(coordinatorMap) == 0 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue