Documentation ¶
Index ¶
- Constants
- Variables
- func MustGet(m MetadataProvider, key MetadataKey) string
- type ECSMetadata
- type ENVMetadata
- type EcsFetcher
- type FakeProvider
- type HttpStatusError
- type InstanceIdentityDocument
- type KubernetesNodeMetadata
- type KubernetesNodeMetadataFetcher
- type Metadata
- type MetadataFetcher
- type MetadataKey
- type MetadataProvider
- type OpenAPIFetcher
- type OpenAPIMetadata
- type ProfileFetcher
- type ProfileMetadata
Constants ¶
View Source
const ( ECSMetadataEndpoint = "http://100.100.100.200/latest/" ECSIdentityEndpoint = ECSMetadataEndpoint + "dynamic/instance-identity/document" ECSTokenEndpoint = ECSMetadataEndpoint + "api/token" )
View Source
const DISABLE_ECS_ENV = "ALIBABA_CLOUD_NO_ECS_METADATA"
View Source
const KUBE_NODE_NAME_ENV = "KUBE_NODE_NAME"
Variables ¶
View Source
var ( RegionIDLabels = []string{ "topology.kubernetes.io/region", "failure-domain.beta.kubernetes.io/region", "alibabacloud.com/ecs-region-id", "sigma.ali/ecs-region-id", } ZoneIDLabels = []string{ "topology.kubernetes.io/zone", "failure-domain.beta.kubernetes.io/zone", "alibabacloud.com/ecs-zone-id", "sigma.ali/ecs-zone-id", } InstanceTypeLabels = []string{ "node.kubernetes.io/instance-type", "beta.kubernetes.io/instance-type", "sigma.ali/machine-model", } InstanceIdLabels = []string{ "alibabacloud.com/instance-id", "alibabacloud.com/ecs-instance-id", "sigma.ali/ecs-instance-id", } VmocLabels = []string{ "rm.alibaba-inc.com/vbm", } )
View Source
var ErrInvalidIdentityDoc = errors.New("invalid ECS instance identity document")
View Source
var ErrUnknownMetadataKey = errors.New("unknown metadata key")
View Source
var MetadataEnv = map[MetadataKey]string{
RegionID: "REGION_ID",
AccountID: "ALIBABA_CLOUD_ACCOUNT_ID",
ClusterID: "CLUSTER_ID",
}
View Source
var MetadataLabels = map[MetadataKey][]string{ RegionID: RegionIDLabels, ZoneID: ZoneIDLabels, InstanceType: InstanceTypeLabels, InstanceID: InstanceIdLabels, VmocType: VmocLabels, }
View Source
var MetadataProfileDataKeys = map[MetadataKey]string{
ClusterID: "clusterid",
AccountID: "uid",
}
Functions ¶
func MustGet ¶
func MustGet(m MetadataProvider, key MetadataKey) string
Types ¶
type ECSMetadata ¶
type ECSMetadata struct {
// contains filtered or unexported fields
}
func NewECSMetadata ¶
func NewECSMetadata(httpRT http.RoundTripper) (*ECSMetadata, error)
func (*ECSMetadata) Get ¶
func (m *ECSMetadata) Get(key MetadataKey) (string, error)
type ENVMetadata ¶
type ENVMetadata struct{}
func (*ENVMetadata) Get ¶
func (m *ENVMetadata) Get(key MetadataKey) (string, error)
type EcsFetcher ¶
type EcsFetcher struct {
// contains filtered or unexported fields
}
func (*EcsFetcher) FetchFor ¶
func (f *EcsFetcher) FetchFor(key MetadataKey) (MetadataProvider, error)
type FakeProvider ¶ added in v1.4.0
type FakeProvider struct {
Values map[MetadataKey]string
}
FakeProvider is a fake metadata provider for testing
func (FakeProvider) Get ¶ added in v1.4.0
func (p FakeProvider) Get(key MetadataKey) (string, error)
type HttpStatusError ¶ added in v1.6.0
type HttpStatusError struct {
StatusCode int
}
func (HttpStatusError) Error ¶ added in v1.6.0
func (e HttpStatusError) Error() string
func (HttpStatusError) Retryable ¶ added in v1.6.0
func (e HttpStatusError) Retryable() bool
type KubernetesNodeMetadata ¶
type KubernetesNodeMetadata struct {
// contains filtered or unexported fields
}
func NewKubernetesNodeMetadata ¶
func NewKubernetesNodeMetadata(nodeName string, nodeClient corev1.NodeInterface) (*KubernetesNodeMetadata, error)
func (*KubernetesNodeMetadata) Get ¶
func (m *KubernetesNodeMetadata) Get(key MetadataKey) (string, error)
type KubernetesNodeMetadataFetcher ¶ added in v1.6.0
type KubernetesNodeMetadataFetcher struct {
// contains filtered or unexported fields
}
func (*KubernetesNodeMetadataFetcher) FetchFor ¶ added in v1.6.0
func (f *KubernetesNodeMetadataFetcher) FetchFor(key MetadataKey) (MetadataProvider, error)
type Metadata ¶
type Metadata struct {
// contains filtered or unexported fields
}
func NewMetadata ¶
func NewMetadata() *Metadata
func (*Metadata) EnableEcs ¶
func (m *Metadata) EnableEcs(httpRT http.RoundTripper)
func (*Metadata) EnableKubernetes ¶
func (m *Metadata) EnableKubernetes(client kubernetes.Interface)
func (*Metadata) EnableOpenAPI ¶
func (m *Metadata) EnableOpenAPI(ecsClient cloud.ECSInterface, stsClient cloud.STSInterface)
type MetadataFetcher ¶
type MetadataFetcher interface {
FetchFor(key MetadataKey) (MetadataProvider, error)
}
type MetadataKey ¶
type MetadataKey int
const ( RegionID MetadataKey = iota ZoneID InstanceID InstanceType AccountID ClusterID VmocType )
func (MetadataKey) String ¶
func (k MetadataKey) String() string
type MetadataProvider ¶
type MetadataProvider interface {
Get(key MetadataKey) (string, error)
}
type OpenAPIFetcher ¶
type OpenAPIFetcher struct {
// contains filtered or unexported fields
}
func (*OpenAPIFetcher) FetchFor ¶
func (f *OpenAPIFetcher) FetchFor(key MetadataKey) (MetadataProvider, error)
type OpenAPIMetadata ¶
type OpenAPIMetadata struct {
// contains filtered or unexported fields
}
func NewOpenAPIMetadata ¶
func NewOpenAPIMetadata(c cloud.ECSInterface, s cloud.STSInterface, regionId, instanceId string) (*OpenAPIMetadata, error)
func (*OpenAPIMetadata) Get ¶
func (m *OpenAPIMetadata) Get(key MetadataKey) (string, error)
type ProfileFetcher ¶ added in v1.6.0
type ProfileFetcher struct {
// contains filtered or unexported fields
}
func (*ProfileFetcher) FetchFor ¶ added in v1.6.0
func (f *ProfileFetcher) FetchFor(key MetadataKey) (MetadataProvider, error)
type ProfileMetadata ¶ added in v1.6.0
type ProfileMetadata struct {
// contains filtered or unexported fields
}
func NewProfileMetadata ¶ added in v1.6.0
func NewProfileMetadata(client kubernetes.Interface) (*ProfileMetadata, error)
func (*ProfileMetadata) Get ¶ added in v1.6.0
func (m *ProfileMetadata) Get(key MetadataKey) (string, error)
Click to show internal directories.
Click to hide internal directories.