mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-10-01 01:36:09 -04:00
aws: name instances for CCM
This commit is contained in:
parent
0d0191ba4d
commit
1f9a788c21
@ -96,17 +96,13 @@ func (m *Metadata) Self(ctx context.Context) (metadata.InstanceMetadata, error)
|
||||
return metadata.InstanceMetadata{}, fmt.Errorf("retrieving instance identity: %w", err)
|
||||
}
|
||||
|
||||
name, err := readInstanceTag(ctx, m.imds, tagName)
|
||||
if err != nil {
|
||||
return metadata.InstanceMetadata{}, fmt.Errorf("retrieving name tag: %w", err)
|
||||
}
|
||||
instanceRole, err := readInstanceTag(ctx, m.imds, cloud.TagRole)
|
||||
if err != nil {
|
||||
return metadata.InstanceMetadata{}, fmt.Errorf("retrieving role tag: %w", err)
|
||||
}
|
||||
|
||||
return metadata.InstanceMetadata{
|
||||
Name: name,
|
||||
Name: identity.InstanceID,
|
||||
ProviderID: fmt.Sprintf("aws:///%s/%s", identity.AvailabilityZone, identity.InstanceID),
|
||||
Role: role.FromString(instanceRole),
|
||||
VPCIP: identity.PrivateIP,
|
||||
|
@ -47,12 +47,11 @@ func TestSelf(t *testing.T) {
|
||||
},
|
||||
},
|
||||
tags: map[string]string{
|
||||
tagName: "test-instance",
|
||||
cloud.TagRole: "controlplane",
|
||||
},
|
||||
},
|
||||
wantSelf: metadata.InstanceMetadata{
|
||||
Name: "test-instance",
|
||||
Name: "test-instance-id",
|
||||
ProviderID: "aws:///test-zone/test-instance-id",
|
||||
Role: role.ControlPlane,
|
||||
VPCIP: "192.0.2.1",
|
||||
@ -68,12 +67,11 @@ func TestSelf(t *testing.T) {
|
||||
},
|
||||
},
|
||||
tags: map[string]string{
|
||||
tagName: "test-instance",
|
||||
cloud.TagRole: "worker",
|
||||
},
|
||||
},
|
||||
wantSelf: metadata.InstanceMetadata{
|
||||
Name: "test-instance",
|
||||
Name: "test-instance-id",
|
||||
ProviderID: "aws:///test-zone/test-instance-id",
|
||||
Role: role.Worker,
|
||||
VPCIP: "192.0.2.1",
|
||||
@ -102,21 +100,6 @@ func TestSelf(t *testing.T) {
|
||||
},
|
||||
wantErr: true,
|
||||
},
|
||||
"name not set": {
|
||||
imds: &stubIMDS{
|
||||
instanceDocumentResp: &imds.GetInstanceIdentityDocumentOutput{
|
||||
InstanceIdentityDocument: imds.InstanceIdentityDocument{
|
||||
InstanceID: "test-instance-id",
|
||||
AvailabilityZone: "test-zone",
|
||||
PrivateIP: "192.0.2.1",
|
||||
},
|
||||
},
|
||||
tags: map[string]string{
|
||||
cloud.TagRole: "controlplane",
|
||||
},
|
||||
},
|
||||
wantErr: true,
|
||||
},
|
||||
"role not set": {
|
||||
imds: &stubIMDS{
|
||||
instanceDocumentResp: &imds.GetInstanceIdentityDocumentOutput{
|
||||
|
Loading…
Reference in New Issue
Block a user