Add constellation UID retrieval to cloudprovider metadata APIs

Signed-off-by: Malte Poll <mp@edgeless.systems>
This commit is contained in:
Malte Poll 2022-07-29 16:30:24 +02:00 committed by Malte Poll
parent 2f925b5955
commit 18a89d2881
7 changed files with 116 additions and 6 deletions

View file

@ -11,6 +11,8 @@ import (
// ProviderMetadata implementers read/write cloud provider metadata.
type ProviderMetadata interface {
// UID returns the unique identifier for the constellation.
UID(ctx context.Context) (string, error)
// List retrieves all instances belonging to the current Constellation.
List(ctx context.Context) ([]metadata.InstanceMetadata, error)
// Self retrieves the current instance.
@ -100,6 +102,9 @@ type stubProviderMetadata struct {
SupportedResp bool
SupportsLoadBalancerResp bool
UIDErr error
UIDResp string
}
func (m *stubProviderMetadata) GetLoadBalancerIP(ctx context.Context) (string, error) {
@ -130,6 +135,10 @@ func (m *stubProviderMetadata) SupportsLoadBalancer() bool {
return m.SupportsLoadBalancerResp
}
func (m *stubProviderMetadata) UID(ctx context.Context) (string, error) {
return m.UIDResp, m.UIDErr
}
type stubCloudControllerManager struct {
SupportedResp bool
}