mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-01-11 23:49:30 -05:00
Remove azure instances
This commit is contained in:
parent
3562345da4
commit
21127a4cdc
@ -15,7 +15,7 @@ import (
|
|||||||
"github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac"
|
"github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac"
|
||||||
"github.com/Azure/go-autorest/autorest"
|
"github.com/Azure/go-autorest/autorest"
|
||||||
"github.com/Azure/go-autorest/autorest/azure/auth"
|
"github.com/Azure/go-autorest/autorest/azure/auth"
|
||||||
"github.com/edgelesssys/constellation/cli/azure"
|
"github.com/edgelesssys/constellation/cli/cloud/cloudtypes"
|
||||||
"github.com/edgelesssys/constellation/internal/cloud/cloudprovider"
|
"github.com/edgelesssys/constellation/internal/cloud/cloudprovider"
|
||||||
"github.com/edgelesssys/constellation/internal/state"
|
"github.com/edgelesssys/constellation/internal/state"
|
||||||
)
|
)
|
||||||
@ -42,8 +42,8 @@ type Client struct {
|
|||||||
adReplicationLagCheckInterval time.Duration
|
adReplicationLagCheckInterval time.Duration
|
||||||
adReplicationLagCheckMaxRetries int
|
adReplicationLagCheckMaxRetries int
|
||||||
|
|
||||||
nodes azure.Instances
|
nodes cloudtypes.Instances
|
||||||
coordinators azure.Instances
|
coordinators cloudtypes.Instances
|
||||||
|
|
||||||
name string
|
name string
|
||||||
uid string
|
uid string
|
||||||
@ -103,8 +103,8 @@ func NewFromDefault(subscriptionID, tenantID string) (*Client, error) {
|
|||||||
virtualMachinesAPI: &virtualMachinesClient{virtualMachinesAPI},
|
virtualMachinesAPI: &virtualMachinesClient{virtualMachinesAPI},
|
||||||
subscriptionID: subscriptionID,
|
subscriptionID: subscriptionID,
|
||||||
tenantID: tenantID,
|
tenantID: tenantID,
|
||||||
nodes: azure.Instances{},
|
nodes: cloudtypes.Instances{},
|
||||||
coordinators: azure.Instances{},
|
coordinators: cloudtypes.Instances{},
|
||||||
adReplicationLagCheckInterval: adReplicationLagCheckInterval,
|
adReplicationLagCheckInterval: adReplicationLagCheckInterval,
|
||||||
adReplicationLagCheckMaxRetries: adReplicationLagCheckMaxRetries,
|
adReplicationLagCheckMaxRetries: adReplicationLagCheckMaxRetries,
|
||||||
}, nil
|
}, nil
|
||||||
|
@ -3,7 +3,7 @@ package client
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/edgelesssys/constellation/cli/azure"
|
"github.com/edgelesssys/constellation/cli/cloud/cloudtypes"
|
||||||
"github.com/edgelesssys/constellation/internal/cloud/cloudprovider"
|
"github.com/edgelesssys/constellation/internal/cloud/cloudprovider"
|
||||||
"github.com/edgelesssys/constellation/internal/state"
|
"github.com/edgelesssys/constellation/internal/state"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
@ -18,13 +18,13 @@ func TestSetGetState(t *testing.T) {
|
|||||||
"valid state": {
|
"valid state": {
|
||||||
state: state.ConstellationState{
|
state: state.ConstellationState{
|
||||||
CloudProvider: cloudprovider.Azure.String(),
|
CloudProvider: cloudprovider.Azure.String(),
|
||||||
AzureNodes: azure.Instances{
|
AzureNodes: cloudtypes.Instances{
|
||||||
"0": {
|
"0": {
|
||||||
PublicIP: "ip1",
|
PublicIP: "ip1",
|
||||||
PrivateIP: "ip2",
|
PrivateIP: "ip2",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
AzureCoordinators: azure.Instances{
|
AzureCoordinators: cloudtypes.Instances{
|
||||||
"0": {
|
"0": {
|
||||||
PublicIP: "ip3",
|
PublicIP: "ip3",
|
||||||
PrivateIP: "ip4",
|
PrivateIP: "ip4",
|
||||||
@ -45,7 +45,7 @@ func TestSetGetState(t *testing.T) {
|
|||||||
"missing nodes": {
|
"missing nodes": {
|
||||||
state: state.ConstellationState{
|
state: state.ConstellationState{
|
||||||
CloudProvider: cloudprovider.Azure.String(),
|
CloudProvider: cloudprovider.Azure.String(),
|
||||||
AzureCoordinators: azure.Instances{
|
AzureCoordinators: cloudtypes.Instances{
|
||||||
"0": {
|
"0": {
|
||||||
PublicIP: "ip3",
|
PublicIP: "ip3",
|
||||||
PrivateIP: "ip4",
|
PrivateIP: "ip4",
|
||||||
@ -67,7 +67,7 @@ func TestSetGetState(t *testing.T) {
|
|||||||
"missing coordinator": {
|
"missing coordinator": {
|
||||||
state: state.ConstellationState{
|
state: state.ConstellationState{
|
||||||
CloudProvider: cloudprovider.Azure.String(),
|
CloudProvider: cloudprovider.Azure.String(),
|
||||||
AzureNodes: azure.Instances{
|
AzureNodes: cloudtypes.Instances{
|
||||||
"0": {
|
"0": {
|
||||||
PublicIP: "ip1",
|
PublicIP: "ip1",
|
||||||
PrivateIP: "ip2",
|
PrivateIP: "ip2",
|
||||||
@ -89,13 +89,13 @@ func TestSetGetState(t *testing.T) {
|
|||||||
"missing name": {
|
"missing name": {
|
||||||
state: state.ConstellationState{
|
state: state.ConstellationState{
|
||||||
CloudProvider: cloudprovider.Azure.String(),
|
CloudProvider: cloudprovider.Azure.String(),
|
||||||
AzureNodes: azure.Instances{
|
AzureNodes: cloudtypes.Instances{
|
||||||
"0": {
|
"0": {
|
||||||
PublicIP: "ip1",
|
PublicIP: "ip1",
|
||||||
PrivateIP: "ip2",
|
PrivateIP: "ip2",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
AzureCoordinators: azure.Instances{
|
AzureCoordinators: cloudtypes.Instances{
|
||||||
"0": {
|
"0": {
|
||||||
PublicIP: "ip3",
|
PublicIP: "ip3",
|
||||||
PrivateIP: "ip4",
|
PrivateIP: "ip4",
|
||||||
@ -116,13 +116,13 @@ func TestSetGetState(t *testing.T) {
|
|||||||
"missing uid": {
|
"missing uid": {
|
||||||
state: state.ConstellationState{
|
state: state.ConstellationState{
|
||||||
CloudProvider: cloudprovider.Azure.String(),
|
CloudProvider: cloudprovider.Azure.String(),
|
||||||
AzureNodes: azure.Instances{
|
AzureNodes: cloudtypes.Instances{
|
||||||
"0": {
|
"0": {
|
||||||
PublicIP: "ip1",
|
PublicIP: "ip1",
|
||||||
PrivateIP: "ip2",
|
PrivateIP: "ip2",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
AzureCoordinators: azure.Instances{
|
AzureCoordinators: cloudtypes.Instances{
|
||||||
"0": {
|
"0": {
|
||||||
PublicIP: "ip3",
|
PublicIP: "ip3",
|
||||||
PrivateIP: "ip4",
|
PrivateIP: "ip4",
|
||||||
@ -143,13 +143,13 @@ func TestSetGetState(t *testing.T) {
|
|||||||
"missing resource group": {
|
"missing resource group": {
|
||||||
state: state.ConstellationState{
|
state: state.ConstellationState{
|
||||||
CloudProvider: cloudprovider.Azure.String(),
|
CloudProvider: cloudprovider.Azure.String(),
|
||||||
AzureNodes: azure.Instances{
|
AzureNodes: cloudtypes.Instances{
|
||||||
"0": {
|
"0": {
|
||||||
PublicIP: "ip1",
|
PublicIP: "ip1",
|
||||||
PrivateIP: "ip2",
|
PrivateIP: "ip2",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
AzureCoordinators: azure.Instances{
|
AzureCoordinators: cloudtypes.Instances{
|
||||||
"0": {
|
"0": {
|
||||||
PublicIP: "ip3",
|
PublicIP: "ip3",
|
||||||
PrivateIP: "ip4",
|
PrivateIP: "ip4",
|
||||||
@ -170,13 +170,13 @@ func TestSetGetState(t *testing.T) {
|
|||||||
"missing location": {
|
"missing location": {
|
||||||
state: state.ConstellationState{
|
state: state.ConstellationState{
|
||||||
CloudProvider: cloudprovider.Azure.String(),
|
CloudProvider: cloudprovider.Azure.String(),
|
||||||
AzureNodes: azure.Instances{
|
AzureNodes: cloudtypes.Instances{
|
||||||
"0": {
|
"0": {
|
||||||
PublicIP: "ip1",
|
PublicIP: "ip1",
|
||||||
PrivateIP: "ip2",
|
PrivateIP: "ip2",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
AzureCoordinators: azure.Instances{
|
AzureCoordinators: cloudtypes.Instances{
|
||||||
"0": {
|
"0": {
|
||||||
PublicIP: "ip3",
|
PublicIP: "ip3",
|
||||||
PrivateIP: "ip4",
|
PrivateIP: "ip4",
|
||||||
@ -197,13 +197,13 @@ func TestSetGetState(t *testing.T) {
|
|||||||
"missing subscription": {
|
"missing subscription": {
|
||||||
state: state.ConstellationState{
|
state: state.ConstellationState{
|
||||||
CloudProvider: cloudprovider.Azure.String(),
|
CloudProvider: cloudprovider.Azure.String(),
|
||||||
AzureNodes: azure.Instances{
|
AzureNodes: cloudtypes.Instances{
|
||||||
"0": {
|
"0": {
|
||||||
PublicIP: "ip1",
|
PublicIP: "ip1",
|
||||||
PrivateIP: "ip2",
|
PrivateIP: "ip2",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
AzureCoordinators: azure.Instances{
|
AzureCoordinators: cloudtypes.Instances{
|
||||||
"0": {
|
"0": {
|
||||||
PublicIP: "ip3",
|
PublicIP: "ip3",
|
||||||
PrivateIP: "ip4",
|
PrivateIP: "ip4",
|
||||||
@ -224,13 +224,13 @@ func TestSetGetState(t *testing.T) {
|
|||||||
"missing tenant": {
|
"missing tenant": {
|
||||||
state: state.ConstellationState{
|
state: state.ConstellationState{
|
||||||
CloudProvider: cloudprovider.Azure.String(),
|
CloudProvider: cloudprovider.Azure.String(),
|
||||||
AzureNodes: azure.Instances{
|
AzureNodes: cloudtypes.Instances{
|
||||||
"0": {
|
"0": {
|
||||||
PublicIP: "ip1",
|
PublicIP: "ip1",
|
||||||
PrivateIP: "ip2",
|
PrivateIP: "ip2",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
AzureCoordinators: azure.Instances{
|
AzureCoordinators: cloudtypes.Instances{
|
||||||
"0": {
|
"0": {
|
||||||
PublicIP: "ip3",
|
PublicIP: "ip3",
|
||||||
PrivateIP: "ip4",
|
PrivateIP: "ip4",
|
||||||
@ -251,13 +251,13 @@ func TestSetGetState(t *testing.T) {
|
|||||||
"missing subnet": {
|
"missing subnet": {
|
||||||
state: state.ConstellationState{
|
state: state.ConstellationState{
|
||||||
CloudProvider: cloudprovider.Azure.String(),
|
CloudProvider: cloudprovider.Azure.String(),
|
||||||
AzureNodes: azure.Instances{
|
AzureNodes: cloudtypes.Instances{
|
||||||
"0": {
|
"0": {
|
||||||
PublicIP: "ip1",
|
PublicIP: "ip1",
|
||||||
PrivateIP: "ip2",
|
PrivateIP: "ip2",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
AzureCoordinators: azure.Instances{
|
AzureCoordinators: cloudtypes.Instances{
|
||||||
"0": {
|
"0": {
|
||||||
PublicIP: "ip3",
|
PublicIP: "ip3",
|
||||||
PrivateIP: "ip4",
|
PrivateIP: "ip4",
|
||||||
@ -278,13 +278,13 @@ func TestSetGetState(t *testing.T) {
|
|||||||
"missing network security group": {
|
"missing network security group": {
|
||||||
state: state.ConstellationState{
|
state: state.ConstellationState{
|
||||||
CloudProvider: cloudprovider.Azure.String(),
|
CloudProvider: cloudprovider.Azure.String(),
|
||||||
AzureNodes: azure.Instances{
|
AzureNodes: cloudtypes.Instances{
|
||||||
"0": {
|
"0": {
|
||||||
PublicIP: "ip1",
|
PublicIP: "ip1",
|
||||||
PrivateIP: "ip2",
|
PrivateIP: "ip2",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
AzureCoordinators: azure.Instances{
|
AzureCoordinators: cloudtypes.Instances{
|
||||||
"0": {
|
"0": {
|
||||||
PublicIP: "ip3",
|
PublicIP: "ip3",
|
||||||
PrivateIP: "ip4",
|
PrivateIP: "ip4",
|
||||||
@ -305,13 +305,13 @@ func TestSetGetState(t *testing.T) {
|
|||||||
"missing node scale set": {
|
"missing node scale set": {
|
||||||
state: state.ConstellationState{
|
state: state.ConstellationState{
|
||||||
CloudProvider: cloudprovider.Azure.String(),
|
CloudProvider: cloudprovider.Azure.String(),
|
||||||
AzureNodes: azure.Instances{
|
AzureNodes: cloudtypes.Instances{
|
||||||
"0": {
|
"0": {
|
||||||
PublicIP: "ip1",
|
PublicIP: "ip1",
|
||||||
PrivateIP: "ip2",
|
PrivateIP: "ip2",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
AzureCoordinators: azure.Instances{
|
AzureCoordinators: cloudtypes.Instances{
|
||||||
"0": {
|
"0": {
|
||||||
PublicIP: "ip3",
|
PublicIP: "ip3",
|
||||||
PrivateIP: "ip4",
|
PrivateIP: "ip4",
|
||||||
@ -332,13 +332,13 @@ func TestSetGetState(t *testing.T) {
|
|||||||
"missing coordinator scale set": {
|
"missing coordinator scale set": {
|
||||||
state: state.ConstellationState{
|
state: state.ConstellationState{
|
||||||
CloudProvider: cloudprovider.Azure.String(),
|
CloudProvider: cloudprovider.Azure.String(),
|
||||||
AzureNodes: azure.Instances{
|
AzureNodes: cloudtypes.Instances{
|
||||||
"0": {
|
"0": {
|
||||||
PublicIP: "ip1",
|
PublicIP: "ip1",
|
||||||
PrivateIP: "ip2",
|
PrivateIP: "ip2",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
AzureCoordinators: azure.Instances{
|
AzureCoordinators: cloudtypes.Instances{
|
||||||
"0": {
|
"0": {
|
||||||
PublicIP: "ip3",
|
PublicIP: "ip3",
|
||||||
PrivateIP: "ip4",
|
PrivateIP: "ip4",
|
||||||
@ -422,13 +422,13 @@ func TestSetStateCloudProvider(t *testing.T) {
|
|||||||
|
|
||||||
client := Client{}
|
client := Client{}
|
||||||
stateMissingCloudProvider := state.ConstellationState{
|
stateMissingCloudProvider := state.ConstellationState{
|
||||||
AzureNodes: azure.Instances{
|
AzureNodes: cloudtypes.Instances{
|
||||||
"0": {
|
"0": {
|
||||||
PublicIP: "ip1",
|
PublicIP: "ip1",
|
||||||
PrivateIP: "ip2",
|
PrivateIP: "ip2",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
AzureCoordinators: azure.Instances{
|
AzureCoordinators: cloudtypes.Instances{
|
||||||
"0": {
|
"0": {
|
||||||
PublicIP: "ip3",
|
PublicIP: "ip3",
|
||||||
PrivateIP: "ip4",
|
PrivateIP: "ip4",
|
||||||
@ -447,13 +447,13 @@ func TestSetStateCloudProvider(t *testing.T) {
|
|||||||
assert.Error(client.SetState(stateMissingCloudProvider))
|
assert.Error(client.SetState(stateMissingCloudProvider))
|
||||||
stateIncorrectCloudProvider := state.ConstellationState{
|
stateIncorrectCloudProvider := state.ConstellationState{
|
||||||
CloudProvider: "incorrect",
|
CloudProvider: "incorrect",
|
||||||
AzureNodes: azure.Instances{
|
AzureNodes: cloudtypes.Instances{
|
||||||
"0": {
|
"0": {
|
||||||
PublicIP: "ip1",
|
PublicIP: "ip1",
|
||||||
PrivateIP: "ip2",
|
PrivateIP: "ip2",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
AzureCoordinators: azure.Instances{
|
AzureCoordinators: cloudtypes.Instances{
|
||||||
"0": {
|
"0": {
|
||||||
PublicIP: "ip3",
|
PublicIP: "ip3",
|
||||||
PrivateIP: "ip4",
|
PrivateIP: "ip4",
|
||||||
|
@ -8,6 +8,7 @@ import (
|
|||||||
|
|
||||||
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources"
|
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources"
|
||||||
"github.com/edgelesssys/constellation/cli/azure"
|
"github.com/edgelesssys/constellation/cli/azure"
|
||||||
|
"github.com/edgelesssys/constellation/cli/cloud/cloudtypes"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (c *Client) CreateInstances(ctx context.Context, input CreateInstancesInput) error {
|
func (c *Client) CreateInstances(ctx context.Context, input CreateInstancesInput) error {
|
||||||
@ -127,45 +128,45 @@ func (c *Client) CreateInstancesVMs(ctx context.Context, input CreateInstancesIn
|
|||||||
// createInstanceVM creates a single VM with a public IP address
|
// createInstanceVM creates a single VM with a public IP address
|
||||||
// and a network interface.
|
// and a network interface.
|
||||||
// TODO: deprecate as soon as scale sets are available.
|
// TODO: deprecate as soon as scale sets are available.
|
||||||
func (c *Client) createInstanceVM(ctx context.Context, input azure.VMInstance) (azure.Instance, error) {
|
func (c *Client) createInstanceVM(ctx context.Context, input azure.VMInstance) (cloudtypes.Instance, error) {
|
||||||
pubIPName := input.Name + "-pubIP"
|
pubIPName := input.Name + "-pubIP"
|
||||||
pubIP, err := c.createPublicIPAddress(ctx, pubIPName)
|
pubIP, err := c.createPublicIPAddress(ctx, pubIPName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return azure.Instance{}, err
|
return cloudtypes.Instance{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
nicName := input.Name + "-NIC"
|
nicName := input.Name + "-NIC"
|
||||||
privIP, nicID, err := c.createNIC(ctx, nicName, *pubIP.ID)
|
privIP, nicID, err := c.createNIC(ctx, nicName, *pubIP.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return azure.Instance{}, err
|
return cloudtypes.Instance{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
input.NIC = nicID
|
input.NIC = nicID
|
||||||
|
|
||||||
poller, err := c.virtualMachinesAPI.BeginCreateOrUpdate(ctx, c.resourceGroup, input.Name, input.Azure(), nil)
|
poller, err := c.virtualMachinesAPI.BeginCreateOrUpdate(ctx, c.resourceGroup, input.Name, input.Azure(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return azure.Instance{}, err
|
return cloudtypes.Instance{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
vm, err := poller.PollUntilDone(ctx, 30*time.Second)
|
vm, err := poller.PollUntilDone(ctx, 30*time.Second)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return azure.Instance{}, err
|
return cloudtypes.Instance{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if vm.Identity == nil || vm.Identity.PrincipalID == nil {
|
if vm.Identity == nil || vm.Identity.PrincipalID == nil {
|
||||||
return azure.Instance{}, errors.New("virtual machine was created without system managed identity")
|
return cloudtypes.Instance{}, errors.New("virtual machine was created without system managed identity")
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := c.assignResourceGroupRole(ctx, *vm.Identity.PrincipalID, virtualMachineContributorRoleDefinitionID); err != nil {
|
if err := c.assignResourceGroupRole(ctx, *vm.Identity.PrincipalID, virtualMachineContributorRoleDefinitionID); err != nil {
|
||||||
return azure.Instance{}, err
|
return cloudtypes.Instance{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
res, err := c.publicIPAddressesAPI.Get(ctx, c.resourceGroup, pubIPName, nil)
|
res, err := c.publicIPAddressesAPI.Get(ctx, c.resourceGroup, pubIPName, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return azure.Instance{}, err
|
return cloudtypes.Instance{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return azure.Instance{PublicIP: *res.PublicIPAddressesClientGetResult.PublicIPAddress.Properties.IPAddress, PrivateIP: privIP}, nil
|
return cloudtypes.Instance{PublicIP: *res.PublicIPAddressesClientGetResult.PublicIPAddress.Properties.IPAddress, PrivateIP: privIP}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) createScaleSet(ctx context.Context, input CreateScaleSetInput) error {
|
func (c *Client) createScaleSet(ctx context.Context, input CreateScaleSetInput) error {
|
||||||
@ -212,8 +213,8 @@ func (c *Client) createScaleSet(ctx context.Context, input CreateScaleSetInput)
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) getInstanceIPs(ctx context.Context, scaleSet string, count int) (azure.Instances, error) {
|
func (c *Client) getInstanceIPs(ctx context.Context, scaleSet string, count int) (cloudtypes.Instances, error) {
|
||||||
instances := azure.Instances{}
|
instances := cloudtypes.Instances{}
|
||||||
for i := 0; i < count; i++ {
|
for i := 0; i < count; i++ {
|
||||||
// get public ip address
|
// get public ip address
|
||||||
var publicIPAddress string
|
var publicIPAddress string
|
||||||
@ -245,7 +246,7 @@ func (c *Client) getInstanceIPs(ctx context.Context, scaleSet string, count int)
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
instance := azure.Instance{
|
instance := cloudtypes.Instance{
|
||||||
PrivateIP: privateIPAddress,
|
PrivateIP: privateIPAddress,
|
||||||
PublicIP: publicIPAddress,
|
PublicIP: publicIPAddress,
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ import (
|
|||||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
|
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
|
||||||
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute"
|
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute"
|
||||||
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources"
|
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources"
|
||||||
"github.com/edgelesssys/constellation/cli/azure"
|
"github.com/edgelesssys/constellation/cli/cloud/cloudtypes"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
@ -38,8 +38,8 @@ func TestCreateResourceGroup(t *testing.T) {
|
|||||||
name: "name",
|
name: "name",
|
||||||
uid: "uid",
|
uid: "uid",
|
||||||
resourceGroupAPI: tc.resourceGroupAPI,
|
resourceGroupAPI: tc.resourceGroupAPI,
|
||||||
nodes: make(azure.Instances),
|
nodes: make(cloudtypes.Instances),
|
||||||
coordinators: make(azure.Instances),
|
coordinators: make(cloudtypes.Instances),
|
||||||
}
|
}
|
||||||
|
|
||||||
if tc.wantErr {
|
if tc.wantErr {
|
||||||
@ -62,12 +62,12 @@ func TestTerminateResourceGroup(t *testing.T) {
|
|||||||
subnetID: "subnet",
|
subnetID: "subnet",
|
||||||
nodesScaleSet: "node-scale-set",
|
nodesScaleSet: "node-scale-set",
|
||||||
coordinatorsScaleSet: "coordinator-scale-set",
|
coordinatorsScaleSet: "coordinator-scale-set",
|
||||||
nodes: azure.Instances{
|
nodes: cloudtypes.Instances{
|
||||||
"0": {
|
"0": {
|
||||||
PublicIP: "192.0.2.1", PrivateIP: "192.0.2.1",
|
PublicIP: "192.0.2.1", PrivateIP: "192.0.2.1",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
coordinators: azure.Instances{
|
coordinators: cloudtypes.Instances{
|
||||||
"0": {
|
"0": {
|
||||||
PublicIP: "192.0.2.1", PrivateIP: "192.0.2.1",
|
PublicIP: "192.0.2.1", PrivateIP: "192.0.2.1",
|
||||||
},
|
},
|
||||||
@ -214,8 +214,8 @@ func TestCreateInstances(t *testing.T) {
|
|||||||
scaleSetsAPI: tc.scaleSetsAPI,
|
scaleSetsAPI: tc.scaleSetsAPI,
|
||||||
resourceGroupAPI: tc.resourceGroupAPI,
|
resourceGroupAPI: tc.resourceGroupAPI,
|
||||||
roleAssignmentsAPI: tc.roleAssignmentsAPI,
|
roleAssignmentsAPI: tc.roleAssignmentsAPI,
|
||||||
nodes: make(azure.Instances),
|
nodes: make(cloudtypes.Instances),
|
||||||
coordinators: make(azure.Instances),
|
coordinators: make(cloudtypes.Instances),
|
||||||
loadBalancerPubIP: "lbip",
|
loadBalancerPubIP: "lbip",
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -355,8 +355,8 @@ func TestCreateInstancesVMs(t *testing.T) {
|
|||||||
virtualMachinesAPI: tc.virtualMachinesAPI,
|
virtualMachinesAPI: tc.virtualMachinesAPI,
|
||||||
resourceGroupAPI: tc.resourceGroupAPI,
|
resourceGroupAPI: tc.resourceGroupAPI,
|
||||||
roleAssignmentsAPI: tc.roleAssignmentsAPI,
|
roleAssignmentsAPI: tc.roleAssignmentsAPI,
|
||||||
nodes: make(azure.Instances),
|
nodes: make(cloudtypes.Instances),
|
||||||
coordinators: make(azure.Instances),
|
coordinators: make(cloudtypes.Instances),
|
||||||
}
|
}
|
||||||
|
|
||||||
if tc.wantErr {
|
if tc.wantErr {
|
||||||
|
@ -5,7 +5,6 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/edgelesssys/constellation/cli/azure"
|
|
||||||
"github.com/edgelesssys/constellation/cli/cloud/cloudtypes"
|
"github.com/edgelesssys/constellation/cli/cloud/cloudtypes"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
@ -40,8 +39,8 @@ func TestCreateVirtualNetwork(t *testing.T) {
|
|||||||
name: "name",
|
name: "name",
|
||||||
uid: "uid",
|
uid: "uid",
|
||||||
networksAPI: tc.networksAPI,
|
networksAPI: tc.networksAPI,
|
||||||
nodes: make(azure.Instances),
|
nodes: make(cloudtypes.Instances),
|
||||||
coordinators: make(azure.Instances),
|
coordinators: make(cloudtypes.Instances),
|
||||||
}
|
}
|
||||||
|
|
||||||
if tc.wantErr {
|
if tc.wantErr {
|
||||||
@ -103,8 +102,8 @@ func TestCreateSecurityGroup(t *testing.T) {
|
|||||||
location: "location",
|
location: "location",
|
||||||
name: "name",
|
name: "name",
|
||||||
uid: "uid",
|
uid: "uid",
|
||||||
nodes: make(azure.Instances),
|
nodes: make(cloudtypes.Instances),
|
||||||
coordinators: make(azure.Instances),
|
coordinators: make(cloudtypes.Instances),
|
||||||
networkSecurityGroupsAPI: tc.networkSecurityGroupsAPI,
|
networkSecurityGroupsAPI: tc.networkSecurityGroupsAPI,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,8 +152,8 @@ func TestCreateNIC(t *testing.T) {
|
|||||||
location: "location",
|
location: "location",
|
||||||
name: "name",
|
name: "name",
|
||||||
uid: "uid",
|
uid: "uid",
|
||||||
nodes: make(azure.Instances),
|
nodes: make(cloudtypes.Instances),
|
||||||
coordinators: make(azure.Instances),
|
coordinators: make(cloudtypes.Instances),
|
||||||
networkInterfacesAPI: tc.networkInterfacesAPI,
|
networkInterfacesAPI: tc.networkInterfacesAPI,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,8 +201,8 @@ func TestCreatePublicIPAddress(t *testing.T) {
|
|||||||
location: "location",
|
location: "location",
|
||||||
name: "name",
|
name: "name",
|
||||||
uid: "uid",
|
uid: "uid",
|
||||||
nodes: make(azure.Instances),
|
nodes: make(cloudtypes.Instances),
|
||||||
coordinators: make(azure.Instances),
|
coordinators: make(cloudtypes.Instances),
|
||||||
publicIPAddressesAPI: tc.publicIPAddressesAPI,
|
publicIPAddressesAPI: tc.publicIPAddressesAPI,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -257,8 +256,8 @@ func TestCreateExternalLoadBalancer(t *testing.T) {
|
|||||||
location: "location",
|
location: "location",
|
||||||
name: "name",
|
name: "name",
|
||||||
uid: "uid",
|
uid: "uid",
|
||||||
nodes: make(azure.Instances),
|
nodes: make(cloudtypes.Instances),
|
||||||
coordinators: make(azure.Instances),
|
coordinators: make(cloudtypes.Instances),
|
||||||
loadBalancersAPI: tc.loadBalancersAPI,
|
loadBalancersAPI: tc.loadBalancersAPI,
|
||||||
publicIPAddressesAPI: tc.publicIPAddressesAPI,
|
publicIPAddressesAPI: tc.publicIPAddressesAPI,
|
||||||
}
|
}
|
||||||
|
@ -5,67 +5,10 @@ package azure
|
|||||||
// TODO(katexochen): refactor into mulitcloud package.
|
// TODO(katexochen): refactor into mulitcloud package.
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
|
|
||||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
|
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
|
||||||
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute"
|
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Instance is a azure instance.
|
|
||||||
type Instance struct {
|
|
||||||
PublicIP string
|
|
||||||
PrivateIP string
|
|
||||||
}
|
|
||||||
|
|
||||||
// Instances is a map of azure Instances. The ID of an instance is used as key.
|
|
||||||
type Instances map[string]Instance
|
|
||||||
|
|
||||||
// IDs returns the IDs of all instances of the Constellation.
|
|
||||||
func (i Instances) IDs() []string {
|
|
||||||
var ids []string
|
|
||||||
for id := range i {
|
|
||||||
ids = append(ids, id)
|
|
||||||
}
|
|
||||||
return ids
|
|
||||||
}
|
|
||||||
|
|
||||||
// PublicIPs returns the public IPs of all the instances of the Constellation.
|
|
||||||
func (i Instances) PublicIPs() []string {
|
|
||||||
var ips []string
|
|
||||||
for _, instance := range i {
|
|
||||||
ips = append(ips, instance.PublicIP)
|
|
||||||
}
|
|
||||||
return ips
|
|
||||||
}
|
|
||||||
|
|
||||||
// PrivateIPs returns the private IPs of all the instances of the Constellation.
|
|
||||||
func (i Instances) PrivateIPs() []string {
|
|
||||||
var ips []string
|
|
||||||
for _, instance := range i {
|
|
||||||
ips = append(ips, instance.PrivateIP)
|
|
||||||
}
|
|
||||||
return ips
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetOne return anyone instance out of the instances and its ID.
|
|
||||||
func (i Instances) GetOne() (string, Instance, error) {
|
|
||||||
for id, instance := range i {
|
|
||||||
return id, instance, nil
|
|
||||||
}
|
|
||||||
return "", Instance{}, errors.New("map is empty")
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetOthers returns all instances but the one with the handed ID.
|
|
||||||
func (i Instances) GetOthers(id string) Instances {
|
|
||||||
others := make(Instances)
|
|
||||||
for key, instance := range i {
|
|
||||||
if key != id {
|
|
||||||
others[key] = instance
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return others
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: deprecate as soon as scale sets are available.
|
// TODO: deprecate as soon as scale sets are available.
|
||||||
type VMInstance struct {
|
type VMInstance struct {
|
||||||
Name string
|
Name string
|
||||||
|
@ -1,71 +0,0 @@
|
|||||||
package azure
|
|
||||||
|
|
||||||
import (
|
|
||||||
"testing"
|
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestIDs(t *testing.T) {
|
|
||||||
assert := assert.New(t)
|
|
||||||
testState := testInstances()
|
|
||||||
wantIDs := []string{"id-9", "id-10", "id-11", "id-12"}
|
|
||||||
assert.ElementsMatch(wantIDs, testState.IDs())
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestPublicIPs(t *testing.T) {
|
|
||||||
assert := assert.New(t)
|
|
||||||
testState := testInstances()
|
|
||||||
wantIPs := []string{"192.0.2.1", "192.0.2.3", "192.0.2.5", "192.0.2.7"}
|
|
||||||
assert.ElementsMatch(wantIPs, testState.PublicIPs())
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestPrivateIPs(t *testing.T) {
|
|
||||||
assert := assert.New(t)
|
|
||||||
testState := testInstances()
|
|
||||||
wantIPs := []string{"192.0.2.2", "192.0.2.4", "192.0.2.6", "192.0.2.8"}
|
|
||||||
assert.ElementsMatch(wantIPs, testState.PrivateIPs())
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestGetOne(t *testing.T) {
|
|
||||||
assert := assert.New(t)
|
|
||||||
testState := testInstances()
|
|
||||||
id, instance, err := testState.GetOne()
|
|
||||||
assert.NoError(err)
|
|
||||||
assert.Contains(testState, id)
|
|
||||||
assert.Equal(testState[id], instance)
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestGetOthers(t *testing.T) {
|
|
||||||
assert := assert.New(t)
|
|
||||||
testCases := testInstances().IDs()
|
|
||||||
|
|
||||||
for _, id := range testCases {
|
|
||||||
others := testInstances().GetOthers(id)
|
|
||||||
assert.NotContains(others, id)
|
|
||||||
wantInstances := testInstances()
|
|
||||||
delete(wantInstances, id)
|
|
||||||
assert.ElementsMatch(others.IDs(), wantInstances.IDs())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func testInstances() Instances {
|
|
||||||
return Instances{
|
|
||||||
"id-9": {
|
|
||||||
PublicIP: "192.0.2.1",
|
|
||||||
PrivateIP: "192.0.2.2",
|
|
||||||
},
|
|
||||||
"id-10": {
|
|
||||||
PublicIP: "192.0.2.3",
|
|
||||||
PrivateIP: "192.0.2.4",
|
|
||||||
},
|
|
||||||
"id-11": {
|
|
||||||
PublicIP: "192.0.2.5",
|
|
||||||
PrivateIP: "192.0.2.6",
|
|
||||||
},
|
|
||||||
"id-12": {
|
|
||||||
PublicIP: "192.0.2.7",
|
|
||||||
PrivateIP: "192.0.2.8",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
@ -5,7 +5,6 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/edgelesssys/constellation/cli/azure"
|
|
||||||
azurecl "github.com/edgelesssys/constellation/cli/azure/client"
|
azurecl "github.com/edgelesssys/constellation/cli/azure/client"
|
||||||
"github.com/edgelesssys/constellation/cli/cloud/cloudtypes"
|
"github.com/edgelesssys/constellation/cli/cloud/cloudtypes"
|
||||||
gcpcl "github.com/edgelesssys/constellation/cli/gcp/client"
|
gcpcl "github.com/edgelesssys/constellation/cli/gcp/client"
|
||||||
@ -14,8 +13,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type fakeAzureClient struct {
|
type fakeAzureClient struct {
|
||||||
nodes azure.Instances
|
nodes cloudtypes.Instances
|
||||||
coordinators azure.Instances
|
coordinators cloudtypes.Instances
|
||||||
|
|
||||||
resourceGroup string
|
resourceGroup string
|
||||||
name string
|
name string
|
||||||
@ -91,30 +90,30 @@ func (c *fakeAzureClient) CreateSecurityGroup(ctx context.Context, input azurecl
|
|||||||
func (c *fakeAzureClient) CreateInstances(ctx context.Context, input azurecl.CreateInstancesInput) error {
|
func (c *fakeAzureClient) CreateInstances(ctx context.Context, input azurecl.CreateInstancesInput) error {
|
||||||
c.coordinatorsScaleSet = "coordinators-scale-set"
|
c.coordinatorsScaleSet = "coordinators-scale-set"
|
||||||
c.nodesScaleSet = "nodes-scale-set"
|
c.nodesScaleSet = "nodes-scale-set"
|
||||||
c.nodes = make(azure.Instances)
|
c.nodes = make(cloudtypes.Instances)
|
||||||
for i := 0; i < input.CountNodes; i++ {
|
for i := 0; i < input.CountNodes; i++ {
|
||||||
id := "id-" + strconv.Itoa(i)
|
id := "id-" + strconv.Itoa(i)
|
||||||
c.nodes[id] = azure.Instance{PublicIP: "192.0.2.1", PrivateIP: "192.0.2.1"}
|
c.nodes[id] = cloudtypes.Instance{PublicIP: "192.0.2.1", PrivateIP: "192.0.2.1"}
|
||||||
}
|
}
|
||||||
c.coordinators = make(azure.Instances)
|
c.coordinators = make(cloudtypes.Instances)
|
||||||
for i := 0; i < input.CountCoordinators; i++ {
|
for i := 0; i < input.CountCoordinators; i++ {
|
||||||
id := "id-" + strconv.Itoa(i)
|
id := "id-" + strconv.Itoa(i)
|
||||||
c.coordinators[id] = azure.Instance{PublicIP: "192.0.2.1", PrivateIP: "192.0.2.1"}
|
c.coordinators[id] = cloudtypes.Instance{PublicIP: "192.0.2.1", PrivateIP: "192.0.2.1"}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: deprecate as soon as scale sets are available.
|
// TODO: deprecate as soon as scale sets are available.
|
||||||
func (c *fakeAzureClient) CreateInstancesVMs(ctx context.Context, input azurecl.CreateInstancesInput) error {
|
func (c *fakeAzureClient) CreateInstancesVMs(ctx context.Context, input azurecl.CreateInstancesInput) error {
|
||||||
c.nodes = make(azure.Instances)
|
c.nodes = make(cloudtypes.Instances)
|
||||||
for i := 0; i < input.CountNodes; i++ {
|
for i := 0; i < input.CountNodes; i++ {
|
||||||
id := "id-" + strconv.Itoa(i)
|
id := "id-" + strconv.Itoa(i)
|
||||||
c.nodes[id] = azure.Instance{PublicIP: "192.0.2.1", PrivateIP: "192.0.2.1"}
|
c.nodes[id] = cloudtypes.Instance{PublicIP: "192.0.2.1", PrivateIP: "192.0.2.1"}
|
||||||
}
|
}
|
||||||
c.coordinators = make(azure.Instances)
|
c.coordinators = make(cloudtypes.Instances)
|
||||||
for i := 0; i < input.CountCoordinators; i++ {
|
for i := 0; i < input.CountCoordinators; i++ {
|
||||||
id := "id-" + strconv.Itoa(i)
|
id := "id-" + strconv.Itoa(i)
|
||||||
c.coordinators[id] = azure.Instance{PublicIP: "192.0.2.1", PrivateIP: "192.0.2.1"}
|
c.coordinators[id] = cloudtypes.Instance{PublicIP: "192.0.2.1", PrivateIP: "192.0.2.1"}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,6 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/edgelesssys/constellation/cli/azure"
|
|
||||||
"github.com/edgelesssys/constellation/cli/cloud/cloudtypes"
|
"github.com/edgelesssys/constellation/cli/cloud/cloudtypes"
|
||||||
"github.com/edgelesssys/constellation/internal/cloud/cloudprovider"
|
"github.com/edgelesssys/constellation/internal/cloud/cloudprovider"
|
||||||
"github.com/edgelesssys/constellation/internal/config"
|
"github.com/edgelesssys/constellation/internal/config"
|
||||||
@ -42,11 +41,11 @@ func TestCreator(t *testing.T) {
|
|||||||
|
|
||||||
wantAzureState := state.ConstellationState{
|
wantAzureState := state.ConstellationState{
|
||||||
CloudProvider: cloudprovider.Azure.String(),
|
CloudProvider: cloudprovider.Azure.String(),
|
||||||
AzureCoordinators: azure.Instances{
|
AzureCoordinators: cloudtypes.Instances{
|
||||||
"id-0": {PrivateIP: "192.0.2.1", PublicIP: "192.0.2.1"},
|
"id-0": {PrivateIP: "192.0.2.1", PublicIP: "192.0.2.1"},
|
||||||
"id-1": {PrivateIP: "192.0.2.1", PublicIP: "192.0.2.1"},
|
"id-1": {PrivateIP: "192.0.2.1", PublicIP: "192.0.2.1"},
|
||||||
},
|
},
|
||||||
AzureNodes: azure.Instances{
|
AzureNodes: cloudtypes.Instances{
|
||||||
"id-0": {PrivateIP: "192.0.2.1", PublicIP: "192.0.2.1"},
|
"id-0": {PrivateIP: "192.0.2.1", PublicIP: "192.0.2.1"},
|
||||||
"id-1": {PrivateIP: "192.0.2.1", PublicIP: "192.0.2.1"},
|
"id-1": {PrivateIP: "192.0.2.1", PublicIP: "192.0.2.1"},
|
||||||
"id-2": {PrivateIP: "192.0.2.1", PublicIP: "192.0.2.1"},
|
"id-2": {PrivateIP: "192.0.2.1", PublicIP: "192.0.2.1"},
|
||||||
|
@ -5,7 +5,6 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/edgelesssys/constellation/cli/azure"
|
|
||||||
"github.com/edgelesssys/constellation/cli/cloud/cloudtypes"
|
"github.com/edgelesssys/constellation/cli/cloud/cloudtypes"
|
||||||
"github.com/edgelesssys/constellation/internal/cloud/cloudprovider"
|
"github.com/edgelesssys/constellation/internal/cloud/cloudprovider"
|
||||||
"github.com/edgelesssys/constellation/internal/state"
|
"github.com/edgelesssys/constellation/internal/state"
|
||||||
@ -36,11 +35,11 @@ func TestTerminator(t *testing.T) {
|
|||||||
someAzureState := func() state.ConstellationState {
|
someAzureState := func() state.ConstellationState {
|
||||||
return state.ConstellationState{
|
return state.ConstellationState{
|
||||||
CloudProvider: cloudprovider.Azure.String(),
|
CloudProvider: cloudprovider.Azure.String(),
|
||||||
AzureNodes: azure.Instances{
|
AzureNodes: cloudtypes.Instances{
|
||||||
"id-0": {PrivateIP: "192.0.2.1", PublicIP: "192.0.2.1"},
|
"id-0": {PrivateIP: "192.0.2.1", PublicIP: "192.0.2.1"},
|
||||||
"id-1": {PrivateIP: "192.0.2.1", PublicIP: "192.0.2.1"},
|
"id-1": {PrivateIP: "192.0.2.1", PublicIP: "192.0.2.1"},
|
||||||
},
|
},
|
||||||
AzureCoordinators: azure.Instances{
|
AzureCoordinators: cloudtypes.Instances{
|
||||||
"id-c": {PrivateIP: "192.0.2.1", PublicIP: "192.0.2.1"},
|
"id-c": {PrivateIP: "192.0.2.1", PublicIP: "192.0.2.1"},
|
||||||
},
|
},
|
||||||
AzureResourceGroup: "group",
|
AzureResourceGroup: "group",
|
||||||
|
@ -10,7 +10,6 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/edgelesssys/constellation/cli/azure"
|
|
||||||
"github.com/edgelesssys/constellation/cli/cloud/cloudtypes"
|
"github.com/edgelesssys/constellation/cli/cloud/cloudtypes"
|
||||||
"github.com/edgelesssys/constellation/cli/ec2"
|
"github.com/edgelesssys/constellation/cli/ec2"
|
||||||
"github.com/edgelesssys/constellation/internal/constants"
|
"github.com/edgelesssys/constellation/internal/constants"
|
||||||
@ -46,11 +45,11 @@ func TestInitialize(t *testing.T) {
|
|||||||
}
|
}
|
||||||
testAzureState := state.ConstellationState{
|
testAzureState := state.ConstellationState{
|
||||||
CloudProvider: "Azure",
|
CloudProvider: "Azure",
|
||||||
AzureNodes: azure.Instances{
|
AzureNodes: cloudtypes.Instances{
|
||||||
"id-0": {PrivateIP: "192.0.2.1", PublicIP: "192.0.2.1"},
|
"id-0": {PrivateIP: "192.0.2.1", PublicIP: "192.0.2.1"},
|
||||||
"id-1": {PrivateIP: "192.0.2.1", PublicIP: "192.0.2.1"},
|
"id-1": {PrivateIP: "192.0.2.1", PublicIP: "192.0.2.1"},
|
||||||
},
|
},
|
||||||
AzureCoordinators: azure.Instances{
|
AzureCoordinators: cloudtypes.Instances{
|
||||||
"id-c": {PrivateIP: "192.0.2.1", PublicIP: "192.0.2.1"},
|
"id-c": {PrivateIP: "192.0.2.1", PublicIP: "192.0.2.1"},
|
||||||
},
|
},
|
||||||
AzureResourceGroup: "test",
|
AzureResourceGroup: "test",
|
||||||
@ -524,11 +523,11 @@ func TestAutoscaleFlag(t *testing.T) {
|
|||||||
}
|
}
|
||||||
testAzureState := state.ConstellationState{
|
testAzureState := state.ConstellationState{
|
||||||
CloudProvider: "azure",
|
CloudProvider: "azure",
|
||||||
AzureNodes: azure.Instances{
|
AzureNodes: cloudtypes.Instances{
|
||||||
"id-0": {PrivateIP: "192.0.2.1", PublicIP: "192.0.2.1"},
|
"id-0": {PrivateIP: "192.0.2.1", PublicIP: "192.0.2.1"},
|
||||||
"id-1": {PrivateIP: "192.0.2.1", PublicIP: "192.0.2.1"},
|
"id-1": {PrivateIP: "192.0.2.1", PublicIP: "192.0.2.1"},
|
||||||
},
|
},
|
||||||
AzureCoordinators: azure.Instances{
|
AzureCoordinators: cloudtypes.Instances{
|
||||||
"id-c": {PrivateIP: "192.0.2.1", PublicIP: "192.0.2.1"},
|
"id-c": {PrivateIP: "192.0.2.1", PublicIP: "192.0.2.1"},
|
||||||
},
|
},
|
||||||
AzureResourceGroup: "test",
|
AzureResourceGroup: "test",
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package state
|
package state
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/edgelesssys/constellation/cli/azure"
|
|
||||||
"github.com/edgelesssys/constellation/cli/cloud/cloudtypes"
|
"github.com/edgelesssys/constellation/cli/cloud/cloudtypes"
|
||||||
"github.com/edgelesssys/constellation/cli/ec2"
|
"github.com/edgelesssys/constellation/cli/ec2"
|
||||||
)
|
)
|
||||||
@ -29,17 +28,17 @@ type ConstellationState struct {
|
|||||||
GCPRegion string `json:"gcpregion,omitempty"`
|
GCPRegion string `json:"gcpregion,omitempty"`
|
||||||
GCPServiceAccount string `json:"gcpserviceaccount,omitempty"`
|
GCPServiceAccount string `json:"gcpserviceaccount,omitempty"`
|
||||||
|
|
||||||
AzureNodes azure.Instances `json:"azurenodes,omitempty"`
|
AzureNodes cloudtypes.Instances `json:"azurenodes,omitempty"`
|
||||||
AzureCoordinators azure.Instances `json:"azurecoordinators,omitempty"`
|
AzureCoordinators cloudtypes.Instances `json:"azurecoordinators,omitempty"`
|
||||||
AzureResourceGroup string `json:"azureresourcegroup,omitempty"`
|
AzureResourceGroup string `json:"azureresourcegroup,omitempty"`
|
||||||
AzureLocation string `json:"azurelocation,omitempty"`
|
AzureLocation string `json:"azurelocation,omitempty"`
|
||||||
AzureSubscription string `json:"azuresubscription,omitempty"`
|
AzureSubscription string `json:"azuresubscription,omitempty"`
|
||||||
AzureTenant string `json:"azuretenant,omitempty"`
|
AzureTenant string `json:"azuretenant,omitempty"`
|
||||||
AzureSubnet string `json:"azuresubnet,omitempty"`
|
AzureSubnet string `json:"azuresubnet,omitempty"`
|
||||||
AzureNetworkSecurityGroup string `json:"azurenetworksecuritygroup,omitempty"`
|
AzureNetworkSecurityGroup string `json:"azurenetworksecuritygroup,omitempty"`
|
||||||
AzureNodesScaleSet string `json:"azurenodesscaleset,omitempty"`
|
AzureNodesScaleSet string `json:"azurenodesscaleset,omitempty"`
|
||||||
AzureCoordinatorsScaleSet string `json:"azurecoordinatorsscaleset,omitempty"`
|
AzureCoordinatorsScaleSet string `json:"azurecoordinatorsscaleset,omitempty"`
|
||||||
AzureADAppObjectID string `json:"azureadappobjectid,omitempty"`
|
AzureADAppObjectID string `json:"azureadappobjectid,omitempty"`
|
||||||
|
|
||||||
QEMUNodes cloudtypes.Instances `json:"qemunodes,omitempty"`
|
QEMUNodes cloudtypes.Instances `json:"qemunodes,omitempty"`
|
||||||
QEMUCoordinators cloudtypes.Instances `json:"qemucoordinators,omitempty"`
|
QEMUCoordinators cloudtypes.Instances `json:"qemucoordinators,omitempty"`
|
||||||
|
Loading…
Reference in New Issue
Block a user