constellation/bootstrapper/internal/kubernetes/cloud_provider.go
Malte Poll 8da6a23aa5
bootstrapper: add fallback endpoint and custom endpoint to SAN field (#2108)
terraform: collect apiserver cert SANs and support custom endpoint

constants: add new constants for cluster configuration and custom endpoint

cloud: support apiserver cert sans and prepare for endpoint migration on AWS

config: add customEndpoint field

bootstrapper: use per-CSP apiserver cert SANs

cli: route customEndpoint to terraform and add migration for apiserver cert SANs

bootstrapper: change interface of GetLoadBalancerEndpoint to return host and port separately
2023-07-21 16:43:51 +02:00

47 lines
1.3 KiB
Go

/*
Copyright (c) Edgeless Systems GmbH
SPDX-License-Identifier: AGPL-3.0-only
*/
package kubernetes
import (
"context"
"github.com/edgelesssys/constellation/v2/internal/cloud/metadata"
)
// ProviderMetadata implementers read/write cloud provider metadata.
type ProviderMetadata interface {
// UID returns the unique identifier for the constellation.
UID(ctx context.Context) (string, error)
// Self retrieves the current instance.
Self(ctx context.Context) (metadata.InstanceMetadata, error)
// GetLoadBalancerEndpoint retrieves the load balancer endpoint.
GetLoadBalancerEndpoint(ctx context.Context) (host, port string, err error)
}
type stubProviderMetadata struct {
getLoadBalancerEndpointErr error
getLoadBalancerHostResp, getLoadBalancerPortResp string
selfErr error
selfResp metadata.InstanceMetadata
uidErr error
uidResp string
}
func (m *stubProviderMetadata) GetLoadBalancerEndpoint(_ context.Context) (string, string, error) {
return m.getLoadBalancerHostResp, m.getLoadBalancerPortResp, m.getLoadBalancerEndpointErr
}
func (m *stubProviderMetadata) Self(_ context.Context) (metadata.InstanceMetadata, error) {
return m.selfResp, m.selfErr
}
func (m *stubProviderMetadata) UID(_ context.Context) (string, error) {
return m.uidResp, m.uidErr
}