mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-07-21 06:21:43 -04:00
GCP create: Embed constellation role in instance templates to allow role detection prior to node activation
This commit is contained in:
parent
2ba3c153de
commit
5d7bf86b30
1 changed files with 8 additions and 0 deletions
|
@ -8,6 +8,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/edgelesssys/constellation/cli/gcp"
|
"github.com/edgelesssys/constellation/cli/gcp"
|
||||||
|
"github.com/edgelesssys/constellation/coordinator/role"
|
||||||
"google.golang.org/api/iterator"
|
"google.golang.org/api/iterator"
|
||||||
computepb "google.golang.org/genproto/googleapis/cloud/compute/v1"
|
computepb "google.golang.org/genproto/googleapis/cloud/compute/v1"
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
|
@ -32,6 +33,7 @@ func (c *Client) CreateInstances(ctx context.Context, input CreateInstancesInput
|
||||||
ImageId: input.ImageId,
|
ImageId: input.ImageId,
|
||||||
InstanceType: input.InstanceType,
|
InstanceType: input.InstanceType,
|
||||||
StateDiskSizeGB: int64(input.StateDiskSizeGB),
|
StateDiskSizeGB: int64(input.StateDiskSizeGB),
|
||||||
|
Role: role.Node.String(),
|
||||||
KubeEnv: input.KubeEnv,
|
KubeEnv: input.KubeEnv,
|
||||||
Project: c.project,
|
Project: c.project,
|
||||||
Zone: c.zone,
|
Zone: c.zone,
|
||||||
|
@ -52,6 +54,7 @@ func (c *Client) CreateInstances(ctx context.Context, input CreateInstancesInput
|
||||||
ImageId: input.ImageId,
|
ImageId: input.ImageId,
|
||||||
InstanceType: input.InstanceType,
|
InstanceType: input.InstanceType,
|
||||||
StateDiskSizeGB: int64(input.StateDiskSizeGB),
|
StateDiskSizeGB: int64(input.StateDiskSizeGB),
|
||||||
|
Role: role.Coordinator.String(),
|
||||||
KubeEnv: input.KubeEnv,
|
KubeEnv: input.KubeEnv,
|
||||||
Project: c.project,
|
Project: c.project,
|
||||||
Zone: c.zone,
|
Zone: c.zone,
|
||||||
|
@ -301,6 +304,7 @@ type insertInstanceTemplateInput struct {
|
||||||
ImageId string
|
ImageId string
|
||||||
InstanceType string
|
InstanceType string
|
||||||
StateDiskSizeGB int64
|
StateDiskSizeGB int64
|
||||||
|
Role string
|
||||||
KubeEnv string
|
KubeEnv string
|
||||||
Project string
|
Project string
|
||||||
Zone string
|
Zone string
|
||||||
|
@ -349,6 +353,10 @@ func (i insertInstanceTemplateInput) insertInstanceTemplateRequest() *computepb.
|
||||||
Key: proto.String("constellation-uid"),
|
Key: proto.String("constellation-uid"),
|
||||||
Value: proto.String(i.UID),
|
Value: proto.String(i.UID),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Key: proto.String("constellation-role"),
|
||||||
|
Value: proto.String(i.Role),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
NetworkInterfaces: []*computepb.NetworkInterface{
|
NetworkInterfaces: []*computepb.NetworkInterface{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue