osc

package
v0.2.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 17, 2023 License: Apache-2.0 Imports: 47 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ProxyProtocolPolicyName is the tag named used for the proxy protocol
	// policy
	ProxyProtocolPolicyName = "k8s-proxyprotocol-enabled"

	// SSLNegotiationPolicyNameFormat is a format string used for the SSL
	// negotiation policy tag name
	SSLNegotiationPolicyNameFormat = "k8s-SSLNegotiationPolicy-%s"
)
View Source
const (
	// ResourceLifecycleOwned is the value we use when tagging resources to indicate
	// that the resource is considered owned and managed by the cluster,
	// and in particular that the lifecycle is tied to the lifecycle of the cluster.
	ResourceLifecycleOwned = "owned"
	// ResourceLifecycleShared is the value we use when tagging resources to indicate
	// that the resource is shared between multiple clusters, and should not be destroyed
	// if the cluster is destroyed.
	ResourceLifecycleShared = "shared"
)
View Source
const DefaultSgOwnerID = "outscale-elb"

DefaultSgOwnerID default SG Id used when creating LB Public Cloud

View Source
const DefaultSrcSgName = "outscale-elb-sg"

DefaultSrcSgName default SG Name used when creating LB Public Cloud

View Source
const LbNameMaxLength = int64(32)

LbNameMaxLength the load balancer name max length value.

View Source
const MaxReadThenCreateRetries = 30

MaxReadThenCreateRetries sets the maximum number of attempts we will make when we read to see if something exists and then try to create it if we didn't find it. This can fail once in a consistent system if done in parallel In an eventually consistent system, it could fail unboundedly

View Source
const NLBClientRuleDescription = "kubernetes.io/rule/nlb/client"

NLBClientRuleDescription is the comment used on a security group rule to indicate that it is used for client traffic

View Source
const NLBHealthCheckRuleDescription = "kubernetes.io/rule/nlb/health"

NLBHealthCheckRuleDescription is the comment used on a security group rule to indicate that it is used for health checks

View Source
const NLBMtuDiscoveryRuleDescription = "kubernetes.io/rule/nlb/mtu"

NLBMtuDiscoveryRuleDescription is the comment used on a security group rule to indicate that it is used for mtu discovery

View Source
const ProviderName = "osc"

ProviderName is the name of this cloud provider.

View Source
const ServiceAnnotationLoadBalancerAccessLogEmitInterval = "service.beta.kubernetes.io/aws-load-balancer-access-log-emit-interval"

ServiceAnnotationLoadBalancerAccessLogEmitInterval is the annotation used to specify access log emit interval.

View Source
const ServiceAnnotationLoadBalancerAccessLogEnabled = "service.beta.kubernetes.io/aws-load-balancer-access-log-enabled"

ServiceAnnotationLoadBalancerAccessLogEnabled is the annotation used on the service to enable or disable access logs.

View Source
const ServiceAnnotationLoadBalancerAccessLogS3BucketName = "service.beta.kubernetes.io/aws-load-balancer-access-log-s3-bucket-name"

ServiceAnnotationLoadBalancerAccessLogS3BucketName is the annotation used to specify access log s3 bucket name.

View Source
const ServiceAnnotationLoadBalancerAccessLogS3BucketPrefix = "service.beta.kubernetes.io/aws-load-balancer-access-log-s3-bucket-prefix"

ServiceAnnotationLoadBalancerAccessLogS3BucketPrefix is the annotation used to specify access log s3 bucket prefix.

View Source
const ServiceAnnotationLoadBalancerAdditionalTags = "service.beta.kubernetes.io/aws-load-balancer-additional-resource-tags"

ServiceAnnotationLoadBalancerAdditionalTags is the annotation used on the service to specify a comma-separated list of key-value pairs which will be recorded as additional tags in the ELB. For example: "Key1=Val1,Key2=Val2,KeyNoVal1=,KeyNoVal2"

View Source
const ServiceAnnotationLoadBalancerBEProtocol = "service.beta.kubernetes.io/aws-load-balancer-backend-protocol"

ServiceAnnotationLoadBalancerBEProtocol is the annotation used on the service to specify the protocol spoken by the backend (pod) behind a listener. If `http` (default) or `https`, an HTTPS listener that terminates the connection and parses headers is created. If set to `ssl` or `tcp`, a "raw" SSL listener is used. If set to `http` and `aws-load-balancer-ssl-cert` is not used then a HTTP listener is used.

View Source
const ServiceAnnotationLoadBalancerCertificate = "service.beta.kubernetes.io/aws-load-balancer-ssl-cert"

ServiceAnnotationLoadBalancerCertificate is the annotation used on the service to request a secure listener. Value is a valid certificate ARN. For more, see http://docs.aws.amazon.com/ElasticLoadBalancing/latest/DeveloperGuide/elb-listener-config.html CertARN is an IAM or CM certificate ARN, e.g. arn:aws:acm:us-east-1:123456789012:certificate/12345678-1234-1234-1234-123456789012

View Source
const ServiceAnnotationLoadBalancerConnectionDrainingEnabled = "service.beta.kubernetes.io/aws-load-balancer-connection-draining-enabled"

ServiceAnnotationLoadBalancerConnectionDrainingEnabled is the annnotation used on the service to enable or disable connection draining.

View Source
const ServiceAnnotationLoadBalancerConnectionDrainingTimeout = "service.beta.kubernetes.io/aws-load-balancer-connection-draining-timeout"

ServiceAnnotationLoadBalancerConnectionDrainingTimeout is the annotation used on the service to specify a connection draining timeout.

View Source
const ServiceAnnotationLoadBalancerConnectionIdleTimeout = "service.beta.kubernetes.io/aws-load-balancer-connection-idle-timeout"

ServiceAnnotationLoadBalancerConnectionIdleTimeout is the annotation used on the service to specify the idle connection timeout.

View Source
const ServiceAnnotationLoadBalancerCrossZoneLoadBalancingEnabled = "service.beta.kubernetes.io/aws-load-balancer-cross-zone-load-balancing-enabled"

ServiceAnnotationLoadBalancerCrossZoneLoadBalancingEnabled is the annotation used on the service to enable or disable cross-zone load balancing.

View Source
const ServiceAnnotationLoadBalancerExtraSecurityGroups = "service.beta.kubernetes.io/aws-load-balancer-extra-security-groups"

ServiceAnnotationLoadBalancerExtraSecurityGroups is the annotation used on the service to specify additional security groups to be added to ELB created

View Source
const ServiceAnnotationLoadBalancerHCHealthyThreshold = "service.beta.kubernetes.io/aws-load-balancer-healthcheck-healthy-threshold"

ServiceAnnotationLoadBalancerHCHealthyThreshold is the annotation used on the service to specify the number of successive successful health checks required for a backend to be considered healthy for traffic.

View Source
const ServiceAnnotationLoadBalancerHCInterval = "service.beta.kubernetes.io/aws-load-balancer-healthcheck-interval"

ServiceAnnotationLoadBalancerHCInterval is the annotation used on the service to specify, in seconds, the interval between health checks.

View Source
const ServiceAnnotationLoadBalancerHCTimeout = "service.beta.kubernetes.io/aws-load-balancer-healthcheck-timeout"

ServiceAnnotationLoadBalancerHCTimeout is the annotation used on the service to specify, in seconds, how long to wait before marking a health check as failed.

View Source
const ServiceAnnotationLoadBalancerHCUnhealthyThreshold = "service.beta.kubernetes.io/aws-load-balancer-healthcheck-unhealthy-threshold"

ServiceAnnotationLoadBalancerHCUnhealthyThreshold is the annotation used on the service to specify the number of unsuccessful health checks required for a backend to be considered unhealthy for traffic

View Source
const ServiceAnnotationLoadBalancerInternal = "service.beta.kubernetes.io/aws-load-balancer-internal"

ServiceAnnotationLoadBalancerInternal is the annotation used on the service to indicate that we want an internal ELB.

View Source
const ServiceAnnotationLoadBalancerName = "service.beta.kubernetes.io/osc-load-balancer-name"

ServiceAnnotationLoadBalancerName is the annotation used on the service to specify, the load balancer name max length is 32 else it will be truncated.

View Source
const ServiceAnnotationLoadBalancerNameLength = "service.beta.kubernetes.io/osc-load-balancer-name-length"

ServiceAnnotationLoadBalancerNameLength is the annotation used on the service to specify, the load balancer name length max value is 32.

View Source
const ServiceAnnotationLoadBalancerProxyProtocol = "service.beta.kubernetes.io/aws-load-balancer-proxy-protocol"

ServiceAnnotationLoadBalancerProxyProtocol is the annotation used on the service to enable the proxy protocol on an ELB. Right now we only accept the value "*" which means enable the proxy protocol on all ELB backends. In the future we could adjust this to allow setting the proxy protocol only on certain backends.

View Source
const ServiceAnnotationLoadBalancerSSLNegotiationPolicy = "service.beta.kubernetes.io/aws-load-balancer-ssl-negotiation-policy"

ServiceAnnotationLoadBalancerSSLNegotiationPolicy is the annotation used on the service to specify a SSL negotiation settings for the HTTPS/SSL listeners of your load balancer. Defaults to AWS's default

View Source
const ServiceAnnotationLoadBalancerSSLPorts = "service.beta.kubernetes.io/aws-load-balancer-ssl-ports"

ServiceAnnotationLoadBalancerSSLPorts is the annotation used on the service to specify a comma-separated list of ports that will use SSL/HTTPS listeners. Defaults to '*' (all).

View Source
const ServiceAnnotationLoadBalancerSecurityGroups = "service.beta.kubernetes.io/aws-load-balancer-security-groups"

ServiceAnnotationLoadBalancerSecurityGroups is the annotation used on the service to specify the security groups to be added to ELB created. Differently from the annotation "service.beta.kubernetes.io/aws-load-balancer-extra-security-groups", this replaces all other security groups previously assigned to the ELB.

View Source
const ServiceAnnotationLoadBalancerSubnetID = "service.beta.kubernetes.io/osc-load-balancer-subnet-id"

ServiceAnnotationLoadBalancerSubnetID is the annotation used on the service to specify, the subnet in which to create the load balancer.

View Source
const TagNameClusterNode = "OscK8sNodeName"

TagNameClusterNode logically independent clusters running in the same AZ. The tag key = OscK8sNodeName The tag value host name kubernetes.io/hostname

View Source
const TagNameKubernetesClusterLegacy = "project"

TagNameKubernetesClusterLegacy is the legacy tag name we use to differentiate multiple logically independent clusters running in the same AZ. The problem with it was that it did not allow shared resources.

View Source
const TagNameKubernetesClusterPrefix = "OscK8sClusterID/"

TagNameKubernetesClusterPrefix is the tag name we use to differentiate multiple logically independent clusters running in the same AZ. The tag key = TagNameKubernetesClusterPrefix + clusterID The tag value is an ownership value

View Source
const TagNameKubernetesService = "kubernetes.io/service-name"

TagNameKubernetesService is the tag name we use to differentiate multiple services. Used currently for ELBs only.

View Source
const TagNameMainSG = "OscK8sMainSG/"

TagNameMainSG The main sg Tag The tag key = OscK8sMainSG/clusterId The tag value = True

View Source
const TagNameSubnetInternalELB = "kubernetes.io/role/internal-elb"

TagNameSubnetInternalELB is the tag name used on a subnet to designate that it should be used for internal ELBs

View Source
const TagNameSubnetPublicELB = "kubernetes.io/role/elb"

TagNameSubnetPublicELB is the tag name used on a subnet to designate that it should be used for internet ELBs

Variables

This section is empty.

Functions

func Contains

func Contains(list []string, element string) bool

Contains checks if the element is present in the list

func Endpoint

func Endpoint(region string, service string) string

Endpoint builder for outscale

func NewSession

func NewSession(meta EC2Metadata) (*session.Session, error)

NewSession create a new session

func SetupMetadataResolver

func SetupMetadataResolver() endpoints.ResolverFunc

SetupMetadataResolver resolver for osc metadata service

func SetupServiceResolver

func SetupServiceResolver(region string) endpoints.ResolverFunc

SetupServiceResolver resolver for osc service

Types

type Backoff

type Backoff struct {
	// contains filtered or unexported fields
}

Backoff manages a backoff that varies based on the recently observed failures

func (*Backoff) ComputeDelayForRequest

func (b *Backoff) ComputeDelayForRequest(now time.Time) time.Duration

ComputeDelayForRequest computes the delay required for a request, also updates internal state to count this request

func (*Backoff) ReportError

func (b *Backoff) ReportError()

ReportError is called when we observe a throttling error

type Cloud

type Cloud struct {
	// contains filtered or unexported fields
}

Cloud is an implementation of Interface, LoadBalancer and Instances for Amazon Web Services.

func (*Cloud) AddSSHKeyToAllInstances

func (c *Cloud) AddSSHKeyToAllInstances(ctx context.Context, user string, keyData []byte) error

AddSSHKeyToAllInstances is currently not implemented.

func (*Cloud) Clusters

func (c *Cloud) Clusters() (cloudprovider.Clusters, bool)

Clusters returns the list of clusters.

func (*Cloud) CreateRoute

func (c *Cloud) CreateRoute(ctx context.Context, clusterName string, nameHint string, route *cloudprovider.Route) error

CreateRoute implements Routes.CreateRoute Create the described route

func (*Cloud) CurrentNodeName

func (c *Cloud) CurrentNodeName(ctx context.Context, hostname string) (types.NodeName, error)

CurrentNodeName returns the name of the current node

func (*Cloud) DeleteRoute

func (c *Cloud) DeleteRoute(ctx context.Context, clusterName string, route *cloudprovider.Route) error

DeleteRoute implements Routes.DeleteRoute Delete the specified route

func (*Cloud) EnsureLoadBalancer

func (c *Cloud) EnsureLoadBalancer(ctx context.Context, clusterName string, apiService *v1.Service,
	nodes []*v1.Node) (*v1.LoadBalancerStatus, error)

EnsureLoadBalancer implements LoadBalancer.EnsureLoadBalancer

func (*Cloud) EnsureLoadBalancerDeleted

func (c *Cloud) EnsureLoadBalancerDeleted(ctx context.Context, clusterName string, service *v1.Service) error

EnsureLoadBalancerDeleted implements LoadBalancer.EnsureLoadBalancerDeleted.

func (*Cloud) GetLoadBalancer

func (c *Cloud) GetLoadBalancer(ctx context.Context, clusterName string, service *v1.Service) (*v1.LoadBalancerStatus, bool, error)

GetLoadBalancer is an implementation of LoadBalancer.GetLoadBalancer

func (*Cloud) GetLoadBalancerName

func (c *Cloud) GetLoadBalancerName(ctx context.Context, clusterName string, service *v1.Service) string

GetLoadBalancerName is an implementation of LoadBalancer.GetLoadBalancerName

func (*Cloud) GetZone

func (c *Cloud) GetZone(ctx context.Context) (cloudprovider.Zone, error)

GetZone implements Zones.GetZone

func (*Cloud) GetZoneByNodeName

func (c *Cloud) GetZoneByNodeName(ctx context.Context, nodeName types.NodeName) (cloudprovider.Zone, error)

GetZoneByNodeName implements Zones.GetZoneByNodeName This is particularly useful in external cloud providers where the kubelet does not initialize node data.

func (*Cloud) GetZoneByProviderID

func (c *Cloud) GetZoneByProviderID(ctx context.Context, providerID string) (cloudprovider.Zone, error)

GetZoneByProviderID implements Zones.GetZoneByProviderID This is particularly useful in external cloud providers where the kubelet does not initialize node data.

func (*Cloud) HasClusterID

func (c *Cloud) HasClusterID() bool

HasClusterID returns true if the cluster has a clusterID

func (*Cloud) Initialize

func (c *Cloud) Initialize(clientBuilder cloudprovider.ControllerClientBuilder,
	stop <-chan struct{})

Initialize passes a Kubernetes clientBuilder interface to the cloud provider

func (*Cloud) InstanceExistsByProviderID

func (c *Cloud) InstanceExistsByProviderID(ctx context.Context, providerID string) (bool, error)

InstanceExistsByProviderID returns true if the instance with the given provider id still exists. If false is returned with no error, the instance will be immediately deleted by the cloud controller manager.

func (*Cloud) InstanceID

func (c *Cloud) InstanceID(ctx context.Context, nodeName types.NodeName) (string, error)

InstanceID returns the cloud provider ID of the node with the specified nodeName.

func (*Cloud) InstanceShutdownByProviderID

func (c *Cloud) InstanceShutdownByProviderID(ctx context.Context, providerID string) (bool, error)

InstanceShutdownByProviderID returns true if the instance is in safe state to detach volumes

func (*Cloud) InstanceType

func (c *Cloud) InstanceType(ctx context.Context, nodeName types.NodeName) (string, error)

InstanceType returns the type of the node with the specified nodeName.

func (*Cloud) InstanceTypeByProviderID

func (c *Cloud) InstanceTypeByProviderID(ctx context.Context, providerID string) (string, error)

InstanceTypeByProviderID returns the cloudprovider instance type of the node with the specified unique providerID This method will not be called from the node that is requesting this ID. i.e. metadata service and other local methods cannot be used here

func (*Cloud) Instances

func (c *Cloud) Instances() (cloudprovider.Instances, bool)

Instances returns an implementation of Instances for Amazon Web Services.

func (*Cloud) InstancesV2

func (c *Cloud) InstancesV2() (cloudprovider.InstancesV2, bool)

InstancesV2 is an implementation for instances and should only be implemented by external cloud providers. Implementing InstancesV2 is behaviorally identical to Instances but is optimized to significantly reduce API calls to the cloud provider when registering and syncing nodes. Also returns true if the interface is supported, false otherwise.

func (*Cloud) ListRoutes

func (c *Cloud) ListRoutes(ctx context.Context, clusterName string) ([]*cloudprovider.Route, error)

ListRoutes implements Routes.ListRoutes List all routes that match the filter

func (*Cloud) LoadBalancer

func (c *Cloud) LoadBalancer() (cloudprovider.LoadBalancer, bool)

LoadBalancer returns an implementation of LoadBalancer for Amazon Web Services.

func (*Cloud) NodeAddresses

func (c *Cloud) NodeAddresses(ctx context.Context, name types.NodeName) ([]v1.NodeAddress, error)

NodeAddresses is an implementation of Instances.NodeAddresses.

func (*Cloud) NodeAddressesByProviderID

func (c *Cloud) NodeAddressesByProviderID(ctx context.Context, providerID string) ([]v1.NodeAddress, error)

NodeAddressesByProviderID returns the node addresses of an instances with the specified unique providerID This method will not be called from the node that is requesting this ID. i.e. metadata service and other local methods cannot be used here

func (*Cloud) ProviderName

func (c *Cloud) ProviderName() string

ProviderName returns the cloud provider ID.

func (*Cloud) Routes

func (c *Cloud) Routes() (cloudprovider.Routes, bool)

Routes returns an implementation of Routes for Amazon Web Services.

func (*Cloud) SetInformers

func (c *Cloud) SetInformers(informerFactory informers.SharedInformerFactory)

SetInformers implements InformerUser interface by setting up informer-fed caches for aws lib to leverage Kubernetes API for caching

func (*Cloud) UpdateLoadBalancer

func (c *Cloud) UpdateLoadBalancer(ctx context.Context, clusterName string, service *v1.Service, nodes []*v1.Node) error

UpdateLoadBalancer implements LoadBalancer.UpdateLoadBalancer

func (*Cloud) Zones

func (c *Cloud) Zones() (cloudprovider.Zones, bool)

Zones returns an implementation of Zones for Amazon Web Services.

type CloudConfig

type CloudConfig struct {
	Global struct {
		// TODO: Is there any use for this?  We can get it from the instance metadata service
		// Maybe if we're not running on AWS, e.g. bootstrap; for now it is not very useful
		Zone string

		// The AWS VPC flag enables the possibility to run the master components
		// on a different aws account, on a different cloud provider or on-premises.
		// If the flag is set also the KubernetesClusterTag must be provided
		VPC string
		// SubnetID enables using a specific subnet to use for ELB's
		SubnetID string
		// RouteTableID enables using a specific RouteTable
		RouteTableID string

		// RoleARN is the IAM role to assume when interaction with AWS APIs.
		RoleARN string

		// KubernetesClusterTag is the legacy cluster id we'll use to identify our cluster resources
		KubernetesClusterTag string
		// KubernetesClusterID is the cluster id we'll use to identify our cluster resources
		KubernetesClusterID string

		//The aws provider creates an inbound rule per load balancer on the node security
		//group. However, this can run into the AWS security group rule limit of 50 if
		//many LoadBalancers are created.
		//
		//This flag disables the automatic ingress creation. It requires that the user
		//has setup a rule that allows inbound traffic on kubelet ports from the
		//local VPC subnet (so load balancers can access it). E.g. 10.82.0.0/16 30000-32000.
		DisableSecurityGroupIngress bool

		//AWS has a hard limit of 500 security groups. For large clusters creating a security group for each ELB
		//can cause the max number of security groups to be reached. If this is set instead of creating a new
		//Security group for each ELB this security group will be used instead.
		ElbSecurityGroup string

		//During the instantiation of an new AWS cloud provider, the detected region
		//is validated against a known set of regions.
		//
		//In a non-standard, AWS like environment (e.g. Eucalyptus), this check may
		//be undesirable.  Setting this to true will disable the check and provide
		//a warning that the check was skipped.  Please note that this is an
		//experimental feature and work-in-progress for the moment.  If you find
		//yourself in an non-AWS cloud and open an issue, please indicate that in the
		//issue body.
		DisableStrictZoneCheck bool
	}
	// [ServiceOverride "1"]
	//  Service = s3
	//  Region = region1
	//  URL = https://s3.foo.bar
	//  SigningRegion = signing_region
	//  SigningMethod = signing_method
	//
	//  [ServiceOverride "2"]
	//     Service = ec2
	//     Region = region2
	//     URL = https://ec2.foo.bar
	//     SigningRegion = signing_region
	//     SigningMethod = signing_method
	ServiceOverride map[string]*struct {
		Service       string
		Region        string
		URL           string
		SigningRegion string
		SigningMethod string
		SigningName   string
	}
}

CloudConfig wraps the settings for the AWS cloud provider. NOTE: Cloud config files should follow the same Kubernetes deprecation policy as flags or CLIs. Config fields should not change behavior in incompatible ways and should be deprecated for at least 2 release prior to removing. See https://kubernetes.io/docs/reference/using-api/deprecation-policy/#deprecating-a-flag-or-cli for more details.

type Compute

type Compute interface {
	ReadVms(request *osc.ReadVmsRequest) ([]osc.Vm, error)

	ReadSecurityGroups(request *osc.ReadSecurityGroupsRequest) ([]osc.SecurityGroup, error)

	CreateSecurityGroup(request *osc.CreateSecurityGroupRequest) (*osc.CreateSecurityGroupResponse, error)
	DeleteSecurityGroup(request *osc.DeleteSecurityGroupRequest) (*osc.DeleteSecurityGroupResponse, error)

	CreateSecurityGroupRule(request *osc.CreateSecurityGroupRuleRequest) (*osc.CreateSecurityGroupRuleResponse, error)
	DeleteSecurityGroupRule(request *osc.DeleteSecurityGroupRuleRequest) (*osc.DeleteSecurityGroupRuleResponse, error)

	DescribeSubnets(*osc.ReadSubnetsRequest) ([]osc.Subnet, error)

	CreateTags(*osc.CreateTagsRequest) (*osc.CreateTagsResponse, error)

	ReadRouteTables(request *osc.ReadRouteTablesRequest) ([]osc.RouteTable, error)
	CreateRoute(request *osc.CreateRouteRequest) (*osc.CreateRouteResponse, error)
	DeleteRoute(request *osc.DeleteRouteRequest) (*osc.DeleteRouteResponse, error)

	UpdateVM(request *osc.UpdateVmRequest) (*osc.UpdateVmResponse, error)
}

Compute provice abstraction to IaaS calls

type CrossRequestRetryDelay

type CrossRequestRetryDelay struct {
	// contains filtered or unexported fields
}

CrossRequestRetryDelay inserts delays before AWS calls, when we are observing RequestLimitExceeded errors Note that we share a CrossRequestRetryDelay across multiple AWS requests; this is a process-wide back-off, whereas the aws-sdk-go implements a per-request exponential backoff/retry

func NewCrossRequestRetryDelay

func NewCrossRequestRetryDelay() *CrossRequestRetryDelay

NewCrossRequestRetryDelay creates a new CrossRequestRetryDelay

func (*CrossRequestRetryDelay) AfterRetry

func (c *CrossRequestRetryDelay) AfterRetry(r *request.Request)

AfterRetry is added to the AfterRetry chain; called after any error

func (*CrossRequestRetryDelay) BeforeSign

func (c *CrossRequestRetryDelay) BeforeSign(r *request.Request)

BeforeSign is added to the Sign chain; called before each request

type EC2Metadata

type EC2Metadata interface {
	Available() bool
	GetInstanceIdentityDocument() (ec2metadata.EC2InstanceIdentityDocument, error)
	// Query the EC2 metadata service (used to discover instance-id etc)
	GetMetadata(path string) (string, error)
}

EC2Metadata is an abstraction over the AWS metadata service.

type FakeCompute

type FakeCompute interface {
	Compute
	CreateSubnet(*ec2.Subnet) (*ec2.CreateSubnetOutput, error)
	RemoveSubnets()
	CreateRouteTable(*ec2.RouteTable) (*ec2.CreateRouteTableOutput, error)
	RemoveRouteTables()
}

FakeCompute is a fake Compute client used for testing

type FakeComputeImpl

type FakeComputeImpl struct {
	Subnets                  []osc.Subnet
	DescribeSubnetsInput     *osc.ReadSubnetsRequest
	RouteTables              []osc.RouteTable
	DescribeRouteTablesInput *osc.ReadRouteTablesRequest
	MainSecurityGroup        *osc.SecurityGroup
	// contains filtered or unexported fields
}

FakeComputeImpl is an implementation of the FakeEC2 interface used for testing

func (*FakeComputeImpl) CreateRoute

func (ec2i *FakeComputeImpl) CreateRoute(request *osc.CreateRouteRequest) (*osc.CreateRouteResponse, error)

CreateRoute is not implemented but is required for interface conformance

func (*FakeComputeImpl) CreateRouteTable

func (ec2i *FakeComputeImpl) CreateRouteTable(request *ec2.RouteTable) (*ec2.CreateRouteTableOutput, error)

CreateRouteTable creates fake route tables

func (*FakeComputeImpl) CreateSecurityGroup

func (ec2i *FakeComputeImpl) CreateSecurityGroup(request *osc.CreateSecurityGroupRequest) (*osc.CreateSecurityGroupResponse, error)

CreateSecurityGroup is not implemented but is required for interface conformance

func (*FakeComputeImpl) CreateSecurityGroupRule

func (ec2i *FakeComputeImpl) CreateSecurityGroupRule(request *osc.CreateSecurityGroupRuleRequest) (*osc.CreateSecurityGroupRuleResponse, error)

CreateSecurityGroupRule is not implemented but is required for interface conformance

func (*FakeComputeImpl) CreateSubnet

func (ec2i *FakeComputeImpl) CreateSubnet(request *ec2.Subnet) (*ec2.CreateSubnetOutput, error)

CreateSubnet creates fake subnets

func (*FakeComputeImpl) CreateTags

func (ec2i *FakeComputeImpl) CreateTags(request *osc.CreateTagsRequest) (*osc.CreateTagsResponse, error)

CreateTags is not implemented but is required for interface conformance

func (*FakeComputeImpl) DeleteRoute

func (ec2i *FakeComputeImpl) DeleteRoute(request *osc.DeleteRouteRequest) (*osc.DeleteRouteResponse, error)

DeleteRoute is not implemented but is required for interface conformance

func (*FakeComputeImpl) DeleteSecurityGroup

func (ec2i *FakeComputeImpl) DeleteSecurityGroup(request *osc.DeleteSecurityGroupRequest) (*osc.DeleteSecurityGroupResponse, error)

DeleteSecurityGroup is not implemented but is required for interface conformance

func (*FakeComputeImpl) DeleteSecurityGroupRule

func (ec2i *FakeComputeImpl) DeleteSecurityGroupRule(request *osc.DeleteSecurityGroupRuleRequest) (*osc.DeleteSecurityGroupRuleResponse, error)

DeleteSecurityGroupRule is not implemented but is required for interface conformance

func (*FakeComputeImpl) DescribeSubnets

func (ec2i *FakeComputeImpl) DescribeSubnets(request *osc.ReadSubnetsRequest) ([]osc.Subnet, error)

DescribeSubnets returns fake subnet descriptions

func (*FakeComputeImpl) ReadRouteTables

func (ec2i *FakeComputeImpl) ReadRouteTables(request *osc.ReadRouteTablesRequest) ([]osc.RouteTable, error)

ReadRouteTables returns fake route table descriptions

func (*FakeComputeImpl) ReadSecurityGroups

func (ec2i *FakeComputeImpl) ReadSecurityGroups(request *osc.ReadSecurityGroupsRequest) ([]osc.SecurityGroup, error)

ReadSecurityGroups is not implemented but is required for interface conformance

func (*FakeComputeImpl) ReadVms

func (ec2i *FakeComputeImpl) ReadVms(request *osc.ReadVmsRequest) ([]osc.Vm, error)

ReadVms returns fake instance descriptions

func (*FakeComputeImpl) RemoveRouteTables

func (ec2i *FakeComputeImpl) RemoveRouteTables()

RemoveRouteTables clears route tables on client

func (*FakeComputeImpl) RemoveSubnets

func (ec2i *FakeComputeImpl) RemoveSubnets()

RemoveSubnets clears subnets on client

func (*FakeComputeImpl) UpdateVM

func (ec2i *FakeComputeImpl) UpdateVM(request *osc.UpdateVmRequest) (*osc.UpdateVmResponse, error)

UpdateVM is not implemented but is required for interface conformance

type FakeELB

type FakeELB struct {
	LoadBalancers map[string]*elb.LoadBalancerDescription
	// contains filtered or unexported fields
}

FakeELB is a fake ELB client used for testing

func (*FakeELB) AddTags

func (fakeElb *FakeELB) AddTags(input *elb.AddTagsInput) (*elb.AddTagsOutput, error)

AddTags is not implemented but is required for interface conformance

func (*FakeELB) ApplySecurityGroupsToLoadBalancer

ApplySecurityGroupsToLoadBalancer is not implemented but is required for interface conformance

func (*FakeELB) AttachLoadBalancerToSubnets

func (fakeElb *FakeELB) AttachLoadBalancerToSubnets(*elb.AttachLoadBalancerToSubnetsInput) (*elb.AttachLoadBalancerToSubnetsOutput, error)

AttachLoadBalancerToSubnets is not implemented but is required for interface conformance

func (*FakeELB) ConfigureHealthCheck

func (fakeElb *FakeELB) ConfigureHealthCheck(input *elb.ConfigureHealthCheckInput) (*elb.ConfigureHealthCheckOutput, error)

ConfigureHealthCheck is not implemented but is required for interface conformance

func (*FakeELB) CreateLoadBalancer

func (fakeElb *FakeELB) CreateLoadBalancer(input *elb.CreateLoadBalancerInput) (*elb.CreateLoadBalancerOutput, error)

CreateLoadBalancer is not implemented but is required for interface conformance

func (*FakeELB) CreateLoadBalancerListeners

func (fakeElb *FakeELB) CreateLoadBalancerListeners(*elb.CreateLoadBalancerListenersInput) (*elb.CreateLoadBalancerListenersOutput, error)

CreateLoadBalancerListeners is not implemented but is required for interface conformance

func (*FakeELB) CreateLoadBalancerPolicy

func (fakeElb *FakeELB) CreateLoadBalancerPolicy(*elb.CreateLoadBalancerPolicyInput) (*elb.CreateLoadBalancerPolicyOutput, error)

CreateLoadBalancerPolicy is not implemented but is required for interface conformance

func (*FakeELB) DeleteLoadBalancer

func (fakeElb *FakeELB) DeleteLoadBalancer(input *elb.DeleteLoadBalancerInput) (*elb.DeleteLoadBalancerOutput, error)

DeleteLoadBalancer is not implemented but is required for interface conformance

func (*FakeELB) DeleteLoadBalancerListeners

func (fakeElb *FakeELB) DeleteLoadBalancerListeners(*elb.DeleteLoadBalancerListenersInput) (*elb.DeleteLoadBalancerListenersOutput, error)

DeleteLoadBalancerListeners is not implemented but is required for interface conformance

func (*FakeELB) DeregisterInstancesFromLoadBalancer

DeregisterInstancesFromLoadBalancer is not implemented but is required for interface conformance

func (*FakeELB) DescribeLoadBalancerAttributes

func (fakeElb *FakeELB) DescribeLoadBalancerAttributes(input *elb.DescribeLoadBalancerAttributesInput) (*elb.DescribeLoadBalancerAttributesOutput, error)

DescribeLoadBalancerAttributes is not implemented but is required for interface conformance

func (*FakeELB) DescribeLoadBalancerPolicies

func (fakeElb *FakeELB) DescribeLoadBalancerPolicies(input *elb.DescribeLoadBalancerPoliciesInput) (*elb.DescribeLoadBalancerPoliciesOutput, error)

DescribeLoadBalancerPolicies is not implemented but is required for interface conformance

func (*FakeELB) DescribeLoadBalancers

func (fakeElb *FakeELB) DescribeLoadBalancers(input *elb.DescribeLoadBalancersInput) (*elb.DescribeLoadBalancersOutput, error)

DescribeLoadBalancers is not implemented but is required for interface conformance

func (*FakeELB) DetachLoadBalancerFromSubnets

func (fakeElb *FakeELB) DetachLoadBalancerFromSubnets(*elb.DetachLoadBalancerFromSubnetsInput) (*elb.DetachLoadBalancerFromSubnetsOutput, error)

DetachLoadBalancerFromSubnets is not implemented but is required for interface conformance

func (*FakeELB) ModifyLoadBalancerAttributes

func (fakeElb *FakeELB) ModifyLoadBalancerAttributes(*elb.ModifyLoadBalancerAttributesInput) (*elb.ModifyLoadBalancerAttributesOutput, error)

ModifyLoadBalancerAttributes is not implemented but is required for interface conformance

func (*FakeELB) RegisterInstancesWithLoadBalancer

RegisterInstancesWithLoadBalancer is not implemented but is required for interface conformance

func (*FakeELB) SetLoadBalancerPoliciesForBackendServer

SetLoadBalancerPoliciesForBackendServer is not implemented but is required for interface conformance

func (*FakeELB) SetLoadBalancerPoliciesOfListener

func (fakeElb *FakeELB) SetLoadBalancerPoliciesOfListener(input *elb.SetLoadBalancerPoliciesOfListenerInput) (*elb.SetLoadBalancerPoliciesOfListenerOutput, error)

SetLoadBalancerPoliciesOfListener is not implemented but is required for interface conformance

type FakeMetadata

type FakeMetadata struct {
	// contains filtered or unexported fields
}

FakeMetadata is a fake EC2 metadata service client used for testing

func (*FakeMetadata) Available

func (m *FakeMetadata) Available() bool

Available mocks base method

func (*FakeMetadata) GetAvailabilityZone

func (m *FakeMetadata) GetAvailabilityZone() string

GetAvailabilityZone is a fake metadata for testing

func (*FakeMetadata) GetInstanceID

func (m *FakeMetadata) GetInstanceID() string

GetInstanceID is a fake metadata for testing

func (*FakeMetadata) GetInstanceIdentityDocument

func (m *FakeMetadata) GetInstanceIdentityDocument() (ec2metadata.EC2InstanceIdentityDocument, error)

GetInstanceIdentityDocument mocks base method

func (*FakeMetadata) GetInstanceType

func (m *FakeMetadata) GetInstanceType() string

GetInstanceType is a fake metadata for testing

func (*FakeMetadata) GetMetadata

func (m *FakeMetadata) GetMetadata(key string) (string, error)

GetMetadata returns fake EC2 metadata for testing

func (*FakeMetadata) GetRegion

func (m *FakeMetadata) GetRegion() string

GetRegion is a fake metadata for testing

type FakeOscServices

type FakeOscServices struct {
	// contains filtered or unexported fields
}

FakeOscServices is an fake AWS session used for testing

func NewFakeAWSServices

func NewFakeAWSServices(clusterID string) *FakeOscServices

NewFakeAWSServices creates a new FakeAWSServices

func (*FakeOscServices) Compute

func (s *FakeOscServices) Compute(region string) (Compute, error)

Compute returns a fake EC2 client

func (*FakeOscServices) LoadBalancing

func (s *FakeOscServices) LoadBalancing(region string) (LoadBalancer, error)

LoadBalancing returns a fake ELB client

func (*FakeOscServices) Metadata

func (s *FakeOscServices) Metadata() (EC2Metadata, error)

Metadata returns a fake EC2Metadata client

func (*FakeOscServices) WithAz

func (s *FakeOscServices) WithAz(az string) *FakeOscServices

WithAz sets the ec2 placement availability zone

type IPRulesSet

type IPRulesSet map[string]osc.SecurityGroupRule

IPRulesSet maps IP strings of strings to OSC IpPermissions

func NewIPRulesSet

func NewIPRulesSet(items ...osc.SecurityGroupRule) IPRulesSet

NewIPRulesSet creates a new IPRulesSet

func NewIPRulesSetFromAWS

func NewIPRulesSetFromAWS(items ...*ec2.IpPermission) IPRulesSet

NewIPRulesSetFromAWS creates a new IPRulesSet

func (IPRulesSet) Difference

func (s IPRulesSet) Difference(s2 IPRulesSet) IPRulesSet

Difference returns a set of objects that are not in s2 For example: s1 = {a1, a2, a3} s2 = {a1, a2, a4, a5} s1.Difference(s2) = {a3} s2.Difference(s1) = {a4, a5}

func (IPRulesSet) Insert

func (s IPRulesSet) Insert(items ...osc.SecurityGroupRule)

Insert adds items to the set.

func (IPRulesSet) Len

func (s IPRulesSet) Len() int

Len returns the size of the set.

func (IPRulesSet) List

func (s IPRulesSet) List() []osc.SecurityGroupRule

List returns the contents as a slice. Order is not defined.

func (IPRulesSet) Ungroup

func (s IPRulesSet) Ungroup() IPRulesSet

Ungroup splits permissions out into individual permissions EC2 will combine permissions with the same port but different SourceRanges together, for example We ungroup them so we can process them

type InstanceID

type InstanceID string

InstanceID represents the ID of the instance in the AWS API, e.g. i-12345678 The "traditional" format is "i-12345678" A new longer format is also being introduced: "i-12345678abcdef01" We should not assume anything about the length or format, though it seems reasonable to assume that instances will continue to start with "i-".

type KubernetesInstanceID

type KubernetesInstanceID string

KubernetesInstanceID represents the id for an instance in the kubernetes API; the following form

  • aws:///<zone>/<awsInstanceId>
  • aws:////<awsInstanceId>
  • <awsInstanceId>

func (KubernetesInstanceID) MapToAWSInstanceID

func (name KubernetesInstanceID) MapToAWSInstanceID() (InstanceID, error)

MapToAWSInstanceID extracts the InstanceID from the KubernetesInstanceID

type LoadBalancer

type LoadBalancer interface {
	CreateLoadBalancer(*elb.CreateLoadBalancerInput) (*elb.CreateLoadBalancerOutput, error)
	DeleteLoadBalancer(*elb.DeleteLoadBalancerInput) (*elb.DeleteLoadBalancerOutput, error)
	DescribeLoadBalancers(*elb.DescribeLoadBalancersInput) (*elb.DescribeLoadBalancersOutput, error)
	AddTags(*elb.AddTagsInput) (*elb.AddTagsOutput, error)
	RegisterInstancesWithLoadBalancer(*elb.RegisterInstancesWithLoadBalancerInput) (*elb.RegisterInstancesWithLoadBalancerOutput, error)
	DeregisterInstancesFromLoadBalancer(*elb.DeregisterInstancesFromLoadBalancerInput) (*elb.DeregisterInstancesFromLoadBalancerOutput, error)
	CreateLoadBalancerPolicy(*elb.CreateLoadBalancerPolicyInput) (*elb.CreateLoadBalancerPolicyOutput, error)

	SetLoadBalancerPoliciesForBackendServer(*elb.SetLoadBalancerPoliciesForBackendServerInput) (*elb.SetLoadBalancerPoliciesForBackendServerOutput, error)
	SetLoadBalancerPoliciesOfListener(input *elb.SetLoadBalancerPoliciesOfListenerInput) (*elb.SetLoadBalancerPoliciesOfListenerOutput, error)
	DescribeLoadBalancerPolicies(input *elb.DescribeLoadBalancerPoliciesInput) (*elb.DescribeLoadBalancerPoliciesOutput, error)

	DetachLoadBalancerFromSubnets(*elb.DetachLoadBalancerFromSubnetsInput) (*elb.DetachLoadBalancerFromSubnetsOutput, error)
	AttachLoadBalancerToSubnets(*elb.AttachLoadBalancerToSubnetsInput) (*elb.AttachLoadBalancerToSubnetsOutput, error)

	CreateLoadBalancerListeners(*elb.CreateLoadBalancerListenersInput) (*elb.CreateLoadBalancerListenersOutput, error)
	DeleteLoadBalancerListeners(*elb.DeleteLoadBalancerListenersInput) (*elb.DeleteLoadBalancerListenersOutput, error)

	ApplySecurityGroupsToLoadBalancer(*elb.ApplySecurityGroupsToLoadBalancerInput) (*elb.ApplySecurityGroupsToLoadBalancerOutput, error)

	ConfigureHealthCheck(*elb.ConfigureHealthCheckInput) (*elb.ConfigureHealthCheckOutput, error)

	DescribeLoadBalancerAttributes(*elb.DescribeLoadBalancerAttributesInput) (*elb.DescribeLoadBalancerAttributesOutput, error)
	ModifyLoadBalancerAttributes(*elb.ModifyLoadBalancerAttributesInput) (*elb.ModifyLoadBalancerAttributesOutput, error)
}

LoadBalancer is a simple pass-through of Outscale' LoadBalancer client interface, which allows for testing

type Metadata

type Metadata struct {
	InstanceID       string
	InstanceType     string
	Region           string
	AvailabilityZone string
	IsAvailable      bool
	Client           EC2Metadata
}

Metadata represents OSC metadata data.

func (*Metadata) Available

func (m *Metadata) Available() bool

Available returns if meta is Available.

func (*Metadata) GetAvailabilityZone

func (m *Metadata) GetAvailabilityZone() string

GetAvailabilityZone returns the Availability Zone which the instance is in.

func (*Metadata) GetInstanceID

func (m *Metadata) GetInstanceID() string

GetInstanceID returns the instance identification.

func (*Metadata) GetInstanceIdentityDocument

func (m *Metadata) GetInstanceIdentityDocument() (ec2metadata.EC2InstanceIdentityDocument, error)

GetInstanceIdentityDocument returns EC2InstanceIdentityDocument.

func (*Metadata) GetInstanceType

func (m *Metadata) GetInstanceType() string

GetInstanceType returns the instance type.

func (*Metadata) GetMetadata

func (m *Metadata) GetMetadata(path string) (string, error)

GetMetadata returns if meta content.

func (*Metadata) GetRegion

func (m *Metadata) GetRegion() string

GetRegion returns the region which the instance is in.

type MetadataService

type MetadataService interface {
	GetInstanceID() string
	GetInstanceType() string
	GetRegion() string
	GetAvailabilityZone() string
}

MetadataService represents AWS metadata service.

func NewMetadata

func NewMetadata() (MetadataService, error)

NewMetadata create a new metadata service

func NewMetadataService

func NewMetadataService(svc EC2Metadata) (MetadataService, error)

NewMetadataService returns a new MetadataServiceImplementation.

type ResourceLifecycle

type ResourceLifecycle string

ResourceLifecycle is the cluster lifecycle state used in tagging

type Services

type Services interface {
	Compute(region string) (Compute, error)
	LoadBalancing(region string) (LoadBalancer, error)
	Metadata() (EC2Metadata, error)
}

Services providers interface to Compute, LoadBalancing, etc

type VM

type VM struct {
	// contains filtered or unexported fields
}

VM provide Virtual Machine representation

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL