mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-08-02 20:16:15 -04:00
re-enable azure node groups in statefile and send azure scaleset as autoscaling group
This commit is contained in:
parent
71b5a0c6c0
commit
f04765dab5
5 changed files with 98 additions and 79 deletions
|
@ -165,15 +165,14 @@ func (c *Client) GetState() (state.ConstellationState, error) {
|
|||
return state.ConstellationState{}, errors.New("client has no network security group")
|
||||
}
|
||||
stat.AzureNetworkSecurityGroup = c.networkSecurityGroup
|
||||
// TODO: un-deprecate as soon as scale sets are available
|
||||
// if len(c.nodesScaleSet) == 0 {
|
||||
// return state.ConstellationState{}, errors.New("client has no nodes scale set")
|
||||
// }
|
||||
// stat.AzureNodesScaleSet = c.nodesScaleSet
|
||||
// if len(c.coordinatorsScaleSet) == 0 {
|
||||
// return state.ConstellationState{}, errors.New("client has no coordinators scale set")
|
||||
// }
|
||||
// stat.AzureCoordinatorsScaleSet = c.coordinatorsScaleSet
|
||||
if len(c.nodesScaleSet) == 0 {
|
||||
return state.ConstellationState{}, errors.New("client has no nodes scale set")
|
||||
}
|
||||
stat.AzureNodesScaleSet = c.nodesScaleSet
|
||||
if len(c.coordinatorsScaleSet) == 0 {
|
||||
return state.ConstellationState{}, errors.New("client has no coordinators scale set")
|
||||
}
|
||||
stat.AzureCoordinatorsScaleSet = c.coordinatorsScaleSet
|
||||
if len(c.nodes) == 0 {
|
||||
return state.ConstellationState{}, errors.New("client has no nodes")
|
||||
}
|
||||
|
@ -225,15 +224,14 @@ func (c *Client) SetState(stat state.ConstellationState) error {
|
|||
return errors.New("state has no subnet")
|
||||
}
|
||||
c.networkSecurityGroup = stat.AzureNetworkSecurityGroup
|
||||
// TODO: un-deprecate as soon as scale sets are available
|
||||
//if len(stat.AzureNodesScaleSet) == 0 {
|
||||
// return errors.New("state has no nodes scale set")
|
||||
//}
|
||||
//c.nodesScaleSet = stat.AzureNodesScaleSet
|
||||
//if len(stat.AzureCoordinatorsScaleSet) == 0 {
|
||||
// return errors.New("state has no nodes scale set")
|
||||
//}
|
||||
//c.coordinatorsScaleSet = stat.AzureCoordinatorsScaleSet
|
||||
if len(stat.AzureNodesScaleSet) == 0 {
|
||||
return errors.New("state has no nodes scale set")
|
||||
}
|
||||
c.nodesScaleSet = stat.AzureNodesScaleSet
|
||||
if len(stat.AzureCoordinatorsScaleSet) == 0 {
|
||||
return errors.New("state has no nodes scale set")
|
||||
}
|
||||
c.coordinatorsScaleSet = stat.AzureCoordinatorsScaleSet
|
||||
if len(stat.AzureNodes) == 0 {
|
||||
return errors.New("state has no coordinator scale set")
|
||||
}
|
||||
|
|
|
@ -38,9 +38,8 @@ func TestSetGetState(t *testing.T) {
|
|||
AzureTenant: "tenant",
|
||||
AzureSubnet: "azure-subnet",
|
||||
AzureNetworkSecurityGroup: "network-security-group",
|
||||
// TODO: un-deprecate as soon as scale sets are available
|
||||
// AzureNodesScaleSet: "node-scale-set",
|
||||
// AzureCoordinatorsScaleSet: "coordinator-scale-set",
|
||||
AzureNodesScaleSet: "node-scale-set",
|
||||
AzureCoordinatorsScaleSet: "coordinator-scale-set",
|
||||
},
|
||||
},
|
||||
"missing nodes": {
|
||||
|
@ -303,61 +302,60 @@ func TestSetGetState(t *testing.T) {
|
|||
},
|
||||
errExpected: true,
|
||||
},
|
||||
// TODO: un-deprecate as soon as scale sets are available
|
||||
// "missing node scale set": {
|
||||
// state: state.ConstellationState{
|
||||
// CloudProvider: cloudprovider.Azure.String(),
|
||||
// AzureNodes: azure.Instances{
|
||||
// "0": {
|
||||
// PublicIP: "ip1",
|
||||
// PrivateIP: "ip2",
|
||||
// },
|
||||
// },
|
||||
// AzureCoordinators: azure.Instances{
|
||||
// "0": {
|
||||
// PublicIP: "ip3",
|
||||
// PrivateIP: "ip4",
|
||||
// },
|
||||
// },
|
||||
// Name: "name",
|
||||
// UID: "uid",
|
||||
// AzureResourceGroup: "resource-group",
|
||||
// AzureLocation: "location",
|
||||
// AzureSubscription: "subscription",
|
||||
// AzureTenant: "tenant",
|
||||
// AzureSubnet: "azure-subnet",
|
||||
// AzureNetworkSecurityGroup: "network-security-group",
|
||||
// AzureCoordinatorsScaleSet: "coordinator-scale-set",
|
||||
// },
|
||||
// errExpected: true,
|
||||
// },
|
||||
// "missing coordinator scale set": {
|
||||
// state: state.ConstellationState{
|
||||
// CloudProvider: cloudprovider.Azure.String(),
|
||||
// AzureNodes: azure.Instances{
|
||||
// "0": {
|
||||
// PublicIP: "ip1",
|
||||
// PrivateIP: "ip2",
|
||||
// },
|
||||
// },
|
||||
// AzureCoordinators: azure.Instances{
|
||||
// "0": {
|
||||
// PublicIP: "ip3",
|
||||
// PrivateIP: "ip4",
|
||||
// },
|
||||
// },
|
||||
// Name: "name",
|
||||
// UID: "uid",
|
||||
// AzureResourceGroup: "resource-group",
|
||||
// AzureLocation: "location",
|
||||
// AzureSubscription: "subscription",
|
||||
// AzureTenant: "tenant",
|
||||
// AzureSubnet: "azure-subnet",
|
||||
// AzureNetworkSecurityGroup: "network-security-group",
|
||||
// AzureNodesScaleSet: "node-scale-set",
|
||||
// },
|
||||
// errExpected: true,
|
||||
// },
|
||||
"missing node scale set": {
|
||||
state: state.ConstellationState{
|
||||
CloudProvider: cloudprovider.Azure.String(),
|
||||
AzureNodes: azure.Instances{
|
||||
"0": {
|
||||
PublicIP: "ip1",
|
||||
PrivateIP: "ip2",
|
||||
},
|
||||
},
|
||||
AzureCoordinators: azure.Instances{
|
||||
"0": {
|
||||
PublicIP: "ip3",
|
||||
PrivateIP: "ip4",
|
||||
},
|
||||
},
|
||||
Name: "name",
|
||||
UID: "uid",
|
||||
AzureResourceGroup: "resource-group",
|
||||
AzureLocation: "location",
|
||||
AzureSubscription: "subscription",
|
||||
AzureTenant: "tenant",
|
||||
AzureSubnet: "azure-subnet",
|
||||
AzureNetworkSecurityGroup: "network-security-group",
|
||||
AzureCoordinatorsScaleSet: "coordinator-scale-set",
|
||||
},
|
||||
errExpected: true,
|
||||
},
|
||||
"missing coordinator scale set": {
|
||||
state: state.ConstellationState{
|
||||
CloudProvider: cloudprovider.Azure.String(),
|
||||
AzureNodes: azure.Instances{
|
||||
"0": {
|
||||
PublicIP: "ip1",
|
||||
PrivateIP: "ip2",
|
||||
},
|
||||
},
|
||||
AzureCoordinators: azure.Instances{
|
||||
"0": {
|
||||
PublicIP: "ip3",
|
||||
PrivateIP: "ip4",
|
||||
},
|
||||
},
|
||||
Name: "name",
|
||||
UID: "uid",
|
||||
AzureResourceGroup: "resource-group",
|
||||
AzureLocation: "location",
|
||||
AzureSubscription: "subscription",
|
||||
AzureTenant: "tenant",
|
||||
AzureSubnet: "azure-subnet",
|
||||
AzureNetworkSecurityGroup: "network-security-group",
|
||||
AzureNodesScaleSet: "node-scale-set",
|
||||
},
|
||||
errExpected: true,
|
||||
},
|
||||
}
|
||||
|
||||
t.Run("SetState", func(t *testing.T) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue