deploy

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetEnvFromConfig

func GetEnvFromConfig(config map[string]interface{}) (map[string]string, error)

GetEnvFromConfig gets the env vars for a standard Porter template config. These env vars are found at `container.env.normal`.

func ResolveDockerPaths added in v0.6.0

func ResolveDockerPaths(
	basePath string,
	buildContextPath string,
	dockerfilePath string,
) (
	resBuildCtxPath string,
	resDockerfilePath string,
	isDockerfileRelative bool,
	err error,
)

ResolveDockerPaths returns a path to the dockerfile that is either relative or absolute, and a path to the build context that is absolute.

The return value will be relative if the dockerfile exists within the build context, absolute otherwise. The second return value is true if the dockerfile exists within the build context, false otherwise.

Types

type BuildAgent

type BuildAgent struct {
	*SharedOpts
	// contains filtered or unexported fields
}

BuildAgent builds a new Docker container image for a new version of an application

func (*BuildAgent) BuildDocker

func (b *BuildAgent) BuildDocker(
	dockerAgent *docker.Agent,
	basePath,
	buildCtx,
	dockerfilePath,
	tag string,
) error

BuildDocker uses the local Docker daemon to build the image

func (*BuildAgent) BuildPack

func (b *BuildAgent) BuildPack(dockerAgent *docker.Agent, dst, tag string) error

BuildPack uses the cloud-native buildpack client to build a container image

type CreateAgent

type CreateAgent struct {
	Client     *api.Client
	CreateOpts *CreateOpts
}

CreateAgent handles the creation of a new application on Porter

func (*CreateAgent) CreateFromDocker

func (c *CreateAgent) CreateFromDocker(
	overrideValues map[string]interface{},
) (string, error)

CreateFromDocker uses a local build context and a local Docker daemon to build a new container image, and then deploys it onto Porter.

func (*CreateAgent) CreateFromGithub

func (c *CreateAgent) CreateFromGithub(
	ghOpts *GithubOpts,
	overrideValues map[string]interface{},
) (string, error)

CreateFromGithub uses the branch/repo to link the Github source for an application. This function attempts to find a matching repository in the list of linked repositories on Porter. If one is found, it will use that repository as the app source.

func (*CreateAgent) CreateFromRegistry

func (c *CreateAgent) CreateFromRegistry(
	image string,
	overrideValues map[string]interface{},
) (string, error)

CreateFromRegistry deploys a new application from an existing Docker repository + tag.

func (*CreateAgent) CreateSubdomainIfRequired

func (c *CreateAgent) CreateSubdomainIfRequired(mergedValues map[string]interface{}) (string, error)

func (*CreateAgent) GetImageRepoURL

func (c *CreateAgent) GetImageRepoURL(name, namespace string) (uint, string, error)

GetImageRepoURL creates the image repository url by finding the first valid image registry linked to Porter, and then generates a new name of the form: `{registry}/{name}-{namespace}`

func (*CreateAgent) GetLatestTemplateDefaultValues

func (c *CreateAgent) GetLatestTemplateDefaultValues(templateName, templateVersion string) (map[string]interface{}, error)

GetLatestTemplateDefaultValues gets the default config (`values.yaml`) set for a specific template.

func (*CreateAgent) GetLatestTemplateVersion

func (c *CreateAgent) GetLatestTemplateVersion(templateName string) (string, error)

GetLatestTemplateVersion retrieves the latest template version for a specific Porter template from the chart repository.

func (*CreateAgent) HasDefaultDockerfile

func (c *CreateAgent) HasDefaultDockerfile(buildPath string) bool

HasDefaultDockerfile detects if there is a dockerfile at the path `./Dockerfile`

type CreateOpts

type CreateOpts struct {
	*SharedOpts

	Kind        string
	ReleaseName string
	RegistryURL string
}

CreateOpts are required options for creating a new application on Porter: the "kind" (web, worker, job) and the name of the application.

type DeployAgent

type DeployAgent struct {
	App string
	// contains filtered or unexported fields
}

DeployAgent handles the deployment and redeployment of an application on Porter

func NewDeployAgent

func NewDeployAgent(client *client.Client, app string, opts *DeployOpts) (*DeployAgent, error)

NewDeployAgent creates a new DeployAgent given a Porter API client, application name, and DeployOpts.

func (*DeployAgent) Build

func (d *DeployAgent) Build() error

Build uses the deploy agent options to build a new container image from either buildpack or docker.

func (*DeployAgent) GetBuildEnv

func (d *DeployAgent) GetBuildEnv() (map[string]string, error)

GetBuildEnv retrieves the build env from the release config and returns it

func (*DeployAgent) Push

func (d *DeployAgent) Push() error

Push pushes a local image to the remote repository linked in the release

func (*DeployAgent) SetBuildEnv

func (d *DeployAgent) SetBuildEnv(envVars map[string]string) error

SetBuildEnv sets the build env vars in the process so that other commands can use them

func (*DeployAgent) StreamEvent added in v0.9.0

func (d *DeployAgent) StreamEvent(event types.SubEvent) error

func (*DeployAgent) UpdateImageAndValues

func (d *DeployAgent) UpdateImageAndValues(overrideValues map[string]interface{}) error

UpdateImageAndValues updates the current image for a release, along with new configuration passed in via overrrideValues. If overrideValues is nil, it just reuses the configuration set for the application. If overrideValues is not nil, it will merge the overriding values with the existing configuration.

func (*DeployAgent) WriteBuildEnv

func (d *DeployAgent) WriteBuildEnv(fileDest string) error

WriteBuildEnv writes the build env to either a file or stdout

type DeployBuildType

type DeployBuildType string

DeployBuildType is the option to use as a builder

const (
	// uses local Docker daemon to build and push images
	DeployBuildTypeDocker DeployBuildType = "docker"

	// uses cloud-native build pack to build and push images
	DeployBuildTypePack DeployBuildType = "pack"
)

type DeployOpts

type DeployOpts struct {
	*SharedOpts

	Local bool
}

DeployOpts are the options for creating a new DeployAgent

type GithubOpts

type GithubOpts struct {
	Branch string
	Repo   string
}

GithubOpts are the options for linking a Github source to the app

type NestedMapFieldNotFoundError

type NestedMapFieldNotFoundError struct {
	Field string
}

func (*NestedMapFieldNotFoundError) Error

type SharedOpts

type SharedOpts struct {
	ProjectID       uint
	ClusterID       uint
	Namespace       string
	LocalPath       string
	LocalDockerfile string
	OverrideTag     string
	Method          DeployBuildType
}

SharedOpts are common options for build, create, and deploy agents

Jump to

Keyboard shortcuts

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