app

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2015 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Overview

Package app defines reference objects used to generate OpenShift API objects

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainerPortsFromString added in v0.3.2

func ContainerPortsFromString(portString string) ([]kapi.Port, 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

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

func IsRemoteRepository

func IsRemoteRepository(s string) bool

func JoinEnvironment

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

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) (*BuildStrategyRef, *SourceRef, error)

Types

type Acceptor

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

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

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 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.ImageRepository
	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

type Environment map[string]string

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 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 GroupedComponentReferences

type GroupedComponentReferences ComponentReferences

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 ImageRef

type ImageRef struct {
	Namespace string
	Name      string
	Tag       string
	Registry  string

	AsImageRepository bool

	Repository *imageapi.ImageRepository
	Info       *imageapi.DockerImage
}

ImageRef is a reference to an image

func ImageFromName

func ImageFromName(name string, tag string) (*ImageRef, error)

func ImageFromRepository

func ImageFromRepository(repo *image.ImageRepository, 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 (r *ImageRef) DeployableContainer() (container *kapi.Container, triggers []deployapi.DeploymentTriggerPolicy, err error)

func (*ImageRef) ImageRepository

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

func (*ImageRef) NameReference

func (r *ImageRef) NameReference() string

NameReference returns the name that other OpenShift objects may refer to this image as. Deployment Configs and Build Configs may look an image up in an image repository before creating other objects that use the name.

func (*ImageRef) RepoName

func (r *ImageRef) RepoName() string

func (*ImageRef) SuggestName

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

type ImageStreamResolver

type ImageStreamResolver struct {
	Client     client.ImageRepositoriesNamespacer
	Images     client.ImagesNamespacer
	Namespaces []string
}

func (ImageStreamResolver) Resolve

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

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

func AddServices

func AddServices(objects Objects) 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

type Pipeline

type Pipeline struct {
	From string

	InputImage *ImageRef
	Build      *BuildRef
	Image      *ImageRef
	Deployment *DeploymentConfigRef
}

func NewBuildPipeline

func NewBuildPipeline(from string, input *ImageRef, strategy *BuildStrategyRef, source *SourceRef) (*Pipeline, error)

func NewImagePipeline

func NewImagePipeline(from string, image *ImageRef) (*Pipeline, error)

func (*Pipeline) NeedsDeployment

func (p *Pipeline) NeedsDeployment(env Environment) error

func (*Pipeline) Objects

func (p *Pipeline) Objects(accept Acceptor) (Objects, 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

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 (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 SourceLanguageType struct {
	Platform string
	Version  string
}

type SourceRef

type SourceRef struct {
	URL        *url.URL
	Ref        string
	Dir        string
	Name       string
	ContextDir string
}

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 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) 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

type SourceRepositoryInfo

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

func (*SourceRepositoryInfo) Terms

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

type WeightedResolver

type WeightedResolver struct {
	Resolver
	Weight float32
}

type WeightedResolvers

type WeightedResolvers []WeightedResolver

func (WeightedResolvers) Resolve

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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