mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-05-02 22:34:56 -04:00
Rename coordinator to bootstrapper and rename roles
This commit is contained in:
parent
3280ed200c
commit
916e5d6b55
191 changed files with 1763 additions and 2030 deletions
|
@ -44,8 +44,8 @@ type Client struct {
|
|||
adReplicationLagCheckInterval time.Duration
|
||||
adReplicationLagCheckMaxRetries int
|
||||
|
||||
nodes cloudtypes.Instances
|
||||
coordinators cloudtypes.Instances
|
||||
workers cloudtypes.Instances
|
||||
controlPlanes cloudtypes.Instances
|
||||
|
||||
name string
|
||||
uid string
|
||||
|
@ -54,8 +54,8 @@ type Client struct {
|
|||
subscriptionID string
|
||||
tenantID string
|
||||
subnetID string
|
||||
coordinatorsScaleSet string
|
||||
nodesScaleSet string
|
||||
controlPlaneScaleSet string
|
||||
workerScaleSet string
|
||||
loadBalancerName string
|
||||
loadBalancerPubIP string
|
||||
networkSecurityGroup string
|
||||
|
@ -107,8 +107,8 @@ func NewFromDefault(subscriptionID, tenantID string) (*Client, error) {
|
|||
applicationInsightsAPI: applicationInsightsAPI,
|
||||
subscriptionID: subscriptionID,
|
||||
tenantID: tenantID,
|
||||
nodes: cloudtypes.Instances{},
|
||||
coordinators: cloudtypes.Instances{},
|
||||
workers: cloudtypes.Instances{},
|
||||
controlPlanes: cloudtypes.Instances{},
|
||||
adReplicationLagCheckInterval: adReplicationLagCheckInterval,
|
||||
adReplicationLagCheckMaxRetries: adReplicationLagCheckMaxRetries,
|
||||
}, nil
|
||||
|
@ -174,22 +174,22 @@ func (c *Client) GetState() (state.ConstellationState, error) {
|
|||
return state.ConstellationState{}, errors.New("client has no network security group")
|
||||
}
|
||||
stat.AzureNetworkSecurityGroup = c.networkSecurityGroup
|
||||
if len(c.nodesScaleSet) == 0 {
|
||||
return state.ConstellationState{}, errors.New("client has no nodes scale set")
|
||||
if len(c.workerScaleSet) == 0 {
|
||||
return state.ConstellationState{}, errors.New("client has no worker scale set")
|
||||
}
|
||||
stat.AzureNodesScaleSet = c.nodesScaleSet
|
||||
if len(c.coordinatorsScaleSet) == 0 {
|
||||
return state.ConstellationState{}, errors.New("client has no coordinators scale set")
|
||||
stat.AzureWorkersScaleSet = c.workerScaleSet
|
||||
if len(c.controlPlaneScaleSet) == 0 {
|
||||
return state.ConstellationState{}, errors.New("client has no control plane scale set")
|
||||
}
|
||||
stat.AzureCoordinatorsScaleSet = c.coordinatorsScaleSet
|
||||
if len(c.nodes) == 0 {
|
||||
return state.ConstellationState{}, errors.New("client has no nodes")
|
||||
stat.AzureControlPlanesScaleSet = c.controlPlaneScaleSet
|
||||
if len(c.workers) == 0 {
|
||||
return state.ConstellationState{}, errors.New("client has no workers")
|
||||
}
|
||||
stat.AzureNodes = c.nodes
|
||||
if len(c.coordinators) == 0 {
|
||||
return state.ConstellationState{}, errors.New("client has no coordinators")
|
||||
stat.AzureWorkers = c.workers
|
||||
if len(c.controlPlanes) == 0 {
|
||||
return state.ConstellationState{}, errors.New("client has no control planes")
|
||||
}
|
||||
stat.AzureCoordinators = c.coordinators
|
||||
stat.AzureControlPlane = c.controlPlanes
|
||||
// AD App Object ID does not have to be set at all times
|
||||
stat.AzureADAppObjectID = c.adAppObjectID
|
||||
|
||||
|
@ -233,22 +233,22 @@ func (c *Client) SetState(stat state.ConstellationState) error {
|
|||
return errors.New("state has no subnet")
|
||||
}
|
||||
c.networkSecurityGroup = stat.AzureNetworkSecurityGroup
|
||||
if len(stat.AzureNodesScaleSet) == 0 {
|
||||
return errors.New("state has no nodes scale set")
|
||||
if len(stat.AzureWorkersScaleSet) == 0 {
|
||||
return errors.New("state has no worker scale set")
|
||||
}
|
||||
c.nodesScaleSet = stat.AzureNodesScaleSet
|
||||
if len(stat.AzureCoordinatorsScaleSet) == 0 {
|
||||
return errors.New("state has no nodes scale set")
|
||||
c.workerScaleSet = stat.AzureWorkersScaleSet
|
||||
if len(stat.AzureControlPlanesScaleSet) == 0 {
|
||||
return errors.New("state has no worker scale set")
|
||||
}
|
||||
c.coordinatorsScaleSet = stat.AzureCoordinatorsScaleSet
|
||||
if len(stat.AzureNodes) == 0 {
|
||||
return errors.New("state has no nodes")
|
||||
c.controlPlaneScaleSet = stat.AzureControlPlanesScaleSet
|
||||
if len(stat.AzureWorkers) == 0 {
|
||||
return errors.New("state has no workers")
|
||||
}
|
||||
c.nodes = stat.AzureNodes
|
||||
if len(stat.AzureCoordinators) == 0 {
|
||||
return errors.New("state has no coordinators")
|
||||
c.workers = stat.AzureWorkers
|
||||
if len(stat.AzureControlPlane) == 0 {
|
||||
return errors.New("state has no control planes")
|
||||
}
|
||||
c.coordinators = stat.AzureCoordinators
|
||||
c.controlPlanes = stat.AzureControlPlane
|
||||
// AD App Object ID does not have to be set at all times
|
||||
c.adAppObjectID = stat.AzureADAppObjectID
|
||||
|
||||
|
|
|
@ -23,300 +23,327 @@ func TestSetGetState(t *testing.T) {
|
|||
"valid state": {
|
||||
state: state.ConstellationState{
|
||||
CloudProvider: cloudprovider.Azure.String(),
|
||||
AzureNodes: cloudtypes.Instances{
|
||||
AzureWorkers: cloudtypes.Instances{
|
||||
"0": {
|
||||
PublicIP: "ip1",
|
||||
PrivateIP: "ip2",
|
||||
},
|
||||
},
|
||||
AzureCoordinators: cloudtypes.Instances{
|
||||
AzureControlPlane: cloudtypes.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",
|
||||
AzureCoordinatorsScaleSet: "coordinator-scale-set",
|
||||
Name: "name",
|
||||
UID: "uid",
|
||||
AzureResourceGroup: "resource-group",
|
||||
AzureLocation: "location",
|
||||
AzureSubscription: "subscription",
|
||||
AzureTenant: "tenant",
|
||||
AzureSubnet: "azure-subnet",
|
||||
AzureNetworkSecurityGroup: "network-security-group",
|
||||
AzureWorkersScaleSet: "worker-scale-set",
|
||||
AzureControlPlanesScaleSet: "controlplane-scale-set",
|
||||
},
|
||||
},
|
||||
"missing nodes": {
|
||||
"missing workers": {
|
||||
state: state.ConstellationState{
|
||||
CloudProvider: cloudprovider.Azure.String(),
|
||||
AzureCoordinators: cloudtypes.Instances{
|
||||
AzureControlPlane: cloudtypes.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",
|
||||
AzureCoordinatorsScaleSet: "coordinator-scale-set",
|
||||
Name: "name",
|
||||
UID: "uid",
|
||||
AzureResourceGroup: "resource-group",
|
||||
AzureLocation: "location",
|
||||
AzureSubscription: "subscription",
|
||||
AzureTenant: "tenant",
|
||||
AzureSubnet: "azure-subnet",
|
||||
AzureNetworkSecurityGroup: "network-security-group",
|
||||
AzureWorkersScaleSet: "worker-scale-set",
|
||||
AzureControlPlanesScaleSet: "controlplane-scale-set",
|
||||
},
|
||||
wantErr: true,
|
||||
},
|
||||
"missing coordinator": {
|
||||
"missing controlplane": {
|
||||
state: state.ConstellationState{
|
||||
CloudProvider: cloudprovider.Azure.String(),
|
||||
AzureNodes: cloudtypes.Instances{
|
||||
AzureWorkers: cloudtypes.Instances{
|
||||
"0": {
|
||||
PublicIP: "ip1",
|
||||
PrivateIP: "ip2",
|
||||
},
|
||||
},
|
||||
Name: "name",
|
||||
UID: "uid",
|
||||
AzureResourceGroup: "resource-group",
|
||||
AzureLocation: "location",
|
||||
AzureSubscription: "subscription",
|
||||
AzureTenant: "tenant",
|
||||
AzureSubnet: "azure-subnet",
|
||||
AzureNetworkSecurityGroup: "network-security-group",
|
||||
AzureNodesScaleSet: "node-scale-set",
|
||||
AzureCoordinatorsScaleSet: "coordinator-scale-set",
|
||||
Name: "name",
|
||||
UID: "uid",
|
||||
AzureResourceGroup: "resource-group",
|
||||
AzureLocation: "location",
|
||||
AzureSubscription: "subscription",
|
||||
AzureTenant: "tenant",
|
||||
AzureSubnet: "azure-subnet",
|
||||
AzureNetworkSecurityGroup: "network-security-group",
|
||||
AzureWorkersScaleSet: "worker-scale-set",
|
||||
AzureControlPlanesScaleSet: "controlplane-scale-set",
|
||||
},
|
||||
wantErr: true,
|
||||
},
|
||||
"missing name": {
|
||||
state: state.ConstellationState{
|
||||
CloudProvider: cloudprovider.Azure.String(),
|
||||
AzureNodes: cloudtypes.Instances{
|
||||
AzureWorkers: cloudtypes.Instances{
|
||||
"0": {
|
||||
PublicIP: "ip1",
|
||||
PrivateIP: "ip2",
|
||||
},
|
||||
},
|
||||
AzureCoordinators: cloudtypes.Instances{
|
||||
AzureControlPlane: cloudtypes.Instances{
|
||||
"0": {
|
||||
PublicIP: "ip3",
|
||||
PrivateIP: "ip4",
|
||||
},
|
||||
},
|
||||
UID: "uid",
|
||||
AzureResourceGroup: "resource-group",
|
||||
AzureLocation: "location",
|
||||
AzureSubscription: "subscription",
|
||||
AzureTenant: "tenant",
|
||||
AzureSubnet: "azure-subnet",
|
||||
AzureNetworkSecurityGroup: "network-security-group",
|
||||
AzureNodesScaleSet: "node-scale-set",
|
||||
AzureCoordinatorsScaleSet: "coordinator-scale-set",
|
||||
UID: "uid",
|
||||
AzureResourceGroup: "resource-group",
|
||||
AzureLocation: "location",
|
||||
AzureSubscription: "subscription",
|
||||
AzureTenant: "tenant",
|
||||
AzureSubnet: "azure-subnet",
|
||||
AzureNetworkSecurityGroup: "network-security-group",
|
||||
AzureWorkersScaleSet: "worker-scale-set",
|
||||
AzureControlPlanesScaleSet: "controlplane-scale-set",
|
||||
},
|
||||
wantErr: true,
|
||||
},
|
||||
"missing uid": {
|
||||
state: state.ConstellationState{
|
||||
CloudProvider: cloudprovider.Azure.String(),
|
||||
AzureNodes: cloudtypes.Instances{
|
||||
AzureWorkers: cloudtypes.Instances{
|
||||
"0": {
|
||||
PublicIP: "ip1",
|
||||
PrivateIP: "ip2",
|
||||
},
|
||||
},
|
||||
AzureCoordinators: cloudtypes.Instances{
|
||||
AzureControlPlane: cloudtypes.Instances{
|
||||
"0": {
|
||||
PublicIP: "ip3",
|
||||
PrivateIP: "ip4",
|
||||
},
|
||||
},
|
||||
Name: "name",
|
||||
AzureResourceGroup: "resource-group",
|
||||
AzureLocation: "location",
|
||||
AzureSubscription: "subscription",
|
||||
AzureTenant: "tenant",
|
||||
AzureSubnet: "azure-subnet",
|
||||
AzureNetworkSecurityGroup: "network-security-group",
|
||||
AzureNodesScaleSet: "node-scale-set",
|
||||
AzureCoordinatorsScaleSet: "coordinator-scale-set",
|
||||
Name: "name",
|
||||
AzureResourceGroup: "resource-group",
|
||||
AzureLocation: "location",
|
||||
AzureSubscription: "subscription",
|
||||
AzureTenant: "tenant",
|
||||
AzureSubnet: "azure-subnet",
|
||||
AzureNetworkSecurityGroup: "network-security-group",
|
||||
AzureWorkersScaleSet: "worker-scale-set",
|
||||
AzureControlPlanesScaleSet: "controlplane-scale-set",
|
||||
},
|
||||
wantErr: true,
|
||||
},
|
||||
"missing resource group": {
|
||||
state: state.ConstellationState{
|
||||
CloudProvider: cloudprovider.Azure.String(),
|
||||
AzureNodes: cloudtypes.Instances{
|
||||
AzureWorkers: cloudtypes.Instances{
|
||||
"0": {
|
||||
PublicIP: "ip1",
|
||||
PrivateIP: "ip2",
|
||||
},
|
||||
},
|
||||
AzureCoordinators: cloudtypes.Instances{
|
||||
AzureControlPlane: cloudtypes.Instances{
|
||||
"0": {
|
||||
PublicIP: "ip3",
|
||||
PrivateIP: "ip4",
|
||||
},
|
||||
},
|
||||
Name: "name",
|
||||
UID: "uid",
|
||||
AzureLocation: "location",
|
||||
AzureSubscription: "subscription",
|
||||
AzureTenant: "tenant",
|
||||
AzureSubnet: "azure-subnet",
|
||||
AzureNetworkSecurityGroup: "network-security-group",
|
||||
AzureNodesScaleSet: "node-scale-set",
|
||||
AzureCoordinatorsScaleSet: "coordinator-scale-set",
|
||||
Name: "name",
|
||||
UID: "uid",
|
||||
AzureLocation: "location",
|
||||
AzureSubscription: "subscription",
|
||||
AzureTenant: "tenant",
|
||||
AzureSubnet: "azure-subnet",
|
||||
AzureNetworkSecurityGroup: "network-security-group",
|
||||
AzureWorkersScaleSet: "worker-scale-set",
|
||||
AzureControlPlanesScaleSet: "controlplane-scale-set",
|
||||
},
|
||||
wantErr: true,
|
||||
},
|
||||
"missing location": {
|
||||
state: state.ConstellationState{
|
||||
CloudProvider: cloudprovider.Azure.String(),
|
||||
AzureNodes: cloudtypes.Instances{
|
||||
AzureWorkers: cloudtypes.Instances{
|
||||
"0": {
|
||||
PublicIP: "ip1",
|
||||
PrivateIP: "ip2",
|
||||
},
|
||||
},
|
||||
AzureCoordinators: cloudtypes.Instances{
|
||||
AzureControlPlane: cloudtypes.Instances{
|
||||
"0": {
|
||||
PublicIP: "ip3",
|
||||
PrivateIP: "ip4",
|
||||
},
|
||||
},
|
||||
Name: "name",
|
||||
UID: "uid",
|
||||
AzureResourceGroup: "resource-group",
|
||||
AzureSubscription: "subscription",
|
||||
AzureTenant: "tenant",
|
||||
AzureSubnet: "azure-subnet",
|
||||
AzureNetworkSecurityGroup: "network-security-group",
|
||||
AzureNodesScaleSet: "node-scale-set",
|
||||
AzureCoordinatorsScaleSet: "coordinator-scale-set",
|
||||
Name: "name",
|
||||
UID: "uid",
|
||||
AzureResourceGroup: "resource-group",
|
||||
AzureSubscription: "subscription",
|
||||
AzureTenant: "tenant",
|
||||
AzureSubnet: "azure-subnet",
|
||||
AzureNetworkSecurityGroup: "network-security-group",
|
||||
AzureWorkersScaleSet: "worker-scale-set",
|
||||
AzureControlPlanesScaleSet: "controlplane-scale-set",
|
||||
},
|
||||
wantErr: true,
|
||||
},
|
||||
"missing subscription": {
|
||||
state: state.ConstellationState{
|
||||
CloudProvider: cloudprovider.Azure.String(),
|
||||
AzureNodes: cloudtypes.Instances{
|
||||
AzureWorkers: cloudtypes.Instances{
|
||||
"0": {
|
||||
PublicIP: "ip1",
|
||||
PrivateIP: "ip2",
|
||||
},
|
||||
},
|
||||
AzureCoordinators: cloudtypes.Instances{
|
||||
AzureControlPlane: cloudtypes.Instances{
|
||||
"0": {
|
||||
PublicIP: "ip3",
|
||||
PrivateIP: "ip4",
|
||||
},
|
||||
},
|
||||
Name: "name",
|
||||
UID: "uid",
|
||||
AzureResourceGroup: "resource-group",
|
||||
AzureTenant: "tenant",
|
||||
AzureLocation: "location",
|
||||
AzureSubnet: "azure-subnet",
|
||||
AzureNetworkSecurityGroup: "network-security-group",
|
||||
AzureNodesScaleSet: "node-scale-set",
|
||||
AzureCoordinatorsScaleSet: "coordinator-scale-set",
|
||||
Name: "name",
|
||||
UID: "uid",
|
||||
AzureResourceGroup: "resource-group",
|
||||
AzureTenant: "tenant",
|
||||
AzureLocation: "location",
|
||||
AzureSubnet: "azure-subnet",
|
||||
AzureNetworkSecurityGroup: "network-security-group",
|
||||
AzureWorkersScaleSet: "worker-scale-set",
|
||||
AzureControlPlanesScaleSet: "controlplane-scale-set",
|
||||
},
|
||||
wantErr: true,
|
||||
},
|
||||
"missing tenant": {
|
||||
state: state.ConstellationState{
|
||||
CloudProvider: cloudprovider.Azure.String(),
|
||||
AzureNodes: cloudtypes.Instances{
|
||||
AzureWorkers: cloudtypes.Instances{
|
||||
"0": {
|
||||
PublicIP: "ip1",
|
||||
PrivateIP: "ip2",
|
||||
},
|
||||
},
|
||||
AzureCoordinators: cloudtypes.Instances{
|
||||
AzureControlPlane: cloudtypes.Instances{
|
||||
"0": {
|
||||
PublicIP: "ip3",
|
||||
PrivateIP: "ip4",
|
||||
},
|
||||
},
|
||||
Name: "name",
|
||||
UID: "uid",
|
||||
AzureResourceGroup: "resource-group",
|
||||
AzureSubscription: "subscription",
|
||||
AzureLocation: "location",
|
||||
AzureSubnet: "azure-subnet",
|
||||
AzureNetworkSecurityGroup: "network-security-group",
|
||||
AzureNodesScaleSet: "node-scale-set",
|
||||
AzureCoordinatorsScaleSet: "coordinator-scale-set",
|
||||
Name: "name",
|
||||
UID: "uid",
|
||||
AzureResourceGroup: "resource-group",
|
||||
AzureSubscription: "subscription",
|
||||
AzureLocation: "location",
|
||||
AzureSubnet: "azure-subnet",
|
||||
AzureNetworkSecurityGroup: "network-security-group",
|
||||
AzureWorkersScaleSet: "worker-scale-set",
|
||||
AzureControlPlanesScaleSet: "controlplane-scale-set",
|
||||
},
|
||||
wantErr: true,
|
||||
},
|
||||
"missing subnet": {
|
||||
state: state.ConstellationState{
|
||||
CloudProvider: cloudprovider.Azure.String(),
|
||||
AzureNodes: cloudtypes.Instances{
|
||||
AzureWorkers: cloudtypes.Instances{
|
||||
"0": {
|
||||
PublicIP: "ip1",
|
||||
PrivateIP: "ip2",
|
||||
},
|
||||
},
|
||||
AzureCoordinators: cloudtypes.Instances{
|
||||
AzureControlPlane: cloudtypes.Instances{
|
||||
"0": {
|
||||
PublicIP: "ip3",
|
||||
PrivateIP: "ip4",
|
||||
},
|
||||
},
|
||||
Name: "name",
|
||||
UID: "uid",
|
||||
AzureResourceGroup: "resource-group",
|
||||
AzureLocation: "location",
|
||||
AzureSubscription: "subscription",
|
||||
AzureTenant: "tenant",
|
||||
AzureNetworkSecurityGroup: "network-security-group",
|
||||
AzureNodesScaleSet: "node-scale-set",
|
||||
AzureCoordinatorsScaleSet: "coordinator-scale-set",
|
||||
Name: "name",
|
||||
UID: "uid",
|
||||
AzureResourceGroup: "resource-group",
|
||||
AzureLocation: "location",
|
||||
AzureSubscription: "subscription",
|
||||
AzureTenant: "tenant",
|
||||
AzureNetworkSecurityGroup: "network-security-group",
|
||||
AzureWorkersScaleSet: "worker-scale-set",
|
||||
AzureControlPlanesScaleSet: "controlplane-scale-set",
|
||||
},
|
||||
wantErr: true,
|
||||
},
|
||||
"missing network security group": {
|
||||
state: state.ConstellationState{
|
||||
CloudProvider: cloudprovider.Azure.String(),
|
||||
AzureNodes: cloudtypes.Instances{
|
||||
AzureWorkers: cloudtypes.Instances{
|
||||
"0": {
|
||||
PublicIP: "ip1",
|
||||
PrivateIP: "ip2",
|
||||
},
|
||||
},
|
||||
AzureCoordinators: cloudtypes.Instances{
|
||||
AzureControlPlane: cloudtypes.Instances{
|
||||
"0": {
|
||||
PublicIP: "ip3",
|
||||
PrivateIP: "ip4",
|
||||
},
|
||||
},
|
||||
Name: "name",
|
||||
UID: "uid",
|
||||
AzureResourceGroup: "resource-group",
|
||||
AzureLocation: "location",
|
||||
AzureSubscription: "subscription",
|
||||
AzureTenant: "tenant",
|
||||
AzureSubnet: "azure-subnet",
|
||||
AzureNodesScaleSet: "node-scale-set",
|
||||
AzureCoordinatorsScaleSet: "coordinator-scale-set",
|
||||
Name: "name",
|
||||
UID: "uid",
|
||||
AzureResourceGroup: "resource-group",
|
||||
AzureLocation: "location",
|
||||
AzureSubscription: "subscription",
|
||||
AzureTenant: "tenant",
|
||||
AzureSubnet: "azure-subnet",
|
||||
AzureWorkersScaleSet: "worker-scale-set",
|
||||
AzureControlPlanesScaleSet: "controlplane-scale-set",
|
||||
},
|
||||
wantErr: true,
|
||||
},
|
||||
"missing node scale set": {
|
||||
"missing worker scale set": {
|
||||
state: state.ConstellationState{
|
||||
CloudProvider: cloudprovider.Azure.String(),
|
||||
AzureNodes: cloudtypes.Instances{
|
||||
AzureWorkers: cloudtypes.Instances{
|
||||
"0": {
|
||||
PublicIP: "ip1",
|
||||
PrivateIP: "ip2",
|
||||
},
|
||||
},
|
||||
AzureCoordinators: cloudtypes.Instances{
|
||||
AzureControlPlane: cloudtypes.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",
|
||||
AzureControlPlanesScaleSet: "controlplane-scale-set",
|
||||
},
|
||||
wantErr: true,
|
||||
},
|
||||
"missing controlplane scale set": {
|
||||
state: state.ConstellationState{
|
||||
CloudProvider: cloudprovider.Azure.String(),
|
||||
AzureWorkers: cloudtypes.Instances{
|
||||
"0": {
|
||||
PublicIP: "ip1",
|
||||
PrivateIP: "ip2",
|
||||
},
|
||||
},
|
||||
AzureControlPlane: cloudtypes.Instances{
|
||||
"0": {
|
||||
PublicIP: "ip3",
|
||||
PrivateIP: "ip4",
|
||||
|
@ -330,34 +357,7 @@ func TestSetGetState(t *testing.T) {
|
|||
AzureTenant: "tenant",
|
||||
AzureSubnet: "azure-subnet",
|
||||
AzureNetworkSecurityGroup: "network-security-group",
|
||||
AzureCoordinatorsScaleSet: "coordinator-scale-set",
|
||||
},
|
||||
wantErr: true,
|
||||
},
|
||||
"missing coordinator scale set": {
|
||||
state: state.ConstellationState{
|
||||
CloudProvider: cloudprovider.Azure.String(),
|
||||
AzureNodes: cloudtypes.Instances{
|
||||
"0": {
|
||||
PublicIP: "ip1",
|
||||
PrivateIP: "ip2",
|
||||
},
|
||||
},
|
||||
AzureCoordinators: cloudtypes.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",
|
||||
AzureWorkersScaleSet: "worker-scale-set",
|
||||
},
|
||||
wantErr: true,
|
||||
},
|
||||
|
@ -373,8 +373,8 @@ func TestSetGetState(t *testing.T) {
|
|||
assert.Error(client.SetState(tc.state))
|
||||
} else {
|
||||
assert.NoError(client.SetState(tc.state))
|
||||
assert.Equal(tc.state.AzureNodes, client.nodes)
|
||||
assert.Equal(tc.state.AzureCoordinators, client.coordinators)
|
||||
assert.Equal(tc.state.AzureWorkers, client.workers)
|
||||
assert.Equal(tc.state.AzureControlPlane, client.controlPlanes)
|
||||
assert.Equal(tc.state.Name, client.name)
|
||||
assert.Equal(tc.state.UID, client.uid)
|
||||
assert.Equal(tc.state.AzureResourceGroup, client.resourceGroup)
|
||||
|
@ -383,8 +383,8 @@ func TestSetGetState(t *testing.T) {
|
|||
assert.Equal(tc.state.AzureTenant, client.tenantID)
|
||||
assert.Equal(tc.state.AzureSubnet, client.subnetID)
|
||||
assert.Equal(tc.state.AzureNetworkSecurityGroup, client.networkSecurityGroup)
|
||||
assert.Equal(tc.state.AzureNodesScaleSet, client.nodesScaleSet)
|
||||
assert.Equal(tc.state.AzureCoordinatorsScaleSet, client.coordinatorsScaleSet)
|
||||
assert.Equal(tc.state.AzureWorkersScaleSet, client.workerScaleSet)
|
||||
assert.Equal(tc.state.AzureControlPlanesScaleSet, client.controlPlaneScaleSet)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -396,8 +396,8 @@ func TestSetGetState(t *testing.T) {
|
|||
assert := assert.New(t)
|
||||
|
||||
client := Client{
|
||||
nodes: tc.state.AzureNodes,
|
||||
coordinators: tc.state.AzureCoordinators,
|
||||
workers: tc.state.AzureWorkers,
|
||||
controlPlanes: tc.state.AzureControlPlane,
|
||||
name: tc.state.Name,
|
||||
uid: tc.state.UID,
|
||||
resourceGroup: tc.state.AzureResourceGroup,
|
||||
|
@ -406,8 +406,8 @@ func TestSetGetState(t *testing.T) {
|
|||
tenantID: tc.state.AzureTenant,
|
||||
subnetID: tc.state.AzureSubnet,
|
||||
networkSecurityGroup: tc.state.AzureNetworkSecurityGroup,
|
||||
nodesScaleSet: tc.state.AzureNodesScaleSet,
|
||||
coordinatorsScaleSet: tc.state.AzureCoordinatorsScaleSet,
|
||||
workerScaleSet: tc.state.AzureWorkersScaleSet,
|
||||
controlPlaneScaleSet: tc.state.AzureControlPlanesScaleSet,
|
||||
}
|
||||
if tc.wantErr {
|
||||
_, err := client.GetState()
|
||||
|
@ -427,52 +427,52 @@ func TestSetStateCloudProvider(t *testing.T) {
|
|||
|
||||
client := Client{}
|
||||
stateMissingCloudProvider := state.ConstellationState{
|
||||
AzureNodes: cloudtypes.Instances{
|
||||
AzureWorkers: cloudtypes.Instances{
|
||||
"0": {
|
||||
PublicIP: "ip1",
|
||||
PrivateIP: "ip2",
|
||||
},
|
||||
},
|
||||
AzureCoordinators: cloudtypes.Instances{
|
||||
AzureControlPlane: cloudtypes.Instances{
|
||||
"0": {
|
||||
PublicIP: "ip3",
|
||||
PrivateIP: "ip4",
|
||||
},
|
||||
},
|
||||
Name: "name",
|
||||
UID: "uid",
|
||||
AzureResourceGroup: "resource-group",
|
||||
AzureLocation: "location",
|
||||
AzureSubscription: "subscription",
|
||||
AzureSubnet: "azure-subnet",
|
||||
AzureNetworkSecurityGroup: "network-security-group",
|
||||
AzureNodesScaleSet: "node-scale-set",
|
||||
AzureCoordinatorsScaleSet: "coordinator-scale-set",
|
||||
Name: "name",
|
||||
UID: "uid",
|
||||
AzureResourceGroup: "resource-group",
|
||||
AzureLocation: "location",
|
||||
AzureSubscription: "subscription",
|
||||
AzureSubnet: "azure-subnet",
|
||||
AzureNetworkSecurityGroup: "network-security-group",
|
||||
AzureWorkersScaleSet: "worker-scale-set",
|
||||
AzureControlPlanesScaleSet: "controlplane-scale-set",
|
||||
}
|
||||
assert.Error(client.SetState(stateMissingCloudProvider))
|
||||
stateIncorrectCloudProvider := state.ConstellationState{
|
||||
CloudProvider: "incorrect",
|
||||
AzureNodes: cloudtypes.Instances{
|
||||
AzureWorkers: cloudtypes.Instances{
|
||||
"0": {
|
||||
PublicIP: "ip1",
|
||||
PrivateIP: "ip2",
|
||||
},
|
||||
},
|
||||
AzureCoordinators: cloudtypes.Instances{
|
||||
AzureControlPlane: cloudtypes.Instances{
|
||||
"0": {
|
||||
PublicIP: "ip3",
|
||||
PrivateIP: "ip4",
|
||||
},
|
||||
},
|
||||
Name: "name",
|
||||
UID: "uid",
|
||||
AzureResourceGroup: "resource-group",
|
||||
AzureLocation: "location",
|
||||
AzureSubscription: "subscription",
|
||||
AzureSubnet: "azure-subnet",
|
||||
AzureNetworkSecurityGroup: "network-security-group",
|
||||
AzureNodesScaleSet: "node-scale-set",
|
||||
AzureCoordinatorsScaleSet: "coordinator-scale-set",
|
||||
Name: "name",
|
||||
UID: "uid",
|
||||
AzureResourceGroup: "resource-group",
|
||||
AzureLocation: "location",
|
||||
AzureSubscription: "subscription",
|
||||
AzureSubnet: "azure-subnet",
|
||||
AzureNetworkSecurityGroup: "network-security-group",
|
||||
AzureWorkersScaleSet: "worker-scale-set",
|
||||
AzureControlPlanesScaleSet: "controlplane-scale-set",
|
||||
}
|
||||
assert.Error(client.SetState(stateIncorrectCloudProvider))
|
||||
}
|
||||
|
|
|
@ -12,11 +12,11 @@ import (
|
|||
)
|
||||
|
||||
func (c *Client) CreateInstances(ctx context.Context, input CreateInstancesInput) error {
|
||||
// Create nodes scale set
|
||||
createNodesInput := CreateScaleSetInput{
|
||||
Name: "constellation-scale-set-nodes-" + c.uid,
|
||||
// Create worker scale set
|
||||
createWorkerInput := CreateScaleSetInput{
|
||||
Name: "constellation-scale-set-workers-" + c.uid,
|
||||
NamePrefix: c.name + "-worker-" + c.uid + "-",
|
||||
Count: input.CountNodes,
|
||||
Count: input.CountWorkers,
|
||||
InstanceType: input.InstanceType,
|
||||
StateDiskSizeGB: int32(input.StateDiskSizeGB),
|
||||
Image: input.Image,
|
||||
|
@ -24,17 +24,17 @@ func (c *Client) CreateInstances(ctx context.Context, input CreateInstancesInput
|
|||
LoadBalancerBackendAddressPool: azure.BackendAddressPoolWorkerName + "-" + c.uid,
|
||||
}
|
||||
|
||||
if err := c.createScaleSet(ctx, createNodesInput); err != nil {
|
||||
if err := c.createScaleSet(ctx, createWorkerInput); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
c.nodesScaleSet = createNodesInput.Name
|
||||
c.workerScaleSet = createWorkerInput.Name
|
||||
|
||||
// Create coordinator scale set
|
||||
createCoordinatorsInput := CreateScaleSetInput{
|
||||
Name: "constellation-scale-set-coordinators-" + c.uid,
|
||||
// Create control plane scale set
|
||||
createControlPlaneInput := CreateScaleSetInput{
|
||||
Name: "constellation-scale-set-controlpalens-" + c.uid,
|
||||
NamePrefix: c.name + "-control-plane-" + c.uid + "-",
|
||||
Count: input.CountCoordinators,
|
||||
Count: input.CountControlPlanes,
|
||||
InstanceType: input.InstanceType,
|
||||
StateDiskSizeGB: int32(input.StateDiskSizeGB),
|
||||
Image: input.Image,
|
||||
|
@ -42,40 +42,40 @@ func (c *Client) CreateInstances(ctx context.Context, input CreateInstancesInput
|
|||
LoadBalancerBackendAddressPool: azure.BackendAddressPoolControlPlaneName + "-" + c.uid,
|
||||
}
|
||||
|
||||
if err := c.createScaleSet(ctx, createCoordinatorsInput); err != nil {
|
||||
if err := c.createScaleSet(ctx, createControlPlaneInput); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Get nodes IPs
|
||||
instances, err := c.getInstanceIPs(ctx, createNodesInput.Name, createNodesInput.Count)
|
||||
// Get worker IPs
|
||||
instances, err := c.getInstanceIPs(ctx, createWorkerInput.Name, createWorkerInput.Count)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
c.nodes = instances
|
||||
c.workers = instances
|
||||
|
||||
// Get coordinators IPs
|
||||
c.coordinatorsScaleSet = createCoordinatorsInput.Name
|
||||
instances, err = c.getInstanceIPs(ctx, createCoordinatorsInput.Name, createCoordinatorsInput.Count)
|
||||
// Get control plane IPs
|
||||
c.controlPlaneScaleSet = createControlPlaneInput.Name
|
||||
instances, err = c.getInstanceIPs(ctx, createControlPlaneInput.Name, createControlPlaneInput.Count)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
c.coordinators = instances
|
||||
c.controlPlanes = instances
|
||||
|
||||
// Set the load balancer public IP in the first coordinator
|
||||
coord, ok := c.coordinators["0"]
|
||||
// Set the load balancer public IP in the first control plane
|
||||
coord, ok := c.controlPlanes["0"]
|
||||
if !ok {
|
||||
return errors.New("coordinator 0 not found")
|
||||
return errors.New("control plane 0 not found")
|
||||
}
|
||||
coord.PublicIP = c.loadBalancerPubIP
|
||||
c.coordinators["0"] = coord
|
||||
c.controlPlanes["0"] = coord
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// CreateInstancesInput is the input for a CreateInstances operation.
|
||||
type CreateInstancesInput struct {
|
||||
CountNodes int
|
||||
CountCoordinators int
|
||||
CountWorkers int
|
||||
CountControlPlanes int
|
||||
InstanceType string
|
||||
StateDiskSizeGB int
|
||||
Image string
|
||||
|
@ -90,7 +90,7 @@ func (c *Client) CreateInstancesVMs(ctx context.Context, input CreateInstancesIn
|
|||
return err
|
||||
}
|
||||
|
||||
for i := 0; i < input.CountCoordinators; i++ {
|
||||
for i := 0; i < input.CountControlPlanes; i++ {
|
||||
vm := azure.VMInstance{
|
||||
Name: c.name + "-control-plane-" + c.uid + "-" + strconv.Itoa(i),
|
||||
Username: "constell",
|
||||
|
@ -103,12 +103,12 @@ func (c *Client) CreateInstancesVMs(ctx context.Context, input CreateInstancesIn
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
c.coordinators[strconv.Itoa(i)] = instance
|
||||
c.controlPlanes[strconv.Itoa(i)] = instance
|
||||
}
|
||||
|
||||
for i := 0; i < input.CountNodes; i++ {
|
||||
for i := 0; i < input.CountWorkers; i++ {
|
||||
vm := azure.VMInstance{
|
||||
Name: c.name + "-node-" + c.uid + "-" + strconv.Itoa(i),
|
||||
Name: c.name + "-worker-" + c.uid + "-" + strconv.Itoa(i),
|
||||
Username: "constell",
|
||||
Password: pw,
|
||||
Location: c.location,
|
||||
|
@ -119,7 +119,7 @@ func (c *Client) CreateInstancesVMs(ctx context.Context, input CreateInstancesIn
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
c.nodes[strconv.Itoa(i)] = instance
|
||||
c.workers[strconv.Itoa(i)] = instance
|
||||
}
|
||||
|
||||
return nil
|
||||
|
@ -294,12 +294,12 @@ func (c *Client) TerminateResourceGroup(ctx context.Context) error {
|
|||
if _, err = poller.PollUntilDone(ctx, 30*time.Second); err != nil {
|
||||
return err
|
||||
}
|
||||
c.nodes = nil
|
||||
c.coordinators = nil
|
||||
c.workers = nil
|
||||
c.controlPlanes = nil
|
||||
c.resourceGroup = ""
|
||||
c.subnetID = ""
|
||||
c.networkSecurityGroup = ""
|
||||
c.nodesScaleSet = ""
|
||||
c.coordinatorsScaleSet = ""
|
||||
c.workerScaleSet = ""
|
||||
c.controlPlaneScaleSet = ""
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -38,8 +38,8 @@ func TestCreateResourceGroup(t *testing.T) {
|
|||
name: "name",
|
||||
uid: "uid",
|
||||
resourceGroupAPI: tc.resourceGroupAPI,
|
||||
nodes: make(cloudtypes.Instances),
|
||||
coordinators: make(cloudtypes.Instances),
|
||||
workers: make(cloudtypes.Instances),
|
||||
controlPlanes: make(cloudtypes.Instances),
|
||||
}
|
||||
|
||||
if tc.wantErr {
|
||||
|
@ -60,14 +60,14 @@ func TestTerminateResourceGroup(t *testing.T) {
|
|||
name: "name",
|
||||
uid: "uid",
|
||||
subnetID: "subnet",
|
||||
nodesScaleSet: "node-scale-set",
|
||||
coordinatorsScaleSet: "coordinator-scale-set",
|
||||
nodes: cloudtypes.Instances{
|
||||
workerScaleSet: "node-scale-set",
|
||||
controlPlaneScaleSet: "controlplane-scale-set",
|
||||
workers: cloudtypes.Instances{
|
||||
"0": {
|
||||
PublicIP: "192.0.2.1", PrivateIP: "192.0.2.1",
|
||||
},
|
||||
},
|
||||
coordinators: cloudtypes.Instances{
|
||||
controlPlanes: cloudtypes.Instances{
|
||||
"0": {
|
||||
PublicIP: "192.0.2.1", PrivateIP: "192.0.2.1",
|
||||
},
|
||||
|
@ -112,10 +112,10 @@ func TestTerminateResourceGroup(t *testing.T) {
|
|||
assert.NoError(tc.client.TerminateResourceGroup(ctx))
|
||||
assert.Empty(tc.client.resourceGroup)
|
||||
assert.Empty(tc.client.subnetID)
|
||||
assert.Empty(tc.client.nodes)
|
||||
assert.Empty(tc.client.coordinators)
|
||||
assert.Empty(tc.client.nodesScaleSet)
|
||||
assert.Empty(tc.client.coordinatorsScaleSet)
|
||||
assert.Empty(tc.client.workers)
|
||||
assert.Empty(tc.client.controlPlanes)
|
||||
assert.Empty(tc.client.workerScaleSet)
|
||||
assert.Empty(tc.client.controlPlaneScaleSet)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -146,8 +146,8 @@ func TestCreateInstances(t *testing.T) {
|
|||
resourceGroupAPI: newSuccessfulResourceGroupStub(),
|
||||
roleAssignmentsAPI: &stubRoleAssignmentsAPI{},
|
||||
createInstancesInput: CreateInstancesInput{
|
||||
CountCoordinators: 3,
|
||||
CountNodes: 3,
|
||||
CountControlPlanes: 3,
|
||||
CountWorkers: 3,
|
||||
InstanceType: "type",
|
||||
Image: "image",
|
||||
UserAssingedIdentity: "identity",
|
||||
|
@ -160,8 +160,8 @@ func TestCreateInstances(t *testing.T) {
|
|||
resourceGroupAPI: newSuccessfulResourceGroupStub(),
|
||||
roleAssignmentsAPI: &stubRoleAssignmentsAPI{},
|
||||
createInstancesInput: CreateInstancesInput{
|
||||
CountCoordinators: 3,
|
||||
CountNodes: 3,
|
||||
CountControlPlanes: 3,
|
||||
CountWorkers: 3,
|
||||
InstanceType: "type",
|
||||
Image: "image",
|
||||
UserAssingedIdentity: "identity",
|
||||
|
@ -175,8 +175,8 @@ func TestCreateInstances(t *testing.T) {
|
|||
resourceGroupAPI: newSuccessfulResourceGroupStub(),
|
||||
roleAssignmentsAPI: &stubRoleAssignmentsAPI{},
|
||||
createInstancesInput: CreateInstancesInput{
|
||||
CountCoordinators: 3,
|
||||
CountNodes: 3,
|
||||
CountControlPlanes: 3,
|
||||
CountWorkers: 3,
|
||||
InstanceType: "type",
|
||||
Image: "image",
|
||||
UserAssingedIdentity: "identity",
|
||||
|
@ -190,7 +190,7 @@ func TestCreateInstances(t *testing.T) {
|
|||
resourceGroupAPI: newSuccessfulResourceGroupStub(),
|
||||
roleAssignmentsAPI: &stubRoleAssignmentsAPI{},
|
||||
createInstancesInput: CreateInstancesInput{
|
||||
CountNodes: 3,
|
||||
CountWorkers: 3,
|
||||
InstanceType: "type",
|
||||
Image: "image",
|
||||
UserAssingedIdentity: "identity",
|
||||
|
@ -214,8 +214,8 @@ func TestCreateInstances(t *testing.T) {
|
|||
scaleSetsAPI: tc.scaleSetsAPI,
|
||||
resourceGroupAPI: tc.resourceGroupAPI,
|
||||
roleAssignmentsAPI: tc.roleAssignmentsAPI,
|
||||
nodes: make(cloudtypes.Instances),
|
||||
coordinators: make(cloudtypes.Instances),
|
||||
workers: make(cloudtypes.Instances),
|
||||
controlPlanes: make(cloudtypes.Instances),
|
||||
loadBalancerPubIP: "lbip",
|
||||
}
|
||||
|
||||
|
@ -223,12 +223,12 @@ func TestCreateInstances(t *testing.T) {
|
|||
assert.Error(client.CreateInstances(ctx, tc.createInstancesInput))
|
||||
} else {
|
||||
assert.NoError(client.CreateInstances(ctx, tc.createInstancesInput))
|
||||
assert.Equal(tc.createInstancesInput.CountCoordinators, len(client.coordinators))
|
||||
assert.Equal(tc.createInstancesInput.CountNodes, len(client.nodes))
|
||||
assert.NotEmpty(client.nodes["0"].PrivateIP)
|
||||
assert.NotEmpty(client.nodes["0"].PublicIP)
|
||||
assert.NotEmpty(client.coordinators["0"].PrivateIP)
|
||||
assert.Equal("lbip", client.coordinators["0"].PublicIP)
|
||||
assert.Equal(tc.createInstancesInput.CountControlPlanes, len(client.controlPlanes))
|
||||
assert.Equal(tc.createInstancesInput.CountWorkers, len(client.workers))
|
||||
assert.NotEmpty(client.workers["0"].PrivateIP)
|
||||
assert.NotEmpty(client.workers["0"].PublicIP)
|
||||
assert.NotEmpty(client.controlPlanes["0"].PrivateIP)
|
||||
assert.Equal("lbip", client.controlPlanes["0"].PublicIP)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -261,10 +261,10 @@ func TestCreateInstancesVMs(t *testing.T) {
|
|||
resourceGroupAPI: newSuccessfulResourceGroupStub(),
|
||||
roleAssignmentsAPI: &stubRoleAssignmentsAPI{},
|
||||
createInstancesInput: CreateInstancesInput{
|
||||
CountCoordinators: 3,
|
||||
CountNodes: 3,
|
||||
InstanceType: "type",
|
||||
Image: "image",
|
||||
CountControlPlanes: 3,
|
||||
CountWorkers: 3,
|
||||
InstanceType: "type",
|
||||
Image: "image",
|
||||
},
|
||||
},
|
||||
"error when creating scale set": {
|
||||
|
@ -274,10 +274,10 @@ func TestCreateInstancesVMs(t *testing.T) {
|
|||
resourceGroupAPI: newSuccessfulResourceGroupStub(),
|
||||
roleAssignmentsAPI: &stubRoleAssignmentsAPI{},
|
||||
createInstancesInput: CreateInstancesInput{
|
||||
CountCoordinators: 3,
|
||||
CountNodes: 3,
|
||||
InstanceType: "type",
|
||||
Image: "image",
|
||||
CountControlPlanes: 3,
|
||||
CountWorkers: 3,
|
||||
InstanceType: "type",
|
||||
Image: "image",
|
||||
},
|
||||
wantErr: true,
|
||||
},
|
||||
|
@ -288,10 +288,10 @@ func TestCreateInstancesVMs(t *testing.T) {
|
|||
resourceGroupAPI: newSuccessfulResourceGroupStub(),
|
||||
roleAssignmentsAPI: &stubRoleAssignmentsAPI{},
|
||||
createInstancesInput: CreateInstancesInput{
|
||||
CountCoordinators: 3,
|
||||
CountNodes: 3,
|
||||
InstanceType: "type",
|
||||
Image: "image",
|
||||
CountControlPlanes: 3,
|
||||
CountWorkers: 3,
|
||||
InstanceType: "type",
|
||||
Image: "image",
|
||||
},
|
||||
wantErr: true,
|
||||
},
|
||||
|
@ -302,10 +302,10 @@ func TestCreateInstancesVMs(t *testing.T) {
|
|||
resourceGroupAPI: newSuccessfulResourceGroupStub(),
|
||||
roleAssignmentsAPI: &stubRoleAssignmentsAPI{},
|
||||
createInstancesInput: CreateInstancesInput{
|
||||
CountCoordinators: 3,
|
||||
CountNodes: 3,
|
||||
InstanceType: "type",
|
||||
Image: "image",
|
||||
CountControlPlanes: 3,
|
||||
CountWorkers: 3,
|
||||
InstanceType: "type",
|
||||
Image: "image",
|
||||
},
|
||||
wantErr: true,
|
||||
},
|
||||
|
@ -316,10 +316,10 @@ func TestCreateInstancesVMs(t *testing.T) {
|
|||
resourceGroupAPI: newSuccessfulResourceGroupStub(),
|
||||
roleAssignmentsAPI: &stubRoleAssignmentsAPI{},
|
||||
createInstancesInput: CreateInstancesInput{
|
||||
CountCoordinators: 3,
|
||||
CountNodes: 3,
|
||||
InstanceType: "type",
|
||||
Image: "image",
|
||||
CountControlPlanes: 3,
|
||||
CountWorkers: 3,
|
||||
InstanceType: "type",
|
||||
Image: "image",
|
||||
},
|
||||
wantErr: true,
|
||||
},
|
||||
|
@ -330,10 +330,10 @@ func TestCreateInstancesVMs(t *testing.T) {
|
|||
resourceGroupAPI: newSuccessfulResourceGroupStub(),
|
||||
roleAssignmentsAPI: &stubRoleAssignmentsAPI{},
|
||||
createInstancesInput: CreateInstancesInput{
|
||||
CountCoordinators: 3,
|
||||
CountNodes: 3,
|
||||
InstanceType: "type",
|
||||
Image: "image",
|
||||
CountControlPlanes: 3,
|
||||
CountWorkers: 3,
|
||||
InstanceType: "type",
|
||||
Image: "image",
|
||||
},
|
||||
wantErr: true,
|
||||
},
|
||||
|
@ -355,8 +355,8 @@ func TestCreateInstancesVMs(t *testing.T) {
|
|||
virtualMachinesAPI: tc.virtualMachinesAPI,
|
||||
resourceGroupAPI: tc.resourceGroupAPI,
|
||||
roleAssignmentsAPI: tc.roleAssignmentsAPI,
|
||||
nodes: make(cloudtypes.Instances),
|
||||
coordinators: make(cloudtypes.Instances),
|
||||
workers: make(cloudtypes.Instances),
|
||||
controlPlanes: make(cloudtypes.Instances),
|
||||
}
|
||||
|
||||
if tc.wantErr {
|
||||
|
@ -365,12 +365,12 @@ func TestCreateInstancesVMs(t *testing.T) {
|
|||
}
|
||||
|
||||
require.NoError(client.CreateInstancesVMs(ctx, tc.createInstancesInput))
|
||||
assert.Equal(tc.createInstancesInput.CountCoordinators, len(client.coordinators))
|
||||
assert.Equal(tc.createInstancesInput.CountNodes, len(client.nodes))
|
||||
assert.NotEmpty(client.nodes["0"].PrivateIP)
|
||||
assert.NotEmpty(client.nodes["0"].PublicIP)
|
||||
assert.NotEmpty(client.coordinators["0"].PrivateIP)
|
||||
assert.NotEmpty(client.coordinators["0"].PublicIP)
|
||||
assert.Equal(tc.createInstancesInput.CountControlPlanes, len(client.controlPlanes))
|
||||
assert.Equal(tc.createInstancesInput.CountWorkers, len(client.workers))
|
||||
assert.NotEmpty(client.workers["0"].PrivateIP)
|
||||
assert.NotEmpty(client.workers["0"].PublicIP)
|
||||
assert.NotEmpty(client.controlPlanes["0"].PrivateIP)
|
||||
assert.NotEmpty(client.controlPlanes["0"].PublicIP)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,8 +39,8 @@ func TestCreateVirtualNetwork(t *testing.T) {
|
|||
name: "name",
|
||||
uid: "uid",
|
||||
networksAPI: tc.networksAPI,
|
||||
nodes: make(cloudtypes.Instances),
|
||||
coordinators: make(cloudtypes.Instances),
|
||||
workers: make(cloudtypes.Instances),
|
||||
controlPlanes: make(cloudtypes.Instances),
|
||||
}
|
||||
|
||||
if tc.wantErr {
|
||||
|
@ -102,8 +102,8 @@ func TestCreateSecurityGroup(t *testing.T) {
|
|||
location: "location",
|
||||
name: "name",
|
||||
uid: "uid",
|
||||
nodes: make(cloudtypes.Instances),
|
||||
coordinators: make(cloudtypes.Instances),
|
||||
workers: make(cloudtypes.Instances),
|
||||
controlPlanes: make(cloudtypes.Instances),
|
||||
networkSecurityGroupsAPI: tc.networkSecurityGroupsAPI,
|
||||
}
|
||||
|
||||
|
@ -152,8 +152,8 @@ func TestCreateNIC(t *testing.T) {
|
|||
location: "location",
|
||||
name: "name",
|
||||
uid: "uid",
|
||||
nodes: make(cloudtypes.Instances),
|
||||
coordinators: make(cloudtypes.Instances),
|
||||
workers: make(cloudtypes.Instances),
|
||||
controlPlanes: make(cloudtypes.Instances),
|
||||
networkInterfacesAPI: tc.networkInterfacesAPI,
|
||||
}
|
||||
|
||||
|
@ -201,8 +201,8 @@ func TestCreatePublicIPAddress(t *testing.T) {
|
|||
location: "location",
|
||||
name: "name",
|
||||
uid: "uid",
|
||||
nodes: make(cloudtypes.Instances),
|
||||
coordinators: make(cloudtypes.Instances),
|
||||
workers: make(cloudtypes.Instances),
|
||||
controlPlanes: make(cloudtypes.Instances),
|
||||
publicIPAddressesAPI: tc.publicIPAddressesAPI,
|
||||
}
|
||||
|
||||
|
@ -256,8 +256,8 @@ func TestCreateExternalLoadBalancer(t *testing.T) {
|
|||
location: "location",
|
||||
name: "name",
|
||||
uid: "uid",
|
||||
nodes: make(cloudtypes.Instances),
|
||||
coordinators: make(cloudtypes.Instances),
|
||||
workers: make(cloudtypes.Instances),
|
||||
controlPlanes: make(cloudtypes.Instances),
|
||||
loadBalancersAPI: tc.loadBalancersAPI,
|
||||
publicIPAddressesAPI: tc.publicIPAddressesAPI,
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ func (l LoadBalancer) Azure() armnetwork.LoadBalancer {
|
|||
Name: to.StringPtr(coordHealthProbeName),
|
||||
Properties: &armnetwork.ProbePropertiesFormat{
|
||||
Protocol: armnetwork.ProbeProtocolTCP.ToPtr(),
|
||||
Port: to.Int32Ptr(int32(constants.CoordinatorPort)),
|
||||
Port: to.Int32Ptr(int32(constants.BootstrapperPort)),
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -134,8 +134,8 @@ func (l LoadBalancer) Azure() armnetwork.LoadBalancer {
|
|||
FrontendIPConfiguration: &armnetwork.SubResource{
|
||||
ID: to.StringPtr("/subscriptions/" + l.Subscription + "/resourceGroups/" + l.ResourceGroup + "/providers/Microsoft.Network/loadBalancers/" + l.Name + "/frontendIPConfigurations/" + frontEndIPConfigName),
|
||||
},
|
||||
FrontendPort: to.Int32Ptr(int32(constants.CoordinatorPort)),
|
||||
BackendPort: to.Int32Ptr(int32(constants.CoordinatorPort)),
|
||||
FrontendPort: to.Int32Ptr(int32(constants.BootstrapperPort)),
|
||||
BackendPort: to.Int32Ptr(int32(constants.BootstrapperPort)),
|
||||
Protocol: armnetwork.TransportProtocolTCP.ToPtr(),
|
||||
Probe: &armnetwork.SubResource{
|
||||
ID: to.StringPtr("/subscriptions/" + l.Subscription + "/resourceGroups/" + l.ResourceGroup + "/providers/Microsoft.Network/loadBalancers/" + l.Name + "/probes/" + coordHealthProbeName),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue