tcawsprovisioner

package
v0.0.0-...-a5b7ecb Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2019 License: MPL-2.0 Imports: 5 Imported by: 4

Documentation

Overview

The AWS Provisioner is responsible for provisioning instances on EC2 for use in Taskcluster. The provisioner maintains a set of worker configurations which can be managed with an API that is typically available at aws-provisioner.taskcluster.net/v1. This API can also perform basic instance management tasks in addition to maintaining the internal state of worker type configuration information.

The Provisioner runs at a configurable interval. Each iteration of the provisioner fetches a current copy the state that the AWS EC2 api reports. In each iteration, we ask the Queue how many tasks are pending for that worker type. Based on the number of tasks pending and the scaling ratio, we may submit requests for new instances. We use pricing information, capacity and utility factor information to decide which instance type in which region would be the optimal configuration.

Each EC2 instance type will declare a capacity and utility factor. Capacity is the number of tasks that a given machine is capable of running concurrently. Utility factor is a relative measure of performance between two instance types. We multiply the utility factor by the spot price to compare instance types and regions when making the bidding choices.

When a new EC2 instance is instantiated, its user data contains a token in `securityToken` that can be used with the `getSecret` method to retrieve the worker's credentials and any needed passwords or other restricted information. The worker is responsible for deleting the secret after retrieving it, to prevent dissemination of the secret to other proceses which can read the instance user data.

See: https://docs.taskcluster.net/reference/core/aws-provisioner/api-docs

How to use this package

First create an AwsProvisioner object:

awsProvisioner := tcawsprovisioner.New(nil)

and then call one or more of awsProvisioner's methods, e.g.:

data, err := awsProvisioner.ListWorkerTypeSummaries(.....)

handling any errors...

if err != nil {
	// handle error...
}

Taskcluster Schema

The source code of this go package was auto-generated from the API definition at https://references.taskcluster.net/aws-provisioner/v1/api.json together with the input and output schemas it references, downloaded on Mon, 7 May 2018 at 13:22:00 UTC. The code was generated by https://github.com/taskcluster/taskcluster-client-go/blob/master/build.sh.

Index

Constants

View Source
const (
	DefaultBaseURL = "https://aws-provisioner.taskcluster.net/v1"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AvailabilityZoneConfiguration

type AvailabilityZoneConfiguration struct {

	// The AWS availability zone being configured.  Example: eu-central-1b
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/availability-zone-configuration.json#/properties/availabilityZone
	AvailabilityZone string `json:"availabilityZone"`

	// LaunchSpecification entries unique to this AZ
	//
	// Additional properties allowed
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/availability-zone-configuration.json#/properties/launchSpec
	LaunchSpec json.RawMessage `json:"launchSpec"`

	// The AWS region containing this availability zone.  Example: eu-central-1
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/availability-zone-configuration.json#/properties/region
	Region string `json:"region"`

	// Static Secrets unique to this AZ
	//
	// Default:    {}
	//
	// Additional properties allowed
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/availability-zone-configuration.json#/properties/secrets
	Secrets json.RawMessage `json:"secrets,omitempty"`

	// UserData entries unique to this AZ
	//
	// Default:    {}
	//
	// Additional properties allowed
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/availability-zone-configuration.json#/properties/userData
	UserData json.RawMessage `json:"userData,omitempty"`
}

Availability zone configuration

See http://schemas.taskcluster.net/aws-provisioner/v1/availability-zone-configuration.json#

type AwsProvisioner

type AwsProvisioner tcclient.Client

func New

func New(credentials *tcclient.Credentials) *AwsProvisioner

New returns an AwsProvisioner client, configured to run against production. Pass in nil to create a client without authentication. The returned client is mutable, so returned settings can be altered.

awsProvisioner := tcawsprovisioner.New(nil)                              // client without authentication
awsProvisioner.BaseURL = "http://localhost:1234/api/AwsProvisioner/v1"   // alternative API endpoint (production by default)
data, err := awsProvisioner.ListWorkerTypeSummaries(.....)               // for example, call the ListWorkerTypeSummaries(.....) API endpoint (described further down)...
if err != nil {
	// handle errors...
}

func NewFromEnv

func NewFromEnv() *AwsProvisioner

NewFromEnv returns an AwsProvisioner client with credentials taken from the environment variables:

TASKCLUSTER_CLIENT_ID
TASKCLUSTER_ACCESS_TOKEN
TASKCLUSTER_CERTIFICATE

If environment variables TASKCLUSTER_CLIENT_ID is empty string or undefined authentication will be disabled.

func (*AwsProvisioner) BackendStatus

func (awsProvisioner *AwsProvisioner) BackendStatus() (*BackendStatusResponse, error)

Stability: *** EXPERIMENTAL ***

This endpoint is used to show when the last time the provisioner has checked in. A check in is done through the deadman's snitch api. It is done at the conclusion of a provisioning iteration and used to tell if the background provisioning process is still running.

**Warning** this api end-point is **not stable**.

See https://docs.taskcluster.net/reference/core/aws-provisioner/api-docs#backendStatus

func (*AwsProvisioner) CreateSecret

func (awsProvisioner *AwsProvisioner) CreateSecret(token string, payload *SecretRequest) error

Insert a secret into the secret storage. The supplied secrets will be provided verbatime via `getSecret`, while the supplied scopes will be converted into credentials by `getSecret`.

This method is not ordinarily used in production; instead, the provisioner creates a new secret directly for each spot bid.

Required scopes:

aws-provisioner:create-secret:<workerType>

See https://docs.taskcluster.net/reference/core/aws-provisioner/api-docs#createSecret

func (*AwsProvisioner) CreateWorkerType

func (awsProvisioner *AwsProvisioner) CreateWorkerType(workerType string, payload *CreateWorkerTypeRequest) (*WorkerTypeResponse, error)

Create a worker type. A worker type contains all the configuration needed for the provisioner to manage the instances. Each worker type knows which regions and which instance types are allowed for that worker type. Remember that Capacity is the number of concurrent tasks that can be run on a given EC2 resource and that Utility is the relative performance rate between different instance types. There is no way to configure different regions to have different sets of instance types so ensure that all instance types are available in all regions. This function is idempotent.

Once a worker type is in the provisioner, a back ground process will begin creating instances for it based on its capacity bounds and its pending task count from the Queue. It is the worker's responsibility to shut itself down. The provisioner has a limit (currently 96hours) for all instances to prevent zombie instances from running indefinitely.

The provisioner will ensure that all instances created are tagged with aws resource tags containing the provisioner id and the worker type.

If provided, the secrets in the global, region and instance type sections are available using the secrets api. If specified, the scopes provided will be used to generate a set of temporary credentials available with the other secrets.

Required scopes:

aws-provisioner:manage-worker-type:<workerType>

See https://docs.taskcluster.net/reference/core/aws-provisioner/api-docs#createWorkerType

func (*AwsProvisioner) GetLaunchSpecs

func (awsProvisioner *AwsProvisioner) GetLaunchSpecs(workerType string) (*LaunchSpecsResponse, error)

Stability: *** EXPERIMENTAL ***

This method returns a preview of all possible launch specifications that this worker type definition could submit to EC2. It is used to test worker types, nothing more

**This API end-point is experimental and may be subject to change without warning.**

Required scopes:

Any of:
- aws-provisioner:view-worker-type:<workerType>
- aws-provisioner:manage-worker-type:<workerType>

See https://docs.taskcluster.net/reference/core/aws-provisioner/api-docs#getLaunchSpecs

func (*AwsProvisioner) GetLaunchSpecs_SignedURL

func (awsProvisioner *AwsProvisioner) GetLaunchSpecs_SignedURL(workerType string, duration time.Duration) (*url.URL, error)

Returns a signed URL for GetLaunchSpecs, valid for the specified duration.

Required scopes:

Any of:
- aws-provisioner:view-worker-type:<workerType>
- aws-provisioner:manage-worker-type:<workerType>

See GetLaunchSpecs for more details.

func (*AwsProvisioner) GetSecret

func (awsProvisioner *AwsProvisioner) GetSecret(token string) (*SecretResponse, error)

Retrieve a secret from storage. The result contains any passwords or other restricted information verbatim as well as a temporary credential based on the scopes specified when the secret was created.

It is important that this secret is deleted by the consumer (`removeSecret`), or else the secrets will be visible to any process which can access the user data associated with the instance.

See https://docs.taskcluster.net/reference/core/aws-provisioner/api-docs#getSecret

func (*AwsProvisioner) InstanceStarted

func (awsProvisioner *AwsProvisioner) InstanceStarted(instanceId, token string) error

An instance will report in by giving its instance id as well as its security token. The token is given and checked to ensure that it matches a real token that exists to ensure that random machines do not check in. We could generate a different token but that seems like overkill

See https://docs.taskcluster.net/reference/core/aws-provisioner/api-docs#instanceStarted

func (*AwsProvisioner) ListWorkerTypeSummaries

func (awsProvisioner *AwsProvisioner) ListWorkerTypeSummaries() (*ListWorkerTypeSummariesResponse, error)

Return a list of worker types, including some summary information about current capacity for each. While this list includes all defined worker types, there may be running EC2 instances for deleted worker types that are not included here. The list is unordered.

See https://docs.taskcluster.net/reference/core/aws-provisioner/api-docs#listWorkerTypeSummaries

func (*AwsProvisioner) ListWorkerTypes

func (awsProvisioner *AwsProvisioner) ListWorkerTypes() (*ListWorkerTypes, error)

Return a list of string worker type names. These are the names of all managed worker types known to the provisioner. This does not include worker types which are left overs from a deleted worker type definition but are still running in AWS.

See https://docs.taskcluster.net/reference/core/aws-provisioner/api-docs#listWorkerTypes

func (*AwsProvisioner) Ping

func (awsProvisioner *AwsProvisioner) Ping() error

Respond without doing anything. This endpoint is used to check that the service is up.

See https://docs.taskcluster.net/reference/core/aws-provisioner/api-docs#ping

func (*AwsProvisioner) RemoveSecret

func (awsProvisioner *AwsProvisioner) RemoveSecret(token string) error

Remove a secret. After this call, a call to `getSecret` with the given token will return no information.

It is very important that the consumer of a secret delete the secret from storage before handing over control to untrusted processes to prevent credential and/or secret leakage.

See https://docs.taskcluster.net/reference/core/aws-provisioner/api-docs#removeSecret

func (*AwsProvisioner) RemoveWorkerType

func (awsProvisioner *AwsProvisioner) RemoveWorkerType(workerType string) error

Delete a worker type definition. This method will only delete the worker type definition from the storage table. The actual deletion will be handled by a background worker. As soon as this method is called for a worker type, the background worker will immediately submit requests to cancel all spot requests for this worker type as well as killing all instances regardless of their state. If you want to gracefully remove a worker type, you must either ensure that no tasks are created with that worker type name or you could theoretically set maxCapacity to 0, though, this is not a supported or tested action

Required scopes:

aws-provisioner:manage-worker-type:<workerType>

See https://docs.taskcluster.net/reference/core/aws-provisioner/api-docs#removeWorkerType

func (*AwsProvisioner) State

func (awsProvisioner *AwsProvisioner) State(workerType string) error

Return the state of a given workertype as stored by the provisioner. This state is stored as three lists: 1 for running instances, 1 for pending requests. The `summary` property contains an updated summary similar to that returned from `listWorkerTypeSummaries`.

See https://docs.taskcluster.net/reference/core/aws-provisioner/api-docs#state

func (*AwsProvisioner) UpdateWorkerType

func (awsProvisioner *AwsProvisioner) UpdateWorkerType(workerType string, payload *CreateWorkerTypeRequest) (*WorkerTypeResponse, error)

Provide a new copy of a worker type to replace the existing one. This will overwrite the existing worker type definition if there is already a worker type of that name. This method will return a 200 response along with a copy of the worker type definition created Note that if you are using the result of a GET on the worker-type end point that you will need to delete the lastModified and workerType keys from the object returned, since those fields are not allowed the request body for this method

Otherwise, all input requirements and actions are the same as the create method.

Required scopes:

aws-provisioner:manage-worker-type:<workerType>

See https://docs.taskcluster.net/reference/core/aws-provisioner/api-docs#updateWorkerType

func (*AwsProvisioner) WorkerType

func (awsProvisioner *AwsProvisioner) WorkerType(workerType string) (*WorkerTypeResponse, error)

Retrieve a copy of the requested worker type definition. This copy contains a lastModified field as well as the worker type name. As such, it will require manipulation to be able to use the results of this method to submit date to the update method.

Required scopes:

Any of:
- aws-provisioner:view-worker-type:<workerType>
- aws-provisioner:manage-worker-type:<workerType>

See https://docs.taskcluster.net/reference/core/aws-provisioner/api-docs#workerType

func (*AwsProvisioner) WorkerTypeLastModified

func (awsProvisioner *AwsProvisioner) WorkerTypeLastModified(workerType string) (*WorkerTypeLastModified, error)

This method is provided to allow workers to see when they were last modified. The value provided through UserData can be compared against this value to see if changes have been made If the worker type definition has not been changed, the date should be identical as it is the same stored value.

See https://docs.taskcluster.net/reference/core/aws-provisioner/api-docs#workerTypeLastModified

func (*AwsProvisioner) WorkerType_SignedURL

func (awsProvisioner *AwsProvisioner) WorkerType_SignedURL(workerType string, duration time.Duration) (*url.URL, error)

Returns a signed URL for WorkerType, valid for the specified duration.

Required scopes:

Any of:
- aws-provisioner:view-worker-type:<workerType>
- aws-provisioner:manage-worker-type:<workerType>

See WorkerType for more details.

type BackendStatusResponse

type BackendStatusResponse struct {

	// A date when the provisioner backend process last completed an iteration.
	// This does not imply success, rather it is to make sure that the process
	// is alive
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/backend-status-response.json#/properties/lastCheckedIn
	LastCheckedIn tcclient.Time `json:"lastCheckedIn"`

	// A string from Deadman's Snitch which describes the status.  See
	// https://deadmanssnitch.com/docs/api/v1#listing-your-snitches for an
	// explanation of this value
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/backend-status-response.json#/properties/status
	Status string `json:"status"`
}

Backend Status Response

See http://schemas.taskcluster.net/aws-provisioner/v1/backend-status-response.json#

type CreateWorkerTypeRequest

type CreateWorkerTypeRequest struct {

	// See http://schemas.taskcluster.net/aws-provisioner/v1/create-worker-type-request.json#/properties/availabilityZones
	AvailabilityZones []AvailabilityZoneConfiguration `json:"availabilityZones,omitempty"`

	// True if this worker type is allowed on demand instances.  Currently
	// ignored
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/create-worker-type-request.json#/properties/canUseOndemand
	CanUseOndemand bool `json:"canUseOndemand,omitempty"`

	// True if this worker type is allowed spot instances.  Currently ignored
	// as all instances are Spot
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/create-worker-type-request.json#/properties/canUseSpot
	CanUseSpot bool `json:"canUseSpot,omitempty"`

	// A string which describes what this image is for and hints on using it
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/create-worker-type-request.json#/properties/description
	Description string `json:"description"`

	// See http://schemas.taskcluster.net/aws-provisioner/v1/create-worker-type-request.json#/properties/instanceTypes
	InstanceTypes []InstanceTypeConfiguration `json:"instanceTypes"`

	// Launch Specification entries which are used in all regions and all instance types
	//
	// Additional properties allowed
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/create-worker-type-request.json#/properties/launchSpec
	LaunchSpec json.RawMessage `json:"launchSpec"`

	// Maximum number of capacity units to be provisioned.
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/create-worker-type-request.json#/properties/maxCapacity
	MaxCapacity float64 `json:"maxCapacity"`

	// Maximum price we'll pay.  Like minPrice, this takes into account the
	// utility factor when figuring out what the actual SpotPrice submitted
	// to Amazon will be
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/create-worker-type-request.json#/properties/maxPrice
	MaxPrice float64 `json:"maxPrice"`

	// Minimum number of capacity units to be provisioned.  A capacity unit
	// is an abstract unit of capacity, where one capacity unit is roughly
	// one task which should be taken off the queue
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/create-worker-type-request.json#/properties/minCapacity
	MinCapacity float64 `json:"minCapacity,omitempty"`

	// Minimum price to pay for an instance.  A Price is considered to be the
	// Amazon Spot Price multiplied by the utility factor of the InstantType
	// as specified in the instanceTypes list.  For example, if the minPrice
	// is set to $0.5 and the utility factor is 2, the actual minimum bid
	// used will be $0.25
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/create-worker-type-request.json#/properties/minPrice
	MinPrice float64 `json:"minPrice"`

	// A string which identifies the owner of this worker type
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/create-worker-type-request.json#/properties/owner
	Owner string `json:"owner"`

	// See http://schemas.taskcluster.net/aws-provisioner/v1/create-worker-type-request.json#/properties/regions
	Regions []RegionConfiguration `json:"regions"`

	// A scaling ratio of `0.2` means that the provisioner will attempt to keep
	// the number of pending tasks around 20% of the provisioned capacity.
	// This results in pending tasks waiting 20% of the average task execution
	// time before starting to run.
	// A higher scaling ratio often results in better utilization and longer
	// waiting times. For workerTypes running long tasks a short scaling ratio
	// may be preferred, but for workerTypes running quick tasks a higher scaling
	// ratio may increase utilization without major delays.
	// If using a scaling ratio of 0, the provisioner will attempt to keep the
	// capacity of pending spot requests equal to the number of pending tasks.
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/create-worker-type-request.json#/properties/scalingRatio
	ScalingRatio float64 `json:"scalingRatio"`

	// Scopes to issue credentials to for all regions Scopes must be composed of
	// printable ASCII characters and spaces.
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/create-worker-type-request.json#/properties/scopes
	Scopes []string `json:"scopes"`

	// Static secrets entries which are used in all regions and all instance types
	//
	// Additional properties allowed
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/create-worker-type-request.json#/properties/secrets
	Secrets json.RawMessage `json:"secrets"`

	// UserData entries which are used in all regions and all instance types
	//
	// Additional properties allowed
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/create-worker-type-request.json#/properties/userData
	UserData json.RawMessage `json:"userData"`
}

A worker launchSpecification and required metadata

See http://schemas.taskcluster.net/aws-provisioner/v1/create-worker-type-request.json#

type InstanceTypeConfiguration

type InstanceTypeConfiguration struct {

	// This number represents the number of tasks that this instance type
	// is capable of running concurrently.  This is used by the provisioner
	// to know how many pending tasks to offset a pending instance of this
	// type by
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/instance-type-configuration.json#/properties/capacity
	Capacity float64 `json:"capacity"`

	// InstanceType name for Amazon.
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/instance-type-configuration.json#/properties/instanceType
	InstanceType string `json:"instanceType"`

	// LaunchSpecification entries unique to this InstanceType
	//
	// Additional properties allowed
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/instance-type-configuration.json#/properties/launchSpec
	LaunchSpec json.RawMessage `json:"launchSpec"`

	// Scopes which should be included for this InstanceType.  Scopes must
	// be composed of printable ASCII characters and spaces.
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/instance-type-configuration.json#/properties/scopes
	Scopes []string `json:"scopes"`

	// Static Secrets unique to this InstanceType
	//
	// Additional properties allowed
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/instance-type-configuration.json#/properties/secrets
	Secrets json.RawMessage `json:"secrets"`

	// UserData entries unique to this InstanceType
	//
	// Additional properties allowed
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/instance-type-configuration.json#/properties/userData
	UserData json.RawMessage `json:"userData"`

	// This number is a relative measure of performance between two instance
	// types.  It is multiplied by the spot price from Amazon to figure out
	// which instance type is the cheapest one
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/instance-type-configuration.json#/properties/utility
	Utility float64 `json:"utility"`
}

Instance Type configuration

See http://schemas.taskcluster.net/aws-provisioner/v1/instance-type-configuration.json#

type LaunchSpecsResponse

type LaunchSpecsResponse json.RawMessage

All of the launch specifications for a worker type

Additional properties allowed

See http://schemas.taskcluster.net/aws-provisioner/v1/get-launch-specs-response.json#

func (*LaunchSpecsResponse) MarshalJSON

func (this *LaunchSpecsResponse) MarshalJSON() ([]byte, error)

MarshalJSON calls json.RawMessage method of the same name. Required since LaunchSpecsResponse is of type json.RawMessage...

func (*LaunchSpecsResponse) UnmarshalJSON

func (this *LaunchSpecsResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON is a copy of the json.RawMessage implementation.

type RegionConfiguration

type RegionConfiguration struct {

	// LaunchSpecification entries unique to this Region
	//
	// Defined properties:
	//
	//  struct {
	//
	//  	// Per-region AMI ImageId
	//  	//
	//  	// See http://schemas.taskcluster.net/aws-provisioner/v1/region-launch-spec.json#/properties/ImageId
	//  	ImageID string `json:"ImageId"`
	//  }
	//
	// Additional properties allowed
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/region-launch-spec.json#
	LaunchSpec json.RawMessage `json:"launchSpec"`

	// The Amazon AWS Region being configured.  Example: us-west-1
	//
	// Possible values:
	//   * "us-west-2"
	//   * "us-east-1"
	//   * "us-east-2"
	//   * "us-west-1"
	//   * "eu-central-1"
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/region-configuration.json#/properties/region
	Region string `json:"region"`

	// Scopes which should be included for this Region.  Scopes must be
	// composed of printable ASCII characters and spaces.
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/region-configuration.json#/properties/scopes
	Scopes []string `json:"scopes"`

	// Static Secrets unique to this Region
	//
	// Additional properties allowed
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/region-configuration.json#/properties/secrets
	Secrets json.RawMessage `json:"secrets"`

	// UserData entries unique to this Region
	//
	// Additional properties allowed
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/region-configuration.json#/properties/userData
	UserData json.RawMessage `json:"userData"`
}

Region configuration

See http://schemas.taskcluster.net/aws-provisioner/v1/region-configuration.json#

type RegionLaunchSpec

type RegionLaunchSpec json.RawMessage

LaunchSpecification entries unique to this Region

Defined properties:

struct {

	// Per-region AMI ImageId
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/region-launch-spec.json#/properties/ImageId
	ImageID string `json:"ImageId"`
}

Additional properties allowed

See http://schemas.taskcluster.net/aws-provisioner/v1/region-launch-spec.json#

func (*RegionLaunchSpec) MarshalJSON

func (this *RegionLaunchSpec) MarshalJSON() ([]byte, error)

MarshalJSON calls json.RawMessage method of the same name. Required since RegionLaunchSpec is of type json.RawMessage...

func (*RegionLaunchSpec) UnmarshalJSON

func (this *RegionLaunchSpec) UnmarshalJSON(data []byte) error

UnmarshalJSON is a copy of the json.RawMessage implementation.

type SecretRequest

type SecretRequest struct {

	// The date at which the secret is no longer guaranteed to exist
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/create-secret-request.json#/properties/expiration
	Expiration tcclient.Time `json:"expiration"`

	// List of strings which are scopes for temporary credentials to give
	// to the worker through the secret system.  Scopes must be composed of
	// printable ASCII characters and spaces.
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/create-secret-request.json#/properties/scopes
	Scopes []string `json:"scopes"`

	// Free form object which contains the secrets stored
	//
	// Additional properties allowed
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/create-secret-request.json#/properties/secrets
	Secrets json.RawMessage `json:"secrets"`

	// A Slug ID which is the uniquely addressable token to access this
	// set of secrets
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/create-secret-request.json#/properties/token
	Token string `json:"token"`

	// A string describing what the secret will be used for
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/create-secret-request.json#/properties/workerType
	WorkerType string `json:"workerType"`
}

A Secret

See http://schemas.taskcluster.net/aws-provisioner/v1/create-secret-request.json#

type SecretResponse

type SecretResponse struct {

	// Generated Temporary credentials from the Provisioner
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/get-secret-response.json#/properties/credentials
	Credentials Credentials `json:"credentials"`

	// Free-form object which contains secrets from the worker type definition
	//
	// Additional properties allowed
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/get-secret-response.json#/properties/data
	Data json.RawMessage `json:"data"`

	// See http://schemas.taskcluster.net/aws-provisioner/v1/get-secret-response.json#/properties/scopes
	Scopes []string `json:"scopes"`
}

Secrets from the provisioner

See http://schemas.taskcluster.net/aws-provisioner/v1/get-secret-response.json#

type WorkerTypeLastModified

type WorkerTypeLastModified struct {

	// ISO Date string (e.g. new Date().toISOString()) which represents the time
	// when this worker type definition was last altered (inclusive of creation)
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/get-worker-type-last-modified.json#/properties/lastModified
	LastModified tcclient.Time `json:"lastModified"`

	// The ID of the workerType
	//
	// Syntax:     ^[A-Za-z0-9+/=_-]{1,22}$
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/get-worker-type-last-modified.json#/properties/workerType
	WorkerType string `json:"workerType"`
}

The last modified date of a workerType

See http://schemas.taskcluster.net/aws-provisioner/v1/get-worker-type-last-modified.json#

type WorkerTypeResponse

type WorkerTypeResponse struct {

	// See http://schemas.taskcluster.net/aws-provisioner/v1/get-worker-type-response.json#/properties/availabilityZones
	AvailabilityZones []AvailabilityZoneConfiguration `json:"availabilityZones,omitempty"`

	// True if this worker type is allowed on demand instances.  Currently
	// ignored
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/get-worker-type-response.json#/properties/canUseOndemand
	CanUseOndemand bool `json:"canUseOndemand,omitempty"`

	// True if this worker type is allowed spot instances.  Currently ignored
	// as all instances are Spot
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/get-worker-type-response.json#/properties/canUseSpot
	CanUseSpot bool `json:"canUseSpot,omitempty"`

	// A string which describes what this image is for and hints on using it
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/get-worker-type-response.json#/properties/description
	Description string `json:"description"`

	// See http://schemas.taskcluster.net/aws-provisioner/v1/get-worker-type-response.json#/properties/instanceTypes
	InstanceTypes []InstanceTypeConfiguration `json:"instanceTypes"`

	// ISO Date string (e.g. new Date().toISOString()) which represents the time
	// when this worker type definition was last altered (inclusive of creation)
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/get-worker-type-response.json#/properties/lastModified
	LastModified tcclient.Time `json:"lastModified"`

	// Launch Specification entries which are used in all regions and all instance types
	//
	// Additional properties allowed
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/get-worker-type-response.json#/properties/launchSpec
	LaunchSpec json.RawMessage `json:"launchSpec"`

	// Maximum number of capacity units to be provisioned.
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/get-worker-type-response.json#/properties/maxCapacity
	MaxCapacity float64 `json:"maxCapacity"`

	// Maximum price we'll pay.  Like minPrice, this takes into account the
	// utility factor when figuring out what the actual SpotPrice submitted
	// to Amazon will be
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/get-worker-type-response.json#/properties/maxPrice
	MaxPrice float64 `json:"maxPrice"`

	// Minimum number of capacity units to be provisioned.  A capacity unit
	// is an abstract unit of capacity, where one capacity unit is roughly
	// one task which should be taken off the queue
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/get-worker-type-response.json#/properties/minCapacity
	MinCapacity float64 `json:"minCapacity"`

	// Minimum price to pay for an instance.  A Price is considered to be the
	// Amazon Spot Price multiplied by the utility factor of the InstantType
	// as specified in the instanceTypes list.  For example, if the minPrice
	// is set to $0.5 and the utility factor is 2, the actual minimum bid
	// used will be $0.25
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/get-worker-type-response.json#/properties/minPrice
	MinPrice float64 `json:"minPrice"`

	// A string which identifies the owner of this worker type
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/get-worker-type-response.json#/properties/owner
	Owner string `json:"owner"`

	// See http://schemas.taskcluster.net/aws-provisioner/v1/get-worker-type-response.json#/properties/regions
	Regions []RegionConfiguration `json:"regions"`

	// A scaling ratio of `0.2` means that the provisioner will attempt to keep
	// the number of pending tasks around 20% of the provisioned capacity.
	// This results in pending tasks waiting 20% of the average task execution
	// time before starting to run.
	// A higher scaling ratio often results in better utilization and longer
	// waiting times. For workerTypes running long tasks a short scaling ratio
	// may be preferred, but for workerTypes running quick tasks a higher scaling
	// ratio may increase utilization without major delays.
	// If using a scaling ratio of 0, the provisioner will attempt to keep the
	// capacity of pending spot requests equal to the number of pending tasks.
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/get-worker-type-response.json#/properties/scalingRatio
	ScalingRatio float64 `json:"scalingRatio"`

	// Scopes to issue credentials to for all regions.  Scopes must be composed
	// of printable ASCII characters and spaces.
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/get-worker-type-response.json#/properties/scopes
	Scopes []string `json:"scopes"`

	// Static secrets entries which are used in all regions and all instance types
	//
	// Additional properties allowed
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/get-worker-type-response.json#/properties/secrets
	Secrets json.RawMessage `json:"secrets"`

	// UserData entries which are used in all regions and all instance types
	//
	// Additional properties allowed
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/get-worker-type-response.json#/properties/userData
	UserData json.RawMessage `json:"userData"`

	// The ID of the workerType
	//
	// Syntax:     ^[A-Za-z0-9+/=_-]{1,22}$
	//
	// See http://schemas.taskcluster.net/aws-provisioner/v1/get-worker-type-response.json#/properties/workerType
	WorkerType string `json:"workerType"`
}

A worker launchSpecification and required metadata

See http://schemas.taskcluster.net/aws-provisioner/v1/get-worker-type-response.json#

Jump to

Keyboard shortcuts

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