istio: istio.io/istio/pkg/bootstrap/platform Index | Files

package platform

import "istio.io/istio/pkg/bootstrap/platform"

Index

Package Files

aws.go azure.go discovery.go gcp.go platform.go

Constants

const (
    AWSRegion           = "aws_region"
    AWSAvailabilityZone = "aws_availability_zone"
    AWSInstanceID       = "aws_instance_id"
    AWSAccountID        = "aws_account_id"
)
const (
    AzureMetadataEndpoint  = "http://169.254.169.254"
    AzureInstanceURL       = AzureMetadataEndpoint + "/metadata/instance"
    AzureDefaultAPIVersion = "2019-08-15"
    SysVendorPath          = "/sys/class/dmi/id/sys_vendor"
    MicrosoftIdentifier    = "Microsoft Corporation"

    AzureName     = "azure_name"
    AzureLocation = "azure_location"
    AzureVMID     = "azure_vm_id"
)
const (
    GCPProject           = "gcp_project"
    GCPProjectNumber     = "gcp_project_number"
    GCPCluster           = "gcp_gke_cluster_name"
    GCPLocation          = "gcp_location"
    GCEInstance          = "gcp_gce_instance"
    GCEInstanceID        = "gcp_gce_instance_id"
    GCEInstanceTemplate  = "gcp_gce_instance_template"
    GCEInstanceCreatedBy = "gcp_gce_instance_created_by"
)
const (
    KubernetesServiceHost = "KUBERNETES_SERVICE_HOST"
)
const Platforms = 3

func IsAWS Uses

func IsAWS() bool

IsAWS returns whether or not the platform for bootstrapping is Amazon Web Services.

func IsAzure Uses

func IsAzure() bool

IsAzure returns whether or not the platform for bootstrapping is Azure Checks the system vendor file (similar to https://github.com/banzaicloud/satellite/blob/master/providers/azure.go)

func IsGCP Uses

func IsGCP() bool

IsGCP returns whether or not the platform for bootstrapping is Google Cloud Platform.

type Environment Uses

type Environment interface {
    // Metadata returns a collection of environmental metadata, structured
    // as a map for metadata names to values. An example for GCP would be a
    // mapping from "gcp_project" to "2344534543". Keys should be prefixed
    // by the short name for the platform (example: "gcp_").
    Metadata() map[string]string

    // Locality returns the run location for the bootstrap transformed from the
    // platform-specific representation into the Envoy Locality schema.
    Locality() *core.Locality

    // Labels returns a collection of labels that exist on the underlying
    // instance, structured as a map for label name to values.
    Labels() map[string]string

    // IsKubernetes determines if running on Kubernetes
    IsKubernetes() bool
}

Environment provides information for the platform on which the bootstrapping is taking place.

func Discover Uses

func Discover() Environment

Discover attempts to discover the host platform, defaulting to `Unknown` if a platform cannot be discovered.

func DiscoverWithTimeout Uses

func DiscoverWithTimeout(timeout time.Duration) Environment

DiscoverWithTimeout attempts to discover the host platform, defaulting to `Unknown` after the provided timeout.

func NewAWS Uses

func NewAWS() Environment

NewAWS returns a platform environment customized for AWS. Metadata returned by the AWS Environment is taken from the EC2 metadata service.

func NewAzure Uses

func NewAzure() Environment

NewAzure returns a platform environment for Azure

func NewGCP Uses

func NewGCP() Environment

NewGCP returns a platform environment customized for Google Cloud Platform. Metadata returned by the GCP Environment is taken from the GCE metadata service.

type Unknown Uses

type Unknown struct{}

Unknown provides a default platform environment for cases in which the platform on which the bootstrapping is taking place cannot be determined.

func (*Unknown) IsKubernetes Uses

func (*Unknown) IsKubernetes() bool

IsKubernetes is true to avoid label collisions

func (*Unknown) Labels Uses

func (*Unknown) Labels() map[string]string

Labels returns an empty map.

func (*Unknown) Locality Uses

func (*Unknown) Locality() *core.Locality

Locality returns an empty core.Locality struct.

func (*Unknown) Metadata Uses

func (*Unknown) Metadata() map[string]string

Metadata returns an empty map.

Package platform imports 20 packages (graph) and is imported by 4 packages. Updated 2020-08-05. Refresh now. Tools for package owners.