mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-10-01 01:36:09 -04:00
create state disk on constellation create
This commit is contained in:
parent
ede83bd555
commit
daf2280e3f
@ -17,6 +17,7 @@ func (c *Client) CreateInstances(ctx context.Context, input CreateInstancesInput
|
|||||||
NamePrefix: c.name + "-worker-" + c.uid + "-",
|
NamePrefix: c.name + "-worker-" + c.uid + "-",
|
||||||
Count: input.Count - 1,
|
Count: input.Count - 1,
|
||||||
InstanceType: input.InstanceType,
|
InstanceType: input.InstanceType,
|
||||||
|
StateDiskSizeGB: int32(input.StateDiskSizeGB),
|
||||||
Image: input.Image,
|
Image: input.Image,
|
||||||
UserAssingedIdentity: input.UserAssingedIdentity,
|
UserAssingedIdentity: input.UserAssingedIdentity,
|
||||||
}
|
}
|
||||||
@ -33,6 +34,7 @@ func (c *Client) CreateInstances(ctx context.Context, input CreateInstancesInput
|
|||||||
NamePrefix: c.name + "-control-plane-" + c.uid + "-",
|
NamePrefix: c.name + "-control-plane-" + c.uid + "-",
|
||||||
Count: 1,
|
Count: 1,
|
||||||
InstanceType: input.InstanceType,
|
InstanceType: input.InstanceType,
|
||||||
|
StateDiskSizeGB: int32(input.StateDiskSizeGB),
|
||||||
Image: input.Image,
|
Image: input.Image,
|
||||||
UserAssingedIdentity: input.UserAssingedIdentity,
|
UserAssingedIdentity: input.UserAssingedIdentity,
|
||||||
}
|
}
|
||||||
@ -63,6 +65,7 @@ func (c *Client) CreateInstances(ctx context.Context, input CreateInstancesInput
|
|||||||
type CreateInstancesInput struct {
|
type CreateInstancesInput struct {
|
||||||
Count int
|
Count int
|
||||||
InstanceType string
|
InstanceType string
|
||||||
|
StateDiskSizeGB int
|
||||||
Image string
|
Image string
|
||||||
UserAssingedIdentity string
|
UserAssingedIdentity string
|
||||||
}
|
}
|
||||||
@ -165,6 +168,7 @@ func (c *Client) createScaleSet(ctx context.Context, input CreateScaleSetInput)
|
|||||||
NamePrefix: input.NamePrefix,
|
NamePrefix: input.NamePrefix,
|
||||||
Location: c.location,
|
Location: c.location,
|
||||||
InstanceType: input.InstanceType,
|
InstanceType: input.InstanceType,
|
||||||
|
StateDiskSizeGB: input.StateDiskSizeGB,
|
||||||
Count: int64(input.Count),
|
Count: int64(input.Count),
|
||||||
Username: "constellation",
|
Username: "constellation",
|
||||||
SubnetID: c.subnetID,
|
SubnetID: c.subnetID,
|
||||||
@ -239,6 +243,7 @@ type CreateScaleSetInput struct {
|
|||||||
NamePrefix string
|
NamePrefix string
|
||||||
Count int
|
Count int
|
||||||
InstanceType string
|
InstanceType string
|
||||||
|
StateDiskSizeGB int32
|
||||||
Image string
|
Image string
|
||||||
UserAssingedIdentity string
|
UserAssingedIdentity string
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ type ScaleSet struct {
|
|||||||
NamePrefix string
|
NamePrefix string
|
||||||
Location string
|
Location string
|
||||||
InstanceType string
|
InstanceType string
|
||||||
|
StateDiskSizeGB int32
|
||||||
Count int64
|
Count int64
|
||||||
Username string
|
Username string
|
||||||
SubnetID string
|
SubnetID string
|
||||||
@ -52,6 +53,13 @@ func (s ScaleSet) Azure() armcompute.VirtualMachineScaleSet {
|
|||||||
ImageReference: &armcompute.ImageReference{
|
ImageReference: &armcompute.ImageReference{
|
||||||
ID: to.StringPtr(s.Image),
|
ID: to.StringPtr(s.Image),
|
||||||
},
|
},
|
||||||
|
DataDisks: []*armcompute.VirtualMachineScaleSetDataDisk{
|
||||||
|
{
|
||||||
|
CreateOption: armcompute.DiskCreateOptionTypesEmpty.ToPtr(),
|
||||||
|
DiskSizeGB: to.Int32Ptr(s.StateDiskSizeGB),
|
||||||
|
Lun: to.Int32Ptr(0),
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{
|
NetworkProfile: &armcompute.VirtualMachineScaleSetNetworkProfile{
|
||||||
NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{
|
NetworkInterfaceConfigurations: []*armcompute.VirtualMachineScaleSetNetworkConfiguration{
|
||||||
|
@ -105,6 +105,7 @@ func createAzure(cmd *cobra.Command, cl azureclient, fileHandler file.Handler, c
|
|||||||
if err := cl.CreateInstances(cmd.Context(), client.CreateInstancesInput{
|
if err := cl.CreateInstances(cmd.Context(), client.CreateInstancesInput{
|
||||||
Count: count,
|
Count: count,
|
||||||
InstanceType: size,
|
InstanceType: size,
|
||||||
|
StateDiskSizeGB: *config.StateDiskSizeGB,
|
||||||
Image: *config.Provider.Azure.Image,
|
Image: *config.Provider.Azure.Image,
|
||||||
UserAssingedIdentity: *config.Provider.Azure.UserAssignedIdentity,
|
UserAssingedIdentity: *config.Provider.Azure.UserAssignedIdentity,
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
|
@ -68,11 +68,12 @@ func createGCP(cmd *cobra.Command, cl gcpclient, fileHandler file.Handler, confi
|
|||||||
}
|
}
|
||||||
|
|
||||||
createInput := client.CreateInstancesInput{
|
createInput := client.CreateInstancesInput{
|
||||||
Count: count,
|
Count: count,
|
||||||
ImageId: *config.Provider.GCP.Image,
|
ImageId: *config.Provider.GCP.Image,
|
||||||
InstanceType: size,
|
InstanceType: size,
|
||||||
KubeEnv: gcp.KubeEnv,
|
StateDiskSizeGB: *config.StateDiskSizeGB,
|
||||||
DisableCVM: *config.Provider.GCP.DisableCVM,
|
KubeEnv: gcp.KubeEnv,
|
||||||
|
DisableCVM: *config.Provider.GCP.DisableCVM,
|
||||||
}
|
}
|
||||||
|
|
||||||
ok, err := cmd.Flags().GetBool("yes")
|
ok, err := cmd.Flags().GetBool("yes")
|
||||||
|
@ -31,6 +31,7 @@ func (c *Client) CreateInstances(ctx context.Context, input CreateInstancesInput
|
|||||||
Subnetwork: c.subnetwork,
|
Subnetwork: c.subnetwork,
|
||||||
ImageId: input.ImageId,
|
ImageId: input.ImageId,
|
||||||
InstanceType: input.InstanceType,
|
InstanceType: input.InstanceType,
|
||||||
|
StateDiskSizeGB: int64(input.StateDiskSizeGB),
|
||||||
KubeEnv: input.KubeEnv,
|
KubeEnv: input.KubeEnv,
|
||||||
Project: c.project,
|
Project: c.project,
|
||||||
Zone: c.zone,
|
Zone: c.zone,
|
||||||
@ -46,17 +47,18 @@ func (c *Client) CreateInstances(ctx context.Context, input CreateInstancesInput
|
|||||||
c.nodeTemplate = nodeTemplateInput.Name
|
c.nodeTemplate = nodeTemplateInput.Name
|
||||||
|
|
||||||
coordinatorTemplateInput := insertInstanceTemplateInput{
|
coordinatorTemplateInput := insertInstanceTemplateInput{
|
||||||
Name: c.name + "-control-plane-" + c.uid,
|
Name: c.name + "-control-plane-" + c.uid,
|
||||||
Network: c.network,
|
Network: c.network,
|
||||||
Subnetwork: c.subnetwork,
|
Subnetwork: c.subnetwork,
|
||||||
ImageId: input.ImageId,
|
ImageId: input.ImageId,
|
||||||
InstanceType: input.InstanceType,
|
InstanceType: input.InstanceType,
|
||||||
KubeEnv: input.KubeEnv,
|
StateDiskSizeGB: int64(input.StateDiskSizeGB),
|
||||||
Project: c.project,
|
KubeEnv: input.KubeEnv,
|
||||||
Zone: c.zone,
|
Project: c.project,
|
||||||
Region: c.region,
|
Zone: c.zone,
|
||||||
UID: c.uid,
|
Region: c.region,
|
||||||
DisableCVM: input.DisableCVM,
|
UID: c.uid,
|
||||||
|
DisableCVM: input.DisableCVM,
|
||||||
}
|
}
|
||||||
op, err = c.insertInstanceTemplate(ctx, coordinatorTemplateInput)
|
op, err = c.insertInstanceTemplate(ctx, coordinatorTemplateInput)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -285,11 +287,12 @@ func (i *instanceGroupManagerInput) InsertInstanceGroupManagerRequest() computep
|
|||||||
|
|
||||||
// CreateInstancesInput is the input for a CreatInstances operation.
|
// CreateInstancesInput is the input for a CreatInstances operation.
|
||||||
type CreateInstancesInput struct {
|
type CreateInstancesInput struct {
|
||||||
Count int
|
Count int
|
||||||
ImageId string
|
ImageId string
|
||||||
InstanceType string
|
InstanceType string
|
||||||
KubeEnv string
|
StateDiskSizeGB int
|
||||||
DisableCVM bool
|
KubeEnv string
|
||||||
|
DisableCVM bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type insertInstanceTemplateInput struct {
|
type insertInstanceTemplateInput struct {
|
||||||
@ -299,6 +302,7 @@ type insertInstanceTemplateInput struct {
|
|||||||
SecondarySubnetworkRangeName string
|
SecondarySubnetworkRangeName string
|
||||||
ImageId string
|
ImageId string
|
||||||
InstanceType string
|
InstanceType string
|
||||||
|
StateDiskSizeGB int64
|
||||||
KubeEnv string
|
KubeEnv string
|
||||||
Project string
|
Project string
|
||||||
Zone string
|
Zone string
|
||||||
@ -327,6 +331,15 @@ func (i insertInstanceTemplateInput) insertInstanceTemplateRequest() *computepb.
|
|||||||
Boot: proto.Bool(true),
|
Boot: proto.Bool(true),
|
||||||
Mode: proto.String(computepb.AttachedDisk_READ_WRITE.String()),
|
Mode: proto.String(computepb.AttachedDisk_READ_WRITE.String()),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
InitializeParams: &computepb.AttachedDiskInitializeParams{
|
||||||
|
DiskSizeGb: proto.Int64(i.StateDiskSizeGB),
|
||||||
|
},
|
||||||
|
AutoDelete: proto.Bool(true),
|
||||||
|
DeviceName: proto.String("state-disk"),
|
||||||
|
Mode: proto.String(computepb.AttachedDisk_READ_WRITE.String()),
|
||||||
|
Type: proto.String(computepb.AttachedDisk_PERSISTENT.String()),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
MachineType: proto.String(i.InstanceType),
|
MachineType: proto.String(i.InstanceType),
|
||||||
Metadata: &computepb.Metadata{
|
Metadata: &computepb.Metadata{
|
||||||
|
@ -53,6 +53,7 @@ type Config struct {
|
|||||||
CoordinatorPort *string `json:"coordinatorport,omitempty"`
|
CoordinatorPort *string `json:"coordinatorport,omitempty"`
|
||||||
AutoscalingNodeGroupsMin *int `json:"autoscalingnodegroupsmin,omitempty"`
|
AutoscalingNodeGroupsMin *int `json:"autoscalingnodegroupsmin,omitempty"`
|
||||||
AutoscalingNodeGroupsMax *int `json:"autoscalingnodegroupsmax,omitempty"`
|
AutoscalingNodeGroupsMax *int `json:"autoscalingnodegroupsmax,omitempty"`
|
||||||
|
StateDiskSizeGB *int `json:"statedisksizegb,omitempty"`
|
||||||
Provider *ProviderConfig `json:"provider,omitempty"`
|
Provider *ProviderConfig `json:"provider,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,6 +67,7 @@ func Default() *Config {
|
|||||||
CoordinatorPort: proto.String(strconv.Itoa(coordinatorPort)),
|
CoordinatorPort: proto.String(strconv.Itoa(coordinatorPort)),
|
||||||
AutoscalingNodeGroupsMin: intPtr(1),
|
AutoscalingNodeGroupsMin: intPtr(1),
|
||||||
AutoscalingNodeGroupsMax: intPtr(10),
|
AutoscalingNodeGroupsMax: intPtr(10),
|
||||||
|
StateDiskSizeGB: intPtr(30),
|
||||||
Provider: &ProviderConfig{
|
Provider: &ProviderConfig{
|
||||||
EC2: &EC2Config{
|
EC2: &EC2Config{
|
||||||
Image: proto.String("ami-07d3864beb84157d3"),
|
Image: proto.String("ami-07d3864beb84157d3"),
|
||||||
|
Loading…
Reference in New Issue
Block a user