cloudrun

package
v0.11.4 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2023 License: MPL-2.0 Imports: 27 Imported by: 0

README

Google Cloud Run

The Google Cloud Run plugin deploys a container to Google Cloud Run.

Components

  1. Platform
  2. ReleaseManager
  1. Docker

Resources

  1. Google Cloud Run service

Documentation

Overview

Package cloudrun contains components for deploying to Google Cloud Run.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidAutoscalingMax = fmt.Errorf("AutoScaling maximum must be larger than 0\n")
View Source
var ErrInvalidCPUCount = fmt.Errorf("Invalid value for CPUCount, it is currently only possible to specify '1' or '2' CPUs\n")
View Source
var ErrInvalidMaxRequests = fmt.Errorf("MaxRequestsPerContainer must be greater than 0\n")
View Source
var ErrInvalidMemoryValue = fmt.Errorf("Memory allocated to a Cloud run instance must a minimum of 128MB and less than 4096 (4GB)\n'")
View Source
var ErrInvalidRequestTimetout = fmt.Errorf("RequestTimeout must be greater than 0 and lets than 900\n")
View Source
var ErrInvalidVPCAccessEgress = fmt.Errorf("Invalid value for Egress, possible values: 'all' and 'private-ranges-only'\n")
View Source
var File_waypoint_builtin_google_cloudrun_plugin_proto protoreflect.FileDescriptor
View Source
var Options = []sdk.Option{
	sdk.WithComponents(&Platform{}, &Releaser{}),
}

Options are the SDK options to use for instantiation for the Google Cloud Run plugin.

Functions

This section is empty.

Types

type AutoScaling

type AutoScaling struct {
	//Min int `hcl:"min,attr"` // not yet supported by cloud run
	Max int `hcl:"max,attr" validate:"gte=0"`
}

AutoScaling defines the parameters which the Cloud Run instance can AutoScale. Currently only the maximum bound is supported

type Capacity

type Capacity struct {
	// Memory to allocate to the container specified in MB, min 128, max 4096.
	// Default value of 0 sets memory to 128MB which is default Cloud Run behaviour
	Memory int `hcl:"memory,attr" validate:"eq=0|gte=128,lte=4096"`
	// CPUCount is the number CPUs to allocate to a Cloud Run instance.
	CPUCount int `hcl:"cpu_count,attr" validate:"gte=0,lte=2"`
	// Maximum request time in seconds, max 900.
	RequestTimeout int `hcl:"request_timeout,attr" validate:"gte=0,lte=900"`
	// Maximum number of concurrent requests per container instance.
	// When max requests is exceeded Cloud Run will scale the number of containers.
	MaxRequestsPerContainer int `hcl:"max_requests_per_container,attr" validate:"gte=0"`
}

Capacity defines configuration for deployed Cloud Run resources

type Config

type Config struct {
	// Project is the project to deploy to
	Project string `hcl:"project,attr"`

	// Location	represents the Google Cloud location where the application will be deployed
	// e.g. us-west1
	Location string `hcl:"location,attr"`

	// Unauthenticated, if set to true, will allow unauthenticated access
	// to your deployment. This defaults to true.
	Unauthenticated *bool `hcl:"unauthenticated,optional"`

	// Port the applications is listening on.
	Port int `hcl:"port,optional"`

	// Environment variables that are meant to configure the application in a static
	// way. This might be control an image that has multiple modes of operation,
	// selected via environment variable. Most configuration should use the waypoint
	// config commands.
	StaticEnvVars map[string]string `hcl:"static_environment,optional"`

	// Capacity details for cloud run container.
	Capacity *Capacity `hcl:"capacity,block"`

	// AutoScaling details.
	AutoScaling *AutoScaling `hcl:"auto_scaling,block"`

	// Service Account details
	ServiceAccountName string `hcl:"service_account_name,optional"`

	// CloudSQLInstances that the application can connect to.
	CloudSQLInstances []string `hcl:"cloudsql_instances,optional"`

	// VPCAccess details.
	VPCAccess *VPCAccess `hcl:"vpc_access,block"`
}

Config is the configuration structure for the Platform. Validation tags are provided by Go Pkg Validator https://pkg.go.dev/gopkg.in/go-playground/validator.v10?tab=doc

type Deployment

type Deployment struct {
	Url           string               `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"`
	Resource      *Deployment_Resource `protobuf:"bytes,2,opt,name=resource,proto3" json:"resource,omitempty"`
	RevisionId    string               `protobuf:"bytes,3,opt,name=revision_id,json=revisionId,proto3" json:"revision_id,omitempty"`
	Region        string               `protobuf:"bytes,4,opt,name=region,proto3" json:"region,omitempty"`
	Id            string               `protobuf:"bytes,5,opt,name=id,proto3" json:"id,omitempty"`
	ResourceState *opaqueany.Any       `protobuf:"bytes,6,opt,name=resource_state,json=resourceState,proto3" json:"resource_state,omitempty"`
	// contains filtered or unexported fields
}

func (*Deployment) Descriptor deprecated

func (*Deployment) Descriptor() ([]byte, []int)

Deprecated: Use Deployment.ProtoReflect.Descriptor instead.

func (*Deployment) GetId

func (x *Deployment) GetId() string

func (*Deployment) GetRegion

func (x *Deployment) GetRegion() string

func (*Deployment) GetResource

func (x *Deployment) GetResource() *Deployment_Resource

func (*Deployment) GetResourceState added in v0.5.0

func (x *Deployment) GetResourceState() *opaqueany.Any

func (*Deployment) GetRevisionId

func (x *Deployment) GetRevisionId() string

func (*Deployment) GetUrl

func (x *Deployment) GetUrl() string

func (*Deployment) ProtoMessage

func (*Deployment) ProtoMessage()

func (*Deployment) ProtoReflect

func (x *Deployment) ProtoReflect() protoreflect.Message

func (*Deployment) Reset

func (x *Deployment) Reset()

func (*Deployment) String

func (x *Deployment) String() string

type Deployment_Resource

type Deployment_Resource struct {
	Location string `protobuf:"bytes,1,opt,name=location,proto3" json:"location,omitempty"`
	Project  string `protobuf:"bytes,2,opt,name=project,proto3" json:"project,omitempty"`
	Name     string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
	// contains filtered or unexported fields
}

func (*Deployment_Resource) Descriptor deprecated

func (*Deployment_Resource) Descriptor() ([]byte, []int)

Deprecated: Use Deployment_Resource.ProtoReflect.Descriptor instead.

func (*Deployment_Resource) GetLocation

func (x *Deployment_Resource) GetLocation() string

func (*Deployment_Resource) GetName

func (x *Deployment_Resource) GetName() string

func (*Deployment_Resource) GetProject

func (x *Deployment_Resource) GetProject() string

func (*Deployment_Resource) ProtoMessage

func (*Deployment_Resource) ProtoMessage()

func (*Deployment_Resource) ProtoReflect

func (x *Deployment_Resource) ProtoReflect() protoreflect.Message

func (*Deployment_Resource) Reset

func (x *Deployment_Resource) Reset()

func (*Deployment_Resource) String

func (x *Deployment_Resource) String() string

type Platform

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

Platform is the Platform implementation for Google Cloud Run.

func (*Platform) Auth

func (p *Platform) Auth() error

func (*Platform) AuthFunc

func (p *Platform) AuthFunc() interface{}

AuthFunc implements component.Authenticator

func (*Platform) Config

func (p *Platform) Config() (interface{}, error)

Config implements Configurable

func (*Platform) ConfigSet

func (p *Platform) ConfigSet(config interface{}) error

ConfigSet is called after a configuration has been decoded we can use this to validate the config

func (*Platform) DefaultReleaserFunc added in v0.1.5

func (p *Platform) DefaultReleaserFunc() interface{}

DefaultReleaserFunc implements component.PlatformReleaser

func (*Platform) Deploy

func (p *Platform) Deploy(
	ctx context.Context,
	log hclog.Logger,
	src *component.Source,
	img *docker.Image,
	deployConfig *component.DeploymentConfig,
	ui terminal.UI,
) (*Deployment, error)

Deploy deploys an image to Cloud Run.

func (*Platform) DeployFunc

func (p *Platform) DeployFunc() interface{}

DeployFunc implements component.Platform

func (*Platform) Destroy

func (p *Platform) Destroy(
	ctx context.Context,
	log hclog.Logger,
	deployment *Deployment,
	ui terminal.UI,
) error

Destroy deletes the cloud run revision

func (*Platform) DestroyFunc

func (p *Platform) DestroyFunc() interface{}

DestroyFunc implements component.Destroyer

func (*Platform) DestroyWorkspace added in v0.5.0

func (p *Platform) DestroyWorkspace(
	ctx context.Context,
	log hclog.Logger,
	deployment *Deployment,
	ui terminal.UI,
) error

func (*Platform) DestroyWorkspaceFunc added in v0.5.0

func (p *Platform) DestroyWorkspaceFunc() interface{}

DestroyWorkspaceFunc implements component.WorkspaceDestroyer

func (*Platform) Documentation

func (p *Platform) Documentation() (*docs.Documentation, error)

func (*Platform) ValidateAuth

func (p *Platform) ValidateAuth(
	ctx context.Context,
	log hclog.Logger,
	src *component.Source,
	ui terminal.UI,
) error

func (*Platform) ValidateAuthFunc

func (p *Platform) ValidateAuthFunc() interface{}

ValidateAuthFunc implements component.Authenticator

type Release

type Release struct {
	Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"`
	// contains filtered or unexported fields
}

func (*Release) Descriptor deprecated

func (*Release) Descriptor() ([]byte, []int)

Deprecated: Use Release.ProtoReflect.Descriptor instead.

func (*Release) GetUrl

func (x *Release) GetUrl() string

func (*Release) ProtoMessage

func (*Release) ProtoMessage()

func (*Release) ProtoReflect

func (x *Release) ProtoReflect() protoreflect.Message

func (*Release) Reset

func (x *Release) Reset()

func (*Release) String

func (x *Release) String() string

func (*Release) URL

func (r *Release) URL() string

type Releaser

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

Releaser is the ReleaseManager implementation for Google Cloud Run.

func (*Releaser) Config

func (r *Releaser) Config() (interface{}, error)

Config implements Configurable

func (*Releaser) Documentation

func (r *Releaser) Documentation() (*docs.Documentation, error)

func (*Releaser) Release

func (r *Releaser) Release(
	ctx context.Context,
	log hclog.Logger,
	ui terminal.UI,
	target *Deployment,
) (*Release, error)

Release deploys an image to GCR.

func (*Releaser) ReleaseFunc

func (r *Releaser) ReleaseFunc() interface{}

ReleaseFunc implements component.ReleaseManager

type ReleaserConfig

type ReleaserConfig struct{}

ReleaserConfig is the configuration structure for the Releaser.

type Resource added in v0.5.0

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

func (*Resource) Descriptor deprecated added in v0.5.0

func (*Resource) Descriptor() ([]byte, []int)

Deprecated: Use Resource.ProtoReflect.Descriptor instead.

func (*Resource) ProtoMessage added in v0.5.0

func (*Resource) ProtoMessage()

func (*Resource) ProtoReflect added in v0.5.0

func (x *Resource) ProtoReflect() protoreflect.Message

func (*Resource) Reset added in v0.5.0

func (x *Resource) Reset()

func (*Resource) String added in v0.5.0

func (x *Resource) String() string

type Resource_Service added in v0.5.0

type Resource_Service struct {
	ApiName      string `protobuf:"bytes,1,opt,name=api_name,json=apiName,proto3" json:"api_name,omitempty"`
	RevisionName string `protobuf:"bytes,2,opt,name=revision_name,json=revisionName,proto3" json:"revision_name,omitempty"`
	// contains filtered or unexported fields
}

func (*Resource_Service) Descriptor deprecated added in v0.5.0

func (*Resource_Service) Descriptor() ([]byte, []int)

Deprecated: Use Resource_Service.ProtoReflect.Descriptor instead.

func (*Resource_Service) GetApiName added in v0.5.0

func (x *Resource_Service) GetApiName() string

func (*Resource_Service) GetRevisionName added in v0.5.0

func (x *Resource_Service) GetRevisionName() string

func (*Resource_Service) ProtoMessage added in v0.5.0

func (*Resource_Service) ProtoMessage()

func (*Resource_Service) ProtoReflect added in v0.5.0

func (x *Resource_Service) ProtoReflect() protoreflect.Message

func (*Resource_Service) Reset added in v0.5.0

func (x *Resource_Service) Reset()

func (*Resource_Service) String added in v0.5.0

func (x *Resource_Service) String() string

type VPCAccess added in v0.3.2

type VPCAccess struct {
	// Connector sets Serverless VPC Access connector for the application.
	Connector string `hcl:"connector,optional"`

	// Egress sets VPC egress type. Supported values are `all` and `private-ranges-only`.
	Egress string `hcl:"egress,optional" validate:"oneof=all private-ranges-only"`
}

Jump to

Keyboard shortcuts

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