builder

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: May 29, 2018 License: MIT Imports: 39 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PullSecretName is the name of the docker pull secret draft will create in the desired destination namespace
	PullSecretName = "draft-pullsecret"
	// DefaultServiceAccountName is the name of the default service account draft will modify with the imagepullsecret
	DefaultServiceAccountName = "default"
)

Variables

View Source
var (
	// ErrChartNotExist is returned when no chart/ directory exists during "draft up."
	ErrChartNotExist = errors.New("chart/ does not exist. Please create it using 'draft create' before calling 'draft up'")
	// ErrDockerfileNotExist is returned when no Dockerfile exists during "draft up."
	ErrDockerfileNotExist = errors.New("Dockerfile does not exist. Please create it using 'draft create' before calling 'draft up'")
)
View Source
var SummaryStatusCodeName = map[int]string{
	0: "UNKNOWN",
	1: "LOGGING",
	2: "STARTED",
	3: "ONGOING",
	4: "SUCCESS",
	5: "FAILURE",
}

SummaryStatusCodeName is the relation between summary status code enums and their respective names.

Functions

func Complete added in v0.14.0

func Complete(id, desc string, out chan<- *Summary, err *error)

Complete marks the end of a draft build stage.

func Summarize added in v0.14.0

func Summarize(id, desc string, out chan<- *Summary) func(string, SummaryStatusCode)

Summarize returns a function closure that wraps writing SummaryStatusCode.

Types

type AppContext

type AppContext struct {
	Obj       *storage.Object
	Bldr      *Builder
	Ctx       *Context
	Buf       *bytes.Buffer
	MainImage string
	Images    []string
	Log       io.WriteCloser
	ID        string
	Vals      chartutil.Values
}

AppContext contains state information carried across the various draft stage boundaries.

type Builder

type Builder struct {
	ID               string
	ContainerBuilder ContainerBuilder
	Helm             helm.Interface
	Kube             k8s.Interface
	Storage          storage.Store
	LogsDir          string
}

Builder contains information about the build environment

func New added in v0.14.0

func New() *Builder

New creates a new Builder.

func (*Builder) Logs added in v0.13.0

func (b *Builder) Logs(appName string) string

Logs returns the path to the build logs.

Set after Up is called (otherwise "").

func (*Builder) Up

func (b *Builder) Up(ctx context.Context, bctx *Context) <-chan *Summary

Up handles incoming draft up requests and returns a stream of summaries or error.

type ContainerBuilder added in v0.14.0

type ContainerBuilder interface {
	Build(ctx context.Context, app *AppContext, out chan<- *Summary) error
	Push(ctx context.Context, app *AppContext, out chan<- *Summary) error
	AuthToken(ctx context.Context, app *AppContext) (string, error)
}

ContainerBuilder defines how a container is built and pushed to a container registry using the supplied app context.

type Context

type Context struct {
	Env     *manifest.Environment
	EnvName string
	AppDir  string
	Chart   *chart.Chart
	Values  *chart.Config
	SrcName string
	Archive []byte
}

Context contains information about the application

func LoadWithEnv

func LoadWithEnv(appdir, whichenv string) (*Context, error)

LoadWithEnv takes the directory of the application and the environment the application

will be pushed to and returns a Context object with a merge of environment and app
information

func (*Context) Watch

func (buildctx *Context) Watch(ctx context.Context, stream chan<- *Context) (err error)

Watch watches for inotify events in the build context's application directory, returning events to the stream

type DockerConfigEntryWithAuth added in v0.13.0

type DockerConfigEntryWithAuth struct {
	// +optional
	Username string `json:"username,omitempty"`
	// +optional
	Password string `json:"password,omitempty"`
	// +optional
	Email string `json:"email,omitempty"`
	// +optional
	Auth string `json:"auth,omitempty"`
}

DockerConfigEntryWithAuth is used solely for translating docker's AuthConfig token into a credentialprovider.dockerConfigEntry during JSON deserialization.

pulled from https://github.com/kubernetes/kubernetes/blob/97892854cfa736315378cc2c206a7f4b3e190d05/pkg/credentialprovider/config.go#L232-L243

func FromAuthConfig added in v0.13.0

func FromAuthConfig(ac types.AuthConfig) *DockerConfigEntryWithAuth

FromAuthConfig converts a docker auth token into type DockerConfigEntryWithAuth. This allows us to Marshal the object into a Kubernetes registry auth secret.

func FromAuthConfigToken added in v0.13.0

func FromAuthConfigToken(authToken string) (*DockerConfigEntryWithAuth, error)

FromAuthConfigToken converts a docker auth token into type DockerConfigEntryWithAuth. This allows us to Marshal the object into a Kubernetes registry auth secret.

type Summary

type Summary struct {
	// StageDesc describes the particular stage this summary
	// represents, e.g. "Build Docker Image." This is meant
	// to be a canonical summary of the stage's intent.
	StageDesc string `json:"stage_desc,omitempty"`
	// status_text indicates a string description of the progress
	// or completion of draft up.
	StatusText string `json:"status_text,omitempty"`
	// status_code indicates the status of the progress or
	// completion of a draft up.
	StatusCode SummaryStatusCode `json:"status_code,omitempty"`
	// build_id is the build identifier associated with this draft up build.
	BuildID string `json:"build_id,omitempty"`
}

Summary is the message returned when executing a draft up.

type SummaryStatusCode

type SummaryStatusCode int

SummaryStatusCode is the enumeration of the possible status codes returned for a draft up.

const (
	// SummaryUnknown means that the status of `draft up` is in an unknown state.
	SummaryUnknown SummaryStatusCode = iota
	// SummaryLogging means that the status is currently gathering and exporting logs.
	SummaryLogging
	// SummaryStarted means that `draft up` has begun.
	SummaryStarted
	// SummaryOngoing means that `draft up` is ongoing and we are waiting for further information from the builder.
	SummaryOngoing
	// SummarySuccess means that `draft up` has succeeded.
	SummarySuccess
	// SummaryFailure means that `draft up` has failed. Usually this can be followed up by checking the build logs.
	SummaryFailure
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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