Enable GCP serial console for debug mode (#162)

Signed-off-by: Daniel Weiße <dw@edgeless.systems>
This commit is contained in:
Daniel Weiße 2022-09-19 15:21:33 +02:00 committed by GitHub
parent d0ba2eb6b7
commit 9c00f4efc2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 14 deletions

View File

@ -138,6 +138,7 @@ func (c *Creator) createGCP(ctx context.Context, cl gcpclient, config *config.Co
}
createInput := gcpcl.CreateInstancesInput{
EnableSerialConsole: config.IsDebugCluster(),
CountControlPlanes: controlPlaneCount,
CountWorkers: workerCount,
ImageID: config.Provider.GCP.Image,

View File

@ -10,6 +10,7 @@ import (
"context"
"errors"
"fmt"
"strconv"
"strings"
"time"
@ -32,11 +33,14 @@ func (c *Client) CreateInstances(ctx context.Context, input CreateInstancesInput
}
ops := []Operation{}
enableSerialConsole := strconv.FormatBool(input.EnableSerialConsole)
workerTemplateInput := insertInstanceTemplateInput{
Name: c.buildResourceName("worker"),
Network: c.network,
SecondarySubnetworkRangeName: c.secondarySubnetworkRange,
Subnetwork: c.subnetwork,
EnableSerialConsole: enableSerialConsole,
ImageID: input.ImageID,
InstanceType: input.InstanceType,
StateDiskSizeGB: int64(input.StateDiskSizeGB),
@ -60,6 +64,7 @@ func (c *Client) CreateInstances(ctx context.Context, input CreateInstancesInput
Network: c.network,
Subnetwork: c.subnetwork,
SecondarySubnetworkRangeName: c.secondarySubnetworkRange,
EnableSerialConsole: enableSerialConsole,
ImageID: input.ImageID,
InstanceType: input.InstanceType,
StateDiskSizeGB: int64(input.StateDiskSizeGB),
@ -317,6 +322,7 @@ func (i *instanceGroupManagerInput) InsertInstanceGroupManagerRequest() computep
// CreateInstancesInput is the input for a CreatInstances operation.
type CreateInstancesInput struct {
EnableSerialConsole bool
CountWorkers int
CountControlPlanes int
ImageID string
@ -331,6 +337,7 @@ type insertInstanceTemplateInput struct {
Network string
Subnetwork string
SecondarySubnetworkRangeName string
EnableSerialConsole string
ImageID string
InstanceType string
StateDiskSizeGB int64
@ -389,6 +396,10 @@ func (i insertInstanceTemplateInput) insertInstanceTemplateRequest() *computepb.
Key: proto.String("constellation-role"),
Value: proto.String(i.Role),
},
{
Key: proto.String("serial-port-enable"),
Value: proto.String(i.EnableSerialConsole),
},
},
},
NetworkInterfaces: []*computepb.NetworkInterface{