Documentation
¶
Overview ¶
Package app defines reference objects used to generate OpenShift API objects
Index ¶
- func BuilderForPlatform(platform string) string
- func ContainerPortsFromString(portString string) ([]kapi.ContainerPort, error)
- func IsBuilderImage(image *imageapi.DockerImage) bool
- func IsComponentReference(s string) bool
- func IsPossibleSourceRepository(s string) bool
- func IsRemoteRepository(s string) bool
- func JoinEnvironment(a, b []kapi.EnvVar) (out []kapi.EnvVar)
- func LabelsFromSpec(spec []string) (map[string]string, []string, error)
- func StrategyAndSourceForRepository(repo *SourceRepository) (*BuildStrategyRef, *SourceRef, error)
- type Acceptor
- type BuildRef
- type BuildStrategyRef
- type ComponentInput
- type ComponentMatch
- type ComponentReference
- type ComponentReferences
- type DeploymentConfigRef
- type Detector
- type DockerClientResolver
- type DockerRegistryResolver
- type Environment
- type ErrMultipleMatches
- type ErrNoMatch
- type Generated
- type GroupedComponentReferences
- type ImageRef
- func (r *ImageRef) BuildOutput() (*buildapi.BuildOutput, error)
- func (r *ImageRef) BuildTriggers() []buildapi.BuildTriggerPolicy
- func (r *ImageRef) DeployableContainer() (container *kapi.Container, triggers []deployapi.DeploymentTriggerPolicy, ...)
- func (r *ImageRef) ImageStream() (*imageapi.ImageStream, error)
- func (r *ImageRef) RepoName() string
- func (r *ImageRef) SuggestName() (string, bool)
- type ImageStreamResolver
- type NameSuggester
- type NameSuggestions
- type Objects
- type PerfectMatchWeightedResolver
- type Pipeline
- type PipelineGroup
- type ReferenceBuilder
- func (r *ReferenceBuilder) AddGroups(inputs []string)
- func (r *ReferenceBuilder) AddImages(inputs []string, fn func(*ComponentInput) ComponentReference)
- func (r *ReferenceBuilder) AddSourceRepository(input string) (*SourceRepository, bool)
- func (r *ReferenceBuilder) Result() (ComponentReferences, []*SourceRepository, []error)
- type Resolver
- type ScoredComponentMatches
- type Searcher
- type SourceLanguageType
- type SourceRef
- type SourceRepository
- func (r *SourceRepository) BuildWithDocker()
- func (r *SourceRepository) InUse() bool
- func (r *SourceRepository) IsDockerBuild() bool
- func (r *SourceRepository) LocalPath() (string, error)
- func (r *SourceRepository) Remote() bool
- func (r *SourceRepository) RemoteURL() (*url.URL, error)
- func (r *SourceRepository) String() string
- func (r *SourceRepository) UsedBy(ref ComponentReference)
- type SourceRepositoryEnumerator
- type SourceRepositoryInfo
- type WeightedResolver
- type WeightedResolvers
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuilderForPlatform ¶ added in v0.4.2
TODO: Remove once a real image searcher is implemented
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 IsBuilderImage ¶
func IsBuilderImage(image *imageapi.DockerImage) bool
func IsComponentReference ¶
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 IsRemoteRepository ¶
func LabelsFromSpec ¶ added in v0.3.2
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) (*BuildStrategyRef, *SourceRef, error)
Types ¶
type Acceptor ¶
type Acceptor interface {
Accept(from interface{}) bool
}
var AcceptAll Acceptor = acceptAll{}
AcceptAll accepts all objects
var AcceptNew Acceptor = acceptNew{}
AcceptNew only accepts runtime.Objects with an empty resource version.
func NewAcceptFirst ¶
func NewAcceptFirst() Acceptor
type BuildRef ¶
type BuildRef struct {
Source *SourceRef
Input *ImageRef
Strategy *BuildStrategyRef
Output *ImageRef
}
func (*BuildRef) BuildConfig ¶
func (r *BuildRef) BuildConfig() (*buildapi.BuildConfig, error)
type BuildStrategyRef ¶
BuildStrategyRef is a reference to a build strategy
func (*BuildStrategyRef) BuildStrategy ¶
func (s *BuildStrategyRef) BuildStrategy() (*buildapi.BuildStrategy, []buildapi.BuildTriggerPolicy)
BuildStrategy builds an OpenShift BuildStrategy from a BuildStrategyRef
type ComponentInput ¶
type ComponentInput struct {
Group int
From string
Argument string
Value string
ExpectToBuild bool
Uses *SourceRepository
Match *ComponentMatch
Resolver
}
func NewComponentInput ¶
func NewComponentInput(input string) (*ComponentInput, string, error)
func (*ComponentInput) Input ¶
func (i *ComponentInput) Input() *ComponentInput
func (*ComponentInput) NeedsSource ¶
func (i *ComponentInput) NeedsSource() bool
func (*ComponentInput) Resolve ¶
func (i *ComponentInput) Resolve() error
func (*ComponentInput) String ¶
func (i *ComponentInput) String() string
func (*ComponentInput) Use ¶
func (i *ComponentInput) Use(repo *SourceRepository)
type ComponentMatch ¶
type ComponentMatch struct {
Value string
Argument string
Name string
Description string
Score float32
Builder bool
Image *imageapi.DockerImage
ImageStream *imageapi.ImageStream
ImageTag string
Template *templateapi.Template
}
func (*ComponentMatch) String ¶
func (m *ComponentMatch) String() string
type ComponentReference ¶
type ComponentReference interface {
Input() *ComponentInput
// Sets Input.Match or returns an error
Resolve() error
NeedsSource() bool
}
type ComponentReferences ¶
type ComponentReferences []ComponentReference
func (ComponentReferences) Group ¶
func (r ComponentReferences) Group() (refs []ComponentReferences)
func (ComponentReferences) NeedsSource ¶
func (r ComponentReferences) NeedsSource() (refs ComponentReferences)
type DeploymentConfigRef ¶
type DeploymentConfigRef struct {
Images []*ImageRef
Env Environment
}
func (*DeploymentConfigRef) DeploymentConfig ¶
func (r *DeploymentConfigRef) DeploymentConfig() (*deployapi.DeploymentConfig, error)
TODO: take a pod template spec as argument
type Detector ¶
type Detector interface {
Detect(dir string) (*SourceRepositoryInfo, error)
}
type DockerClientResolver ¶
type DockerClientResolver struct {
Client *docker.Client
// Optional, will delegate resolution to the registry if no local
// exact matches are found.
RegistryResolver Resolver
}
func (DockerClientResolver) Resolve ¶
func (r DockerClientResolver) Resolve(value string) (*ComponentMatch, error)
type DockerRegistryResolver ¶
type DockerRegistryResolver struct {
Client dockerregistry.Client
}
func (DockerRegistryResolver) Resolve ¶
func (r DockerRegistryResolver) Resolve(value string) (*ComponentMatch, error)
type Environment ¶
func NewEnvironment ¶
func NewEnvironment(envs ...map[string]string) Environment
func (Environment) List ¶
func (e Environment) List() []kapi.EnvVar
type ErrMultipleMatches ¶
type ErrMultipleMatches struct {
Image string
Matches []*ComponentMatch
}
func (ErrMultipleMatches) Error ¶
func (e ErrMultipleMatches) Error() string
func (ErrMultipleMatches) UsageError ¶
func (e ErrMultipleMatches) UsageError(commandName string) string
type ErrNoMatch ¶
type ErrNoMatch struct {
// contains filtered or unexported fields
}
func (ErrNoMatch) Error ¶
func (e ErrNoMatch) Error() string
func (ErrNoMatch) UsageError ¶
func (e ErrNoMatch) UsageError(commandName string) string
type GroupedComponentReferences ¶
type GroupedComponentReferences ComponentReferences
func (GroupedComponentReferences) Len ¶
func (m GroupedComponentReferences) Len() int
func (GroupedComponentReferences) Less ¶
func (m GroupedComponentReferences) Less(i, j int) bool
func (GroupedComponentReferences) Swap ¶
func (m GroupedComponentReferences) Swap(i, j int)
type ImageRef ¶
type ImageRef struct {
imageapi.DockerImageReference
AsImageStream bool
Stream *imageapi.ImageStream
Info *imageapi.DockerImage
}
ImageRef is a reference to an image
func ImageFromRepository ¶
func ImageFromRepository(stream *image.ImageStream, tag string) (*ImageRef, error)
func InputImageFromMatch ¶
func InputImageFromMatch(match *ComponentMatch) (*ImageRef, error)
func (*ImageRef) BuildOutput ¶
func (r *ImageRef) BuildOutput() (*buildapi.BuildOutput, error)
func (*ImageRef) BuildTriggers ¶
func (r *ImageRef) BuildTriggers() []buildapi.BuildTriggerPolicy
func (*ImageRef) DeployableContainer ¶
func (*ImageRef) ImageStream ¶ added in v0.4.3
func (r *ImageRef) ImageStream() (*imageapi.ImageStream, error)
func (*ImageRef) SuggestName ¶
type ImageStreamResolver ¶
type ImageStreamResolver struct {
Client client.ImageStreamsNamespacer
ImageStreamImages client.ImageStreamImagesNamespacer
Namespaces []string
}
func (ImageStreamResolver) Resolve ¶
func (r ImageStreamResolver) Resolve(value string) (*ComponentMatch, error)
type NameSuggester ¶
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 ¶
func AddServices ¶
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 ¶
func (r PerfectMatchWeightedResolver) Resolve(value string) (*ComponentMatch, error)
type Pipeline ¶
type Pipeline struct {
From string
InputImage *ImageRef
Build *BuildRef
Image *ImageRef
Deployment *DeploymentConfigRef
}
func NewBuildPipeline ¶
func (*Pipeline) NeedsDeployment ¶
func (p *Pipeline) NeedsDeployment(env Environment) error
type PipelineGroup ¶
type PipelineGroup []*Pipeline
func (PipelineGroup) Reduce ¶
func (g PipelineGroup) Reduce() error
func (PipelineGroup) String ¶
func (g PipelineGroup) String() string
type ReferenceBuilder ¶
type ReferenceBuilder struct {
// contains filtered or unexported fields
}
func (*ReferenceBuilder) AddGroups ¶
func (r *ReferenceBuilder) AddGroups(inputs []string)
func (*ReferenceBuilder) AddImages ¶
func (r *ReferenceBuilder) AddImages(inputs []string, fn func(*ComponentInput) ComponentReference)
func (*ReferenceBuilder) AddSourceRepository ¶
func (r *ReferenceBuilder) AddSourceRepository(input string) (*SourceRepository, bool)
func (*ReferenceBuilder) Result ¶
func (r *ReferenceBuilder) Result() (ComponentReferences, []*SourceRepository, []error)
type Resolver ¶
type Resolver interface {
// resolvers should return ErrMultipleMatches when more than one result could
// be construed as a match. Resolvers should set the score to 0.0 if this is a
// perfect match, and to higher values the less adequate the match is.
Resolve(value string) (*ComponentMatch, error)
}
type ScoredComponentMatches ¶
type ScoredComponentMatches []*ComponentMatch
func (ScoredComponentMatches) Exact ¶
func (m ScoredComponentMatches) Exact() []*ComponentMatch
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(terms []string) ([]*ComponentMatch, error)
}
type SourceLanguageType ¶
type SourceRef ¶
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 ¶
SuggestName returns a name derived from the source URL
type SourceRepository ¶
type SourceRepository struct {
// contains filtered or unexported fields
}
SourceRepository represents an code repository that may be the target of a build.
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 (*SourceRepository) BuildWithDocker ¶
func (r *SourceRepository) BuildWithDocker()
func (*SourceRepository) InUse ¶
func (r *SourceRepository) InUse() bool
func (*SourceRepository) IsDockerBuild ¶
func (r *SourceRepository) IsDockerBuild() bool
func (*SourceRepository) LocalPath ¶
func (r *SourceRepository) LocalPath() (string, error)
func (*SourceRepository) Remote ¶
func (r *SourceRepository) Remote() bool
func (*SourceRepository) RemoteURL ¶ added in v0.4.1
func (r *SourceRepository) RemoteURL() (*url.URL, error)
func (*SourceRepository) String ¶
func (r *SourceRepository) String() string
func (*SourceRepository) UsedBy ¶
func (r *SourceRepository) UsedBy(ref ComponentReference)
type SourceRepositoryEnumerator ¶
type SourceRepositoryEnumerator struct {
Detectors source.Detectors
Tester dockerfile.Tester
}
func (SourceRepositoryEnumerator) Detect ¶
func (e SourceRepositoryEnumerator) Detect(dir string) (*SourceRepositoryInfo, error)
type SourceRepositoryInfo ¶
type SourceRepositoryInfo struct {
Path string
Types []SourceLanguageType
Dockerfile dockerfile.Dockerfile
}
func (*SourceRepositoryInfo) Terms ¶
func (info *SourceRepositoryInfo) Terms() []string
type WeightedResolver ¶
type WeightedResolvers ¶
type WeightedResolvers []WeightedResolver
func (WeightedResolvers) Resolve ¶
func (r WeightedResolvers) Resolve(value string) (*ComponentMatch, error)