manifest

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package manifest provides functionality to create Manifest files.

Index

Constants

View Source
const (
	GithubProviderName    = "GitHub"
	GithubSecretIdKeyName = "access_token_secret"
)
View Source
const (
	// LoadBalancedWebServiceType is a web service with a load balancer and Fargate as compute.
	LoadBalancedWebServiceType = "Load Balanced Web Service"
	// BackendServiceType is a service that cannot be accessed from the internet but can be reached from other services.
	BackendServiceType = "Backend Service"
)
View Source
const (

	// LogRetentionInDays is the default log retention time in days.
	LogRetentionInDays = 30
)

Variables

ServiceTypes are the supported service manifest types.

Functions

func UnmarshalService added in v0.1.0

func UnmarshalService(in []byte) (interface{}, error)

UnmarshalService deserializes the YAML input stream into a service manifest object. If an error occurs during deserialization, then returns the error. If the service type in the manifest is invalid, then returns an ErrInvalidManifestType.

Types

type BackendService added in v0.1.0

type BackendService struct {
	Service              `yaml:",inline"`
	BackendServiceConfig `yaml:",inline"`
	// Use *BackendServiceConfig because of https://github.com/imdario/mergo/issues/146
	Environments map[string]*BackendServiceConfig `yaml:",flow"`
	// contains filtered or unexported fields
}

BackendService holds the configuration to create a backend service manifest.

func NewBackendService added in v0.1.0

func NewBackendService(props BackendServiceProps) *BackendService

NewBackendService applies the props to a default backend service configuration with minimal task sizes, single replica, no healthcheck, and then returns it.

func (BackendService) ApplyEnv added in v0.1.0

func (s BackendService) ApplyEnv(envName string) (*BackendService, error)

ApplyEnv returns the service manifest with environment overrides. If the environment passed in does not have any overrides then it returns itself.

func (*BackendService) DockerfilePath added in v0.1.0

func (s *BackendService) DockerfilePath() string

DockerfilePath returns the image build path.

func (*BackendService) MarshalBinary added in v0.1.0

func (s *BackendService) MarshalBinary() ([]byte, error)

MarshalBinary serializes the manifest object into a binary YAML document. Implements the encoding.BinaryMarshaler interface.

type BackendServiceConfig added in v0.1.0

type BackendServiceConfig struct {
	Image      imageWithPortAndHealthcheck `yaml:",flow"`
	TaskConfig `yaml:",inline"`
	*LogConfig `yaml:"logging,flow"`
	Sidecar    `yaml:",inline"`
}

BackendServiceConfig holds the configuration that can be overriden per environments.

func (*BackendServiceConfig) LogConfigOpts added in v0.1.0

func (bc *BackendServiceConfig) LogConfigOpts() *template.LogConfigOpts

LogConfigOpts converts the service's Firelens configuration into a format parsable by the templates pkg.

type BackendServiceProps added in v0.1.0

type BackendServiceProps struct {
	ServiceProps
	Port        uint16
	HealthCheck *ContainerHealthCheck // Optional healthcheck configuration.
}

BackendServiceProps represents the configuration needed to create a backend service.

type ContainerHealthCheck added in v0.0.8

type ContainerHealthCheck struct {
	Command     []string       `yaml:"command"`
	Interval    *time.Duration `yaml:"interval"`
	Retries     *int           `yaml:"retries"`
	Timeout     *time.Duration `yaml:"timeout"`
	StartPeriod *time.Duration `yaml:"start_period"`
}

ContainerHealthCheck holds the configuration to determine if the service container is healthy. See https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-healthcheck.html

type ErrInvalidPipelineManifestVersion

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

ErrInvalidPipelineManifestVersion occurs when the pipeline.yml file contains invalid schema version during unmarshalling.

func (*ErrInvalidPipelineManifestVersion) Error

func (*ErrInvalidPipelineManifestVersion) Is

Is compares the 2 errors. Only returns true if the errors are of the same type and contain the same information.

type ErrInvalidSvcManifestType added in v0.1.0

type ErrInvalidSvcManifestType struct {
	Type string
}

ErrInvalidSvcManifestType occurs when a user requested a manifest template type that doesn't exist.

func (*ErrInvalidSvcManifestType) Error added in v0.1.0

func (e *ErrInvalidSvcManifestType) Error() string

type ErrUnknownProvider

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

ErrUnknownProvider occurs CreateProvider() is called with configurations that do not map to any supported provider.

func (*ErrUnknownProvider) Error

func (e *ErrUnknownProvider) Error() string

func (*ErrUnknownProvider) Is

func (e *ErrUnknownProvider) Is(target error) bool

Is compares the 2 errors. Returns true if the errors are of the same type

type GitHubProperties

type GitHubProperties struct {

	// An example for OwnerAndRepository would be: "aws/copilot"
	OwnerAndRepository    string `structs:"repository" yaml:"repository"`
	Branch                string `structs:"branch" yaml:"branch"`
	GithubSecretIdKeyName string `structs:"access_token_secret" yaml:"access_token_secret` // TODO fix naming
}

GitHubProperties contain information for configuring a Github source provider.

type LoadBalancedWebService added in v0.1.0

type LoadBalancedWebService struct {
	Service                      `yaml:",inline"`
	LoadBalancedWebServiceConfig `yaml:",inline"`
	// Use *LoadBalancedWebServiceConfig because of https://github.com/imdario/mergo/issues/146
	Environments map[string]*LoadBalancedWebServiceConfig `yaml:",flow"` // Fields to override per environment.
	// contains filtered or unexported fields
}

LoadBalancedWebService holds the configuration to build a container image with an exposed port that receives requests through a load balancer with AWS Fargate as the compute engine.

func NewLoadBalancedWebService added in v0.1.0

func NewLoadBalancedWebService(input *LoadBalancedWebServiceProps) *LoadBalancedWebService

NewLoadBalancedWebService creates a new public load balanced web service, receives all the requests from the load balancer, has a single task with minimal CPU and memory thresholds, and sets the default health check path to "/".

func (LoadBalancedWebService) ApplyEnv added in v0.1.0

ApplyEnv returns the service manifest with environment overrides. If the environment passed in does not have any overrides then it returns itself.

func (*LoadBalancedWebService) DockerfilePath added in v0.1.0

func (s *LoadBalancedWebService) DockerfilePath() string

DockerfilePath returns the image build path.

func (*LoadBalancedWebService) MarshalBinary added in v0.1.0

func (s *LoadBalancedWebService) MarshalBinary() ([]byte, error)

MarshalBinary serializes the manifest object into a binary YAML document. Implements the encoding.BinaryMarshaler interface.

type LoadBalancedWebServiceConfig added in v0.1.0

type LoadBalancedWebServiceConfig struct {
	Image       ServiceImageWithPort `yaml:",flow"`
	RoutingRule `yaml:"http,flow"`
	TaskConfig  `yaml:",inline"`
	*LogConfig  `yaml:"logging,flow"`
	Sidecar     `yaml:",inline"`
}

LoadBalancedWebServiceConfig holds the configuration for a load balanced web service.

func (*LoadBalancedWebServiceConfig) LogConfigOpts added in v0.1.0

LogConfigOpts converts the service's Firelens configuration into a format parsable by the templates pkg.

type LoadBalancedWebServiceProps added in v0.1.0

type LoadBalancedWebServiceProps struct {
	*ServiceProps
	Path string
	Port uint16
}

LoadBalancedWebServiceProps contains properties for creating a new load balanced fargate service manifest.

type LogConfig added in v0.1.0

type LogConfig struct {
	Image          *string           `yaml:"image"`
	Destination    map[string]string `yaml:"destination,flow"`
	EnableMetadata *bool             `yaml:"enableMetadata"`
	SecretOptions  map[string]string `yaml:"secretOptions"`
	ConfigFile     *string           `yaml:"configFilePath"`
}

LogConfig holds configuration for Firelens to route your logs.

type PipelineManifest

type PipelineManifest struct {
	// Name of the pipeline
	Name    string                     `yaml:"name"`
	Version PipelineSchemaMajorVersion `yaml:"version"`
	Source  *Source                    `yaml:"source"`
	Stages  []PipelineStage            `yaml:"stages"`
	// contains filtered or unexported fields
}

PipelineManifest contains information that defines the relationship and deployment ordering of your environments.

func CreatePipeline

func CreatePipeline(pipelineName string, provider Provider, stageNames []string) (*PipelineManifest, error)

CreatePipeline returns a pipeline manifest object.

func UnmarshalPipeline

func UnmarshalPipeline(in []byte) (*PipelineManifest, error)

UnmarshalPipeline deserializes the YAML input stream into a pipeline manifest object. It returns an error if any issue occurs during deserialization or the YAML input contains invalid fields.

func (*PipelineManifest) MarshalBinary added in v0.0.6

func (m *PipelineManifest) MarshalBinary() ([]byte, error)

MarshalBinary serializes the pipeline manifest object into byte array that represents the pipeline.yml document.

type PipelineSchemaMajorVersion

type PipelineSchemaMajorVersion int

PipelineSchemaMajorVersion is the major version number of the pipeline manifest schema

const (
	// Ver1 is the current schema major version of the pipeline.yml file.
	Ver1 PipelineSchemaMajorVersion = iota + 1
)

type PipelineStage

type PipelineStage struct {
	Name         string   `yaml:"name"`
	TestCommands []string `yaml:"test_commands,omitempty"`
}

PipelineStage represents a stage in the pipeline manifest

type Provider

type Provider interface {
	fmt.Stringer
	Name() string
	Properties() map[string]interface{}
}

Provider defines a source of the artifacts that will be built and deployed via a pipeline

func NewProvider

func NewProvider(configs interface{}) (Provider, error)

NewProvider creates a source provider based on the type of the provided provider-specific configurations

type RoutingRule

type RoutingRule struct {
	Path            *string `yaml:"path"`
	HealthCheckPath *string `yaml:"healthcheck"`
	// TargetContainer is the container load balancer routes traffic to.
	TargetContainer *string `yaml:"targetContainer"`
}

RoutingRule holds the path to route requests to the service.

type Service added in v0.1.0

type Service struct {
	Name *string `yaml:"name"`
	Type *string `yaml:"type"` // must be one of the supported manifest types.
}

Service holds the basic data that every service manifest file needs to have.

type ServiceImage added in v0.1.0

type ServiceImage struct {
	Build *string `yaml:"build"` // Path to the Dockerfile.
}

ServiceImage represents the service's container image.

type ServiceImageWithPort added in v0.1.0

type ServiceImageWithPort struct {
	ServiceImage `yaml:",inline"`
	Port         *uint16 `yaml:"port"`
}

ServiceImageWithPort represents a container image with an exposed port.

type ServiceProps added in v0.1.0

type ServiceProps struct {
	Name       string
	Dockerfile string
}

ServiceProps contains properties for creating a new service manifest.

type Sidecar added in v0.1.0

type Sidecar struct {
	Sidecars map[string]*SidecarConfig `yaml:"sidecars"`
}

Sidecar holds configuration for all sidecar containers in a service.

func (*Sidecar) SidecarsOpts added in v0.1.0

func (s *Sidecar) SidecarsOpts() ([]*template.SidecarOpts, error)

SidecarsOpts converts the service's sidecar configuration into a format parsable by the templates pkg.

type SidecarConfig added in v0.1.0

type SidecarConfig struct {
	Port       *string `yaml:"port"`
	Image      *string `yaml:"image"`
	CredsParam *string `yaml:"credentialsParameter"`
}

SidecarConfig represents the configurable options for setting up a sidecar container.

type Source

type Source struct {
	ProviderName string                 `yaml:"provider"`
	Properties   map[string]interface{} `yaml:"properties"`
}

Source defines the source of the artifacts to be built and deployed.

type TaskConfig added in v0.0.8

type TaskConfig struct {
	CPU       *int              `yaml:"cpu"`
	Memory    *int              `yaml:"memory"`
	Count     *int              `yaml:"count"` // 0 is a valid value, so we want the default value to be nil.
	Variables map[string]string `yaml:"variables"`
	Secrets   map[string]string `yaml:"secrets"`
}

TaskConfig represents the resource boundaries and environment variables for the containers in the task.

Jump to

Keyboard shortcuts

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