app

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: May 25, 2016 License: Apache-2.0 Imports: 48 Imported by: 0

Documentation

Overview

Package app defines reference objects used to generate OpenShift API objects

Index

Constants

This section is empty.

Variables

View Source
var ErrNameRequired = fmt.Errorf("you must specify a name for your app")

ErrNameRequired is the error returned by new-app when a name cannot be suggested and the user needs to provide one explicitly.

View Source
var ErrNoLanguageDetected = fmt.Errorf("No language matched the source repository")

ErrNoLanguageDetected is the error returned when no language can be detected by all source code detectors.

Functions

func ContainerPortsFromString added in v0.3.2

func ContainerPortsFromString(portString string) ([]kapi.ContainerPort, error)

ContainerPortsFromString extracts sets of port specifications from a comma-delimited string. Each segment must be a single port number (container port) or a colon delimited pair of ports (container port and host port).

func GenerateSecret added in v1.1.4

func GenerateSecret(n int) string

GenerateSecret generates a random secret string

func IsBuilderImage

func IsBuilderImage(image *imageapi.DockerImage) bool

IsBuilderImage checks whether the provided Docker image is a builder image or not

func IsBuilderMatch added in v1.0.7

func IsBuilderMatch(match *ComponentMatch) bool

func IsBuilderStreamTag added in v1.0.7

func IsBuilderStreamTag(stream *imageapi.ImageStream, tag string) bool

IsBuilderStreamTag checks whether the provided image stream tag is a builder image or not

func IsComponentReference

func IsComponentReference(s string) bool

IsComponentReference returns true if the provided string appears to be a reference to a source repository on disk, at a URL, a docker image name (which might be on a Docker registry or an OpenShift image stream), or a template.

func IsPossibleSourceRepository

func IsPossibleSourceRepository(s string) bool

IsPossibleSourceRepository checks whether the provided string is a source repository or not

func IsPossibleTemplateFile added in v0.5.4

func IsPossibleTemplateFile(value string) bool

IsPossibleTemplateFile returns true if the argument can be a template file

func IsRemoteRepository

func IsRemoteRepository(s string) bool

IsRemoteRepository checks whether the provided string is a remote repository or not

func JoinEnvironment

func JoinEnvironment(a, b []kapi.EnvVar) (out []kapi.EnvVar)

JoinEnvironment joins two different sets of environment variables into one, leaving out all the duplicates

func LabelsFromSpec added in v0.3.2

func LabelsFromSpec(spec []string) (map[string]string, []string, error)

LabelsFromSpec turns a set of specs NAME=VALUE or NAME- into a map of labels, a remove label list, or an error.

func StrategyAndSourceForRepository

func StrategyAndSourceForRepository(repo *SourceRepository, image *ImageRef) (*BuildStrategyRef, *SourceRef, error)

StrategyAndSourceForRepository returns the build strategy and source code reference of the provided source repository TODO: user should be able to choose whether to download a remote source ref for more info

Types

type Acceptor

type Acceptor interface {
	Accept(from interface{}) bool
}

Acceptor is an interface for accepting objects.

var AcceptAll Acceptor = acceptAll{}

AcceptAll accepts all objects.

var AcceptNew Acceptor = acceptNew{}

AcceptNew only accepts runtime.Objects with an empty resource version.

func NewAcceptBuildConfigs added in v0.6.1

func NewAcceptBuildConfigs(typer runtime.ObjectTyper) Acceptor

NewAcceptBuildConfigs creates an acceptor accepting BuildConfig objects and ImageStreams objects.

func NewAcceptFirst

func NewAcceptFirst() Acceptor

NewAcceptFirst returns a new Acceptor.

func NewAcceptUnique added in v0.4.4

func NewAcceptUnique(typer runtime.ObjectTyper) Acceptor

NewAcceptUnique creates an acceptor that only accepts unique objects by kind and name.

type Acceptors added in v0.4.4

type Acceptors []Acceptor

Acceptors is a list of acceptors that behave like a single acceptor. All acceptors must accept an object for it to be accepted.

func (Acceptors) Accept added in v0.4.4

func (aa Acceptors) Accept(from interface{}) bool

Accept iterates through all acceptors and determines whether the object should be accepted.

type BuildRef

type BuildRef struct {
	Source   *SourceRef
	Input    *ImageRef
	Strategy *BuildStrategyRef
	Output   *ImageRef
	Env      Environment
}

BuildRef is a reference to a build configuration

func (*BuildRef) BuildConfig

func (r *BuildRef) BuildConfig() (*buildapi.BuildConfig, error)

BuildConfig creates a buildConfig resource from the build configuration reference

type BuildStrategyRef

type BuildStrategyRef struct {
	IsDockerBuild bool
	Base          *ImageRef
}

BuildStrategyRef is a reference to a build strategy

func (*BuildStrategyRef) BuildStrategy

BuildStrategy builds an OpenShift BuildStrategy from a BuildStrategyRef

type BuildStrategyRefGenerator added in v0.5.1

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

BuildStrategyRefGenerator generates BuildStrategyRef

Flows for BuildStrategyRef SourceRef -> BuildStrategyRef SourceRef + Docker Context -> BuildStrategyRef Docker Context + Parent Image -> BuildStrategyRef STI Builder Image -> BuildStrategyRef

func NewBuildStrategyRefGenerator added in v0.5.1

func NewBuildStrategyRefGenerator(sourceDetectors source.Detectors) *BuildStrategyRefGenerator

NewBuildStrategyRefGenerator creates a BuildStrategyRefGenerator

func (*BuildStrategyRefGenerator) FromDockerContextAndParent added in v0.5.1

func (g *BuildStrategyRefGenerator) FromDockerContextAndParent(parentRef *ImageRef) (*BuildStrategyRef, error)

FromDockerContextAndParent generates a build strategy ref from a context path and parent image name

func (*BuildStrategyRefGenerator) FromSTIBuilderImage added in v0.5.1

func (g *BuildStrategyRefGenerator) FromSTIBuilderImage(image *ImageRef) (*BuildStrategyRef, error)

FromSTIBuilderImage generates a build strategy from a builder image ref

type CircularOutputReferenceError added in v1.1.1

type CircularOutputReferenceError struct {
	Reference string
}

CircularOutputReferenceError is the error returned by new-app when the input and output image stream tags are identical.

func (CircularOutputReferenceError) Error added in v1.1.1

type ComponentInput

type ComponentInput struct {
	GroupID  int
	From     string
	Argument string
	Value    string

	ExpectToBuild bool
	ScratchImage  bool

	Uses          *SourceRepository
	ResolvedMatch *ComponentMatch
	SearchMatches ComponentMatches

	Resolver
	Searcher
}

ComponentInput is the necessary input for creating a component

func NewComponentInput

func NewComponentInput(input string) (*ComponentInput, string, error)

NewComponentInput returns a new ComponentInput by checking for image using [image]~ (to indicate builder) or [image]~[code] (builder plus code)

func (*ComponentInput) Input

func (i *ComponentInput) Input() *ComponentInput

Input returns the component input

func (*ComponentInput) NeedsSource

func (i *ComponentInput) NeedsSource() bool

NeedsSource indicates if the component input needs source code

func (*ComponentInput) Resolve

func (i *ComponentInput) Resolve() error

Resolve sets the unique match in input

func (*ComponentInput) Search added in v1.0.4

func (i *ComponentInput) Search() error

Search sets the search matches in input

func (*ComponentInput) String

func (i *ComponentInput) String() string

func (*ComponentInput) Use

func (i *ComponentInput) Use(repo *SourceRepository)

Use adds the provided source repository as the used one by the component input

type ComponentMatch

type ComponentMatch struct {
	// what this is a match for (the value that was searched on)
	Value string
	// the argument to use to specify this match explicitly
	Argument string
	// the exact name of this match
	Name        string
	Description string
	Score       float32
	Insecure    bool
	LocalOnly   bool
	NoTagsFound bool
	// this match represents a scratch image, there is no
	// actual image/pullspec.
	Virtual bool

	// The source of the match. Generally only a single source is
	// available.
	Image       *imageapi.DockerImage
	ImageStream *imageapi.ImageStream
	ImageTag    string
	Template    *templateapi.Template

	// Input to generators extracted from the source
	Builder        bool
	GeneratorInput GeneratorInput

	// TODO: remove me
	Meta map[string]string
}

ComponentMatch is a match to a provided component

func (*ComponentMatch) Exact added in v1.0.4

func (m *ComponentMatch) Exact() bool

Exact checks if the ComponentMatch is an exact match

func (*ComponentMatch) IsImage added in v0.4.4

func (m *ComponentMatch) IsImage() bool

IsImage returns whether or not the component match is an image or image stream

func (*ComponentMatch) IsTemplate added in v0.4.4

func (m *ComponentMatch) IsTemplate() bool

IsTemplate returns whether or not the component match is a template

func (*ComponentMatch) String

func (m *ComponentMatch) String() string

type ComponentMatches added in v1.0.4

type ComponentMatches []*ComponentMatch

ComponentMatches holds multiple ComponentMatch

func (ComponentMatches) Exact added in v1.0.4

Exact returns all ComponentMatch that are an exact match

func (ComponentMatches) Inexact added in v1.0.4

func (m ComponentMatches) Inexact() ComponentMatches

Inexact returns all ComponentMatch that are not an exact match

type ComponentReference

type ComponentReference interface {
	// Input contains the input of the component
	Input() *ComponentInput
	// Resolve sets the match in input
	Resolve() error
	// Search sets the search matches in input
	Search() error
	// NeedsSource indicates if the component needs source code
	NeedsSource() bool
}

ComponentReference defines an interface for components

type ComponentReferences

type ComponentReferences []ComponentReference

ComponentReferences is a set of components

func (ComponentReferences) Group

func (r ComponentReferences) Group() (refs []ComponentReferences)

Group groups components based on their group ids

func (ComponentReferences) HasSource added in v1.0.7

func (r ComponentReferences) HasSource() bool

HasSource returns true if there is more than one component that has a repo associated

func (ComponentReferences) HumanString added in v1.0.7

func (r ComponentReferences) HumanString(separator string) string

func (ComponentReferences) ImageComponentRefs added in v1.0.4

func (r ComponentReferences) ImageComponentRefs() (refs ComponentReferences)

ImageComponentRefs returns the list of component references to images

func (ComponentReferences) InstallableComponentRefs added in v1.0.7

func (r ComponentReferences) InstallableComponentRefs() (refs ComponentReferences)

InstallableComponentRefs returns the list of component references to templates

func (ComponentReferences) NeedsSource

func (r ComponentReferences) NeedsSource() (refs ComponentReferences)

NeedsSource returns all the components that need source code in order to build

func (ComponentReferences) Resolve added in v1.1.6

func (components ComponentReferences) Resolve() error

Resolve the references to ensure they are all valid, and identify any images that don't match user input.

func (ComponentReferences) Search added in v1.1.6

func (components ComponentReferences) Search() error

Search searches on all references

func (ComponentReferences) String added in v0.5.1

func (r ComponentReferences) String() string

func (ComponentReferences) TemplateComponentRefs added in v1.0.4

func (r ComponentReferences) TemplateComponentRefs() (refs ComponentReferences)

TemplateComponentRefs returns the list of component references to templates

func (ComponentReferences) UseSource added in v1.1.3

func (r ComponentReferences) UseSource() (refs ComponentReferences)

UseSource returns all the components that use source repositories

type DeploymentConfigRef

type DeploymentConfigRef struct {
	Name   string
	Images []*ImageRef
	Env    Environment
	Labels map[string]string
	AsTest bool
}

DeploymentConfigRef is a reference to a deployment configuration

func (*DeploymentConfigRef) DeploymentConfig

func (r *DeploymentConfigRef) DeploymentConfig() (*deployapi.DeploymentConfig, error)

DeploymentConfig creates a deploymentConfig resource from the deployment configuration reference

TODO: take a pod template spec as argument

type Detector

type Detector interface {
	Detect(dir string, dockerStrategy bool) (*SourceRepositoryInfo, error)
}

Detector is an interface for detecting information about a source repository

type DockerClient added in v0.6.1

type DockerClient interface {
	ListImages(opts docker.ListImagesOptions) ([]docker.APIImages, error)
	InspectImage(name string) (*docker.Image, error)
}

DockerClient is the local interface for the docker client

type DockerClientSearcher added in v1.0.4

type DockerClientSearcher struct {
	Client DockerClient

	// Optional, will delegate resolution to the registry if no local
	// exact matches are found.
	RegistrySearcher Searcher

	// Insecure, if true will add an annotation to generated ImageStream
	// so that the image can be pulled properly
	Insecure bool

	// AllowingMissingImages will allow images that could not be found in the local or
	// remote registry to be used anyway.
	AllowMissingImages bool
}

DockerClientSearcher finds local docker images locally that match a search value

func (DockerClientSearcher) Search added in v1.0.4

func (r DockerClientSearcher) Search(precise bool, terms ...string) (ComponentMatches, []error)

Search searches all images in local docker server for images that match terms

type DockerRegistrySearcher added in v1.0.4

type DockerRegistrySearcher struct {
	Client        dockerregistry.Client
	AllowInsecure bool
}

DockerRegistrySearcher searches for images in a given docker registry. Notice that it only matches exact searches - so a search for "rub" will not return images with the name "ruby". TODO: replace ImageByTag to allow partial matches

func (DockerRegistrySearcher) Search added in v1.0.4

func (r DockerRegistrySearcher) Search(precise bool, terms ...string) (ComponentMatches, []error)

Search searches in the Docker registry for images that match terms

type Dockerfile added in v1.0.7

type Dockerfile interface {
	AST() *parser.Node
	Contents() string
}

func NewDockerfile added in v1.0.7

func NewDockerfile(contents string) (Dockerfile, error)

func NewDockerfileFromFile added in v1.0.7

func NewDockerfileFromFile(path string) (Dockerfile, error)

type Environment

type Environment map[string]string

Environment holds environment variables for new-app

func NewEnvironment

func NewEnvironment(envs ...map[string]string) Environment

NewEnvironment returns a new set of environment variables based on all the provided environment variables

func (Environment) Add added in v1.1.4

func (e Environment) Add(envs ...map[string]string)

Add adds the environment variables to the current environment

func (Environment) List

func (e Environment) List() []kapi.EnvVar

List sorts and returns all the environment variables

type ErrMultipleMatches

type ErrMultipleMatches struct {
	Value   string
	Matches []*ComponentMatch
	Errs    []error
}

ErrMultipleMatches is the error returned to new-app users when multiple matches are found for a given component.

func (ErrMultipleMatches) Error

func (e ErrMultipleMatches) Error() string

type ErrNoMatch

type ErrNoMatch struct {
	Value     string
	Qualifier string
	Errs      []error
}

ErrNoMatch is the error returned by new-app when no match is found for a given component.

func (ErrNoMatch) Error

func (e ErrNoMatch) Error() string

func (ErrNoMatch) Suggestion added in v1.1.2

func (e ErrNoMatch) Suggestion(commandName string) string

Suggestion is the usage error message returned when no match is found.

type ErrNoTagsFound added in v1.1.4

type ErrNoTagsFound struct {
	Value string
	Match *ComponentMatch
	Errs  []error
}

ErrNoTagsFound is returned when a matching image stream has no tags associated with it

func (ErrNoTagsFound) Error added in v1.1.4

func (e ErrNoTagsFound) Error() string

func (ErrNoTagsFound) Suggestion added in v1.1.4

func (e ErrNoTagsFound) Suggestion(commandName string) string

Suggestion is the usage error message returned when no tags are found on matching image stream

type ErrPartialMatch added in v1.1.2

type ErrPartialMatch struct {
	Value string
	Match *ComponentMatch
	Errs  []error
}

ErrPartialMatch is the error returned to new-app users when the best match available is only a partial match for a given component.

func (ErrPartialMatch) Error added in v1.1.2

func (e ErrPartialMatch) Error() string

func (ErrPartialMatch) Suggestion added in v1.1.2

func (e ErrPartialMatch) Suggestion(commandName string) string

Suggestion is the usage error message returned when only a partial match is found.

type FirstMatchResolver added in v1.0.4

type FirstMatchResolver struct {
	Searcher Searcher
}

FirstMatchResolver simply takes the first search result returned by the searcher it holds and resolves it to that match. An ErrMultipleMatches will never happen given it will just take the first result, but a ErrNoMatch can happen if the searcher returns no matches.

func (FirstMatchResolver) Resolve added in v1.0.4

func (r FirstMatchResolver) Resolve(value string) (*ComponentMatch, error)

Resolve resolves as the first match returned by the Searcher

type Generated

type Generated struct {
	Items []runtime.Object
}

Generated is a list of runtime objects

func (*Generated) WithType

func (g *Generated) WithType(slicePtr interface{}) bool

WithType extracts a list of runtime objects with the specified type

type GeneratorInput added in v1.0.7

type GeneratorInput struct {
	Job   bool
	Token *TokenInput
}

func GeneratorInputFromMatch added in v1.0.7

func GeneratorInputFromMatch(match *ComponentMatch) (GeneratorInput, error)

GeneratorInputFromMatch attempts to extract a GeneratorInput struct from the provided match. If errors occur, a partial GeneratorInput may be returned along an error.

type GeneratorJobReference added in v1.0.7

type GeneratorJobReference struct {
	Ref   ComponentReference
	Input GeneratorInput
	Err   error
}

GeneratorJobReference is a reference that should be treated as a job execution, not a direct app creation.

type GroupedComponentReferences

type GroupedComponentReferences ComponentReferences

GroupedComponentReferences is a set of components that can be grouped by their group id

func (GroupedComponentReferences) Len

func (GroupedComponentReferences) Less

func (m GroupedComponentReferences) Less(i, j int) bool

func (GroupedComponentReferences) Swap

func (m GroupedComponentReferences) Swap(i, j int)

type HighestScoreResolver added in v1.0.4

type HighestScoreResolver struct {
	Searcher Searcher
}

HighestScoreResolver takes search result returned by the searcher it holds and resolves it to the highest scored match present. An ErrMultipleMatches will never happen given it will just take the best scored result, but a ErrNoMatch can happen if the searcher returns no matches.

func (HighestScoreResolver) Resolve added in v1.0.4

func (r HighestScoreResolver) Resolve(value string) (*ComponentMatch, error)

Resolve resolves as the first highest scored match returned by the Searcher

type HighestUniqueScoreResolver added in v1.0.4

type HighestUniqueScoreResolver struct {
	Searcher Searcher
}

HighestUniqueScoreResolver takes search result returned by the searcher it holds and resolves it to the highest scored match present. If more than one match exists with that same score, returns an ErrMultipleMatches. A ErrNoMatch can happen if the searcher returns no matches.

func (HighestUniqueScoreResolver) Resolve added in v1.0.4

Resolve resolves as the highest scored match returned by the Searcher, and guarantees the match is unique (the only match with that given score)

type ImageImportSearcher added in v1.1.2

type ImageImportSearcher struct {
	Client        client.ImageStreamInterface
	AllowInsecure bool
	Fallback      Searcher
}

func (ImageImportSearcher) Search added in v1.1.2

func (s ImageImportSearcher) Search(precise bool, terms ...string) (ComponentMatches, []error)

Search invokes the new ImageStreamImport API to have the server look up Docker images for the user, using secrets stored on the server.

type ImageRef

type ImageRef struct {
	Reference imageapi.DockerImageReference
	// If specified, a more specific location the image is available at
	ResolvedReference *imageapi.DockerImageReference

	AsResolvedImage bool
	AsImageStream   bool
	OutputImage     bool
	Insecure        bool
	HasEmptyDir     bool
	// If true, create the image stream using a tag for this reference, not a bulk
	// import.
	TagDirectly bool
	// If set, the default tag for other components that reference this image
	InternalDefaultTag string

	Env Environment

	// ObjectName overrides the name of the ImageStream produced
	// but does not affect the DockerImageReference
	ObjectName string

	// This should *only* be set if the image stream already exists
	Stream *imageapi.ImageStream
	Info   *imageapi.DockerImage
}

ImageRef is a reference to an image

func InputImageFromMatch

func InputImageFromMatch(match *ComponentMatch) (*ImageRef, error)

InputImageFromMatch returns an image reference from a component match. The component match will either be an image stream or an image.

func (*ImageRef) BuildOutput

func (r *ImageRef) BuildOutput() (*buildapi.BuildOutput, error)

BuildOutput returns the BuildOutput of an image reference

func (*ImageRef) BuildTriggers

func (r *ImageRef) BuildTriggers() []buildapi.BuildTriggerPolicy

BuildTriggers sets up build triggers for the base image

func (*ImageRef) Command added in v1.1.4

func (r *ImageRef) Command() (cmd []string, ok bool)

Command returns the command the image invokes by default, or false if no such command has been defined.

func (*ImageRef) DeployableContainer

func (r *ImageRef) DeployableContainer() (container *kapi.Container, triggers []deployapi.DeploymentTriggerPolicy, err error)

DeployableContainer sets up a container for the image ready for deployment

func (*ImageRef) Exists added in v1.0.7

func (r *ImageRef) Exists() bool

Exists returns true if the image stream exists

func (*ImageRef) ImageStream added in v0.4.3

func (r *ImageRef) ImageStream() (*imageapi.ImageStream, error)

ImageStream returns an ImageStream from an image reference

func (*ImageRef) InstallablePod added in v1.0.7

func (r *ImageRef) InstallablePod(generatorInput GeneratorInput, secretAccessor SecretAccessor, serviceAccountName string) (*kapi.Pod, *kapi.Secret, error)

func (*ImageRef) InternalTag added in v1.1.2

func (r *ImageRef) InternalTag() string

func (*ImageRef) ObjectReference added in v0.5.1

func (r *ImageRef) ObjectReference() kapi.ObjectReference

ObjectReference returns an object reference to this ref (as it would exist during generation)

func (*ImageRef) PullSpec added in v1.0.7

func (r *ImageRef) PullSpec() string

func (*ImageRef) RepoName

func (r *ImageRef) RepoName() string

RepoName returns the name of the image in namespace/name format

func (*ImageRef) SuggestName

func (r *ImageRef) SuggestName() (string, bool)

SuggestName suggests a name for an image reference

type ImageRefGenerator added in v0.5.1

type ImageRefGenerator interface {
	FromName(name string) (*ImageRef, error)
	FromNameAndPorts(name string, ports []string) (*ImageRef, error)
	FromStream(repo *imageapi.ImageStream, tag string) (*ImageRef, error)
	FromDockerfile(name string, dir string, context string) (*ImageRef, error)
}

ImageRefGenerator is an interface for generating ImageRefs

Generators for ImageRef - Name -> ImageRef - ImageRepo + tag -> ImageRef

func NewImageRefGenerator added in v0.5.1

func NewImageRefGenerator() ImageRefGenerator

NewImageRefGenerator creates a new ImageRefGenerator

type ImageStreamByAnnotationSearcher added in v1.0.4

type ImageStreamByAnnotationSearcher struct {
	Client            client.ImageStreamsNamespacer
	ImageStreamImages client.ImageStreamImagesNamespacer
	Namespaces        []string
	// contains filtered or unexported fields
}

ImageStreamByAnnotationSearcher searches for image streams based on 'supports' annotations found in tagged images belonging to the stream

func (*ImageStreamByAnnotationSearcher) Search added in v1.0.4

func (r *ImageStreamByAnnotationSearcher) Search(precise bool, terms ...string) (ComponentMatches, []error)

Search finds image stream images using their 'supports' annotation

type ImageStreamSearcher added in v1.0.4

type ImageStreamSearcher struct {
	Client            client.ImageStreamsNamespacer
	ImageStreamImages client.ImageStreamImagesNamespacer
	Namespaces        []string
	AllowMissingTags  bool
}

ImageStreamSearcher searches the openshift server image streams for images matching a particular name

func (ImageStreamSearcher) Search added in v1.0.4

func (r ImageStreamSearcher) Search(precise bool, terms ...string) (ComponentMatches, []error)

Search will attempt to find imagestreams with names that match the passed in value

type MissingImageSearcher added in v1.0.7

type MissingImageSearcher struct {
}

MissingImageSearcher always returns an exact match for the item being searched for. It should be used with very high weight(weak priority) as a result of last resort when the user has indicated they want to allow missing images(not found in the docker registry or locally) to be used anyway.

func (MissingImageSearcher) Search added in v1.0.7

func (r MissingImageSearcher) Search(precise bool, terms ...string) (ComponentMatches, []error)

Search always returns an exact match for the search terms.

type MultiSimpleSearcher added in v1.0.4

type MultiSimpleSearcher []Searcher

MultiSimpleSearcher is a set of searchers

func (MultiSimpleSearcher) Search added in v1.0.4

func (s MultiSimpleSearcher) Search(precise bool, terms ...string) (ComponentMatches, []error)

Search searches using all searchers it holds

type MultiWeightedSearcher added in v1.0.4

type MultiWeightedSearcher []WeightedSearcher

MultiWeightedSearcher is a set of weighted searchers where lower weight has higher priority in search results

func (MultiWeightedSearcher) Search added in v1.0.4

func (s MultiWeightedSearcher) Search(precise bool, terms ...string) (ComponentMatches, []error)

Search searches using all searchers it holds and score according to searcher height

type NameSuggester

type NameSuggester interface {
	SuggestName() (string, bool)
}

NameSuggester is an object that can suggest a name for itself

type NameSuggestions

type NameSuggestions []NameSuggester

NameSuggestions suggests names from a collection of NameSuggesters

func (NameSuggestions) SuggestName

func (s NameSuggestions) SuggestName() (string, bool)

SuggestName suggests a name given a collection of NameSuggesters

type Objects

type Objects []runtime.Object

Objects is a set of runtime objects.

func AddRoutes added in v0.5.1

func AddRoutes(objects Objects) Objects

AddRoutes sets up routes for the provided objects.

func AddServices

func AddServices(objects Objects, firstPortOnly bool) Objects

AddServices sets up services for the provided objects.

type PerfectMatchWeightedResolver

type PerfectMatchWeightedResolver []WeightedResolver

PerfectMatchWeightedResolver returns only matches from resolvers that are identified as exact (weight 0.0), and only matches from those resolvers that qualify as exact (score = 0.0). If no perfect matches exist, an ErrMultipleMatches is returned indicating the remaining candidate(s). Note that this method may resolve ErrMultipleMatches with a single match, indicating an error (no perfect match) but with only one candidate.

func (PerfectMatchWeightedResolver) Resolve

Resolve resolves the provided input and returns only exact matches

type Pipeline

type Pipeline struct {
	Name string
	From string

	InputImage *ImageRef
	Build      *BuildRef
	Image      *ImageRef
	Deployment *DeploymentConfigRef
	Labels     map[string]string
}

Pipeline holds components.

func (*Pipeline) NeedsDeployment

func (p *Pipeline) NeedsDeployment(env Environment, labels map[string]string, asTest bool) error

NeedsDeployment sets the pipeline for deployment.

func (*Pipeline) Objects

func (p *Pipeline) Objects(accept, objectAccept Acceptor) (Objects, error)

Objects converts all the components in the pipeline into runtime objects.

type PipelineBuilder added in v1.1.1

type PipelineBuilder interface {
	To(string) PipelineBuilder

	NewBuildPipeline(string, *ComponentMatch, *SourceRepository) (*Pipeline, error)
	NewImagePipeline(string, *ComponentMatch) (*Pipeline, error)
}

A PipelineBuilder creates Pipeline instances.

func NewPipelineBuilder added in v1.1.1

func NewPipelineBuilder(name string, environment Environment, outputDocker bool) PipelineBuilder

NewPipelineBuilder returns a PipelineBuilder using name as a base name. A PipelineBuilder always creates pipelines with unique names, so that the actual name of a pipeline (Pipeline.Name) might differ from the base name. The pipelines created with a PipelineBuilder will have access to the given environment. The boolean outputDocker controls whether builds will output to an image stream tag or docker image reference.

type PipelineGroup

type PipelineGroup []*Pipeline

PipelineGroup is a group of Pipelines.

func (PipelineGroup) Reduce

func (g PipelineGroup) Reduce() error

Reduce squashes all common components from the pipelines.

func (PipelineGroup) String

func (g PipelineGroup) String() string

type ReferenceBuilder

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

ReferenceBuilder is used for building all the necessary object references for an application

func (*ReferenceBuilder) AddComponents added in v0.4.4

func (r *ReferenceBuilder) AddComponents(inputs []string, fn func(*ComponentInput) ComponentReference) ComponentReferences

AddComponents turns all provided component inputs into component references

func (*ReferenceBuilder) AddExistingSourceRepository added in v1.0.7

func (r *ReferenceBuilder) AddExistingSourceRepository(source *SourceRepository)

func (*ReferenceBuilder) AddGroups

func (r *ReferenceBuilder) AddGroups(inputs []string)

AddGroups adds group ids to groups of components

func (*ReferenceBuilder) AddSourceRepository

func (r *ReferenceBuilder) AddSourceRepository(input string) (*SourceRepository, bool)

AddSourceRepository resolves the input to an actual source repository

func (*ReferenceBuilder) Result

Result returns the result of the config conversion to object references

type Resolver

type Resolver interface {
	Resolve(value string) (*ComponentMatch, error)
}

Resolver is an interface for resolving provided input to component matches. A Resolver should return ErrMultipleMatches when more than one result can be constructed as a match. It should also set the score to 0.0 if this is a perfect match, and to higher values the less adequate the match is.

type ScoredComponentMatches

type ScoredComponentMatches []*ComponentMatch

ScoredComponentMatches is a set of component matches grouped by score

func (ScoredComponentMatches) Exact

Exact returns all the exact component matches

func (ScoredComponentMatches) Len

func (m ScoredComponentMatches) Len() int

func (ScoredComponentMatches) Less

func (m ScoredComponentMatches) Less(i, j int) bool

func (ScoredComponentMatches) Swap

func (m ScoredComponentMatches) Swap(i, j int)

type Searcher

type Searcher interface {
	Search(precise bool, terms ...string) (ComponentMatches, []error)
}

Searcher is responsible for performing a search based on the given terms and return all results found as component matches. The component match score can be used to determine how precise a given match is, where 0.0 is an exact match. All errors encountered during search should be returned. The precise flag is a hint to the searchers that they may stop searching when they hit their first exact set of matches

func NewImageStreamByAnnotationSearcher added in v1.0.4

func NewImageStreamByAnnotationSearcher(streamClient client.ImageStreamsNamespacer, imageClient client.ImageStreamImagesNamespacer, namespaces []string) Searcher

NewImageStreamByAnnotationSearcher creates a new ImageStreamByAnnotationSearcher

type SecretAccessor added in v1.0.7

type SecretAccessor interface {
	Token() (string, error)
	CACert() (string, error)
}

SecretAccessor is an interface for retrieving secrets from the calling context.

type SourceLanguageType

type SourceLanguageType struct {
	Platform string
	Version  string
}

SourceLanguageType contains info about the type of the language a source repository is built in

func (*SourceLanguageType) Term added in v0.6.1

func (t *SourceLanguageType) Term() string

Term returns a search term for the given source language type the term will be in the form of language:version

type SourceRef

type SourceRef struct {
	URL        *url.URL
	Ref        string
	Dir        string
	Name       string
	ContextDir string
	Secrets    []buildapi.SecretBuildSource

	SourceImage     *ImageRef
	ImageSourcePath string
	ImageDestPath   string

	DockerfileContents string

	Binary bool
}

SourceRef is a reference to a build source

func (*SourceRef) BuildSource

func (r *SourceRef) BuildSource() (*buildapi.BuildSource, []buildapi.BuildTriggerPolicy)

BuildSource returns an OpenShift BuildSource from the SourceRef

func (*SourceRef) SuggestName

func (r *SourceRef) SuggestName() (string, bool)

SuggestName returns a name derived from the source URL

type SourceRefGenerator added in v0.5.1

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

SourceRefGenerator generates new SourceRefs either from a URL or a Directory

Generators for SourceRef - Git URL -> SourceRef - Directory -> SourceRef

func NewSourceRefGenerator added in v0.5.1

func NewSourceRefGenerator() *SourceRefGenerator

NewSourceRefGenerator creates a new SourceRefGenerator

func (*SourceRefGenerator) FromDirectory added in v0.5.1

func (g *SourceRefGenerator) FromDirectory(directory string) (*SourceRef, error)

FromDirectory creates a SourceRef from a directory that contains a git repository. The URL is obtained from the origin remote branch, and the reference is taken from the currently checked out branch.

func (*SourceRefGenerator) FromGitURL added in v0.5.1

func (g *SourceRefGenerator) FromGitURL(location, contextDir string) (*SourceRef, error)

FromGitURL creates a SourceRef from a Git URL. If the URL includes a hash, it is used for the SourceRef's branch reference. Otherwise, 'master' is assumed

type SourceRepositories added in v0.6.1

type SourceRepositories []*SourceRepository

SourceRepositories is a list of SourceRepository objects

func (SourceRepositories) NotUsed added in v0.6.1

NotUsed returns the list of SourceRepositories that are not used

func (SourceRepositories) String added in v0.6.1

func (rr SourceRepositories) String() string

type SourceRepository

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

SourceRepository represents a code repository that may be the target of a build.

func NewBinarySourceRepository added in v1.0.7

func NewBinarySourceRepository() *SourceRepository

NewBinarySourceRepository creates a source repository that is configured for binary input.

func NewImageSourceRepository added in v1.1.2

func NewImageSourceRepository(compRef ComponentReference, from, to string) *SourceRepository

TODO: this doesn't really match the others - this should likely be a different type of object that is associated with a build or component.

func NewSourceRepository

func NewSourceRepository(s string) (*SourceRepository, error)

NewSourceRepository creates a reference to a local or remote source code repository from a URL or path.

func NewSourceRepositoryForDockerfile added in v1.0.7

func NewSourceRepositoryForDockerfile(contents string) (*SourceRepository, error)

NewSourceRepositoryForDockerfile creates a source repository that is set up to use the contents of a Dockerfile as the input of the build.

func (*SourceRepository) AddBuildSecrets added in v1.1.2

func (r *SourceRepository) AddBuildSecrets(secrets []string, isDockerBuild bool) error

AddBuildSecrets adds the defined secrets into a build. The input format for the secrets is "<secretName>:<destinationDir>". The destinationDir is optional and when not specified the default is the current working directory.

func (*SourceRepository) AddDockerfile added in v1.1.1

func (r *SourceRepository) AddDockerfile(contents string) error

AddDockerfile adds the Dockerfile contents to the SourceRepository and configure it to build with Docker strategy. Returns an error if the contents are invalid.

func (*SourceRepository) BuildWithDocker

func (r *SourceRepository) BuildWithDocker()

BuildWithDocker specifies that the source repository was built with Docker

func (*SourceRepository) ContextDir added in v0.5.4

func (r *SourceRepository) ContextDir() string

ContextDir returns the context directory of the source repository

func (*SourceRepository) Detect added in v0.6.1

func (r *SourceRepository) Detect(d Detector, dockerStrategy bool) error

Detect clones source locally if not already local and runs code detection with the given detector.

func (*SourceRepository) InUse

func (r *SourceRepository) InUse() bool

InUse checks if the source repository is in use

func (*SourceRepository) Info added in v0.6.1

Info returns the source repository info generated on code detection

func (*SourceRepository) IsDockerBuild

func (r *SourceRepository) IsDockerBuild() bool

IsDockerBuild checks if the source repository was built with Docker

func (*SourceRepository) LocalPath

func (r *SourceRepository) LocalPath() (string, error)

LocalPath returns the local path of the source repository

func (*SourceRepository) Remote

func (r *SourceRepository) Remote() bool

Remote checks whether the source repository is remote

func (*SourceRepository) RemoteURL added in v0.4.1

func (r *SourceRepository) RemoteURL() (*url.URL, bool, error)

RemoteURL returns the remote URL of the source repository

func (*SourceRepository) Secrets added in v1.1.2

Secrets returns the secrets

func (*SourceRepository) SetContextDir added in v0.5.4

func (r *SourceRepository) SetContextDir(dir string)

SetContextDir sets the context directory to use for the source repository

func (*SourceRepository) SetInfo added in v1.0.1

func (r *SourceRepository) SetInfo(info *SourceRepositoryInfo)

SetInfo sets the source repository info. This is to facilitate certain tests.

func (*SourceRepository) SetSourceImage added in v1.1.2

func (r *SourceRepository) SetSourceImage(c ComponentReference)

SetSourceImage sets the source(input) image for a repository

func (*SourceRepository) SetSourceImagePath added in v1.1.2

func (r *SourceRepository) SetSourceImagePath(source, dest string)

SetSourceImagePath sets the source/destination to use when copying from the SourceImage

func (*SourceRepository) String

func (r *SourceRepository) String() string

func (*SourceRepository) UsedBy

func (r *SourceRepository) UsedBy(ref ComponentReference)

UsedBy sets up which component uses the source repository

type SourceRepositoryEnumerator

type SourceRepositoryEnumerator struct {
	Detectors source.Detectors
	Tester    dockerfile.Tester
}

SourceRepositoryEnumerator implements the Detector interface

func (SourceRepositoryEnumerator) Detect

func (e SourceRepositoryEnumerator) Detect(dir string, dockerStrategy bool) (*SourceRepositoryInfo, error)

Detect extracts source code information about the provided source repository

type SourceRepositoryInfo

type SourceRepositoryInfo struct {
	Path       string
	Types      []SourceLanguageType
	Dockerfile Dockerfile
}

SourceRepositoryInfo contains info about a source repository

func (*SourceRepositoryInfo) Terms

func (info *SourceRepositoryInfo) Terms() []string

Terms returns which languages the source repository was built with

type TemplateFileSearcher added in v1.0.4

type TemplateFileSearcher struct {
	Mapper       meta.RESTMapper
	Typer        runtime.ObjectTyper
	ClientMapper resource.ClientMapper
	Namespace    string
}

TemplateFileSearcher resolves template files into template objects

func (*TemplateFileSearcher) Search added in v1.0.4

func (r *TemplateFileSearcher) Search(precise bool, terms ...string) (ComponentMatches, []error)

Search attemps to read template files and transform it into template objects

type TemplateSearcher added in v1.0.4

type TemplateSearcher struct {
	Client                    client.TemplatesNamespacer
	TemplateConfigsNamespacer client.TemplateConfigsNamespacer
	Namespaces                []string
	StopOnExactMatch          bool
}

TemplateSearcher resolves stored template arguments into template objects

func (TemplateSearcher) Search added in v1.0.4

func (r TemplateSearcher) Search(precise bool, terms ...string) (ComponentMatches, []error)

Search searches for a template and returns matches with the object representation

type TokenInput added in v1.0.7

type TokenInput struct {
	Env            *string
	File           *string
	ServiceAccount bool
}

type UniqueExactOrInexactMatchResolver added in v1.0.4

type UniqueExactOrInexactMatchResolver struct {
	Searcher Searcher
}

UniqueExactOrInexactMatchResolver takes search result returned by the searcher it holds. Returns the single exact match present, if more that one exact match is present, returns a ErrMultipleMatches. If no exact match is present, try with inexact ones, which must also be unique otherwise ErrMultipleMatches. A ErrNoMatch can happen if the searcher returns no exact or inexact matches.

func (UniqueExactOrInexactMatchResolver) Resolve added in v1.0.4

Resolve resolves as the single exact or inexact match present.

type UniqueNameGenerator added in v1.1.1

type UniqueNameGenerator interface {
	Generate(NameSuggester) (string, error)
}

A UniqueNameGenerator is able to generate unique names from a given original name.

func NewUniqueNameGenerator added in v1.1.1

func NewUniqueNameGenerator(name string) UniqueNameGenerator

NewUniqueNameGenerator creates a new UniqueNameGenerator with the given original name.

type WeightedResolver

type WeightedResolver struct {
	Searcher
	Weight float32
}

WeightedResolver is a resolver identified as exact or not, depending on its weight

type WeightedSearcher added in v1.0.4

type WeightedSearcher struct {
	Searcher
	Weight float32
}

WeightedSearcher is a searcher identified as exact or not, depending on its weight

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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