Documentation ¶
Index ¶
- Constants
- Variables
- func AddComponentInputsToRefBuilder(b *app.ReferenceBuilder, r *Resolvers, c *ComponentInputs, g *GenerationInputs, ...) error
- func AddDockerfileToSourceRepositories(b *app.ReferenceBuilder, dockerfile string) error
- func AddImageSourceRepository(sourceRepos app.SourceRepositories, r app.Resolver, g *GenerationInputs) (app.ComponentReference, app.SourceRepositories, error)
- func AddMissingComponentsToRefBuilder(b *app.ReferenceBuilder, repositories app.SourceRepositories, ...) (app.ComponentReferences, error)
- func AddObjectAnnotations(obj runtime.Object, annotations map[string]string) error
- func AddSourceRepositoriesToRefBuilder(b *app.ReferenceBuilder, c *ComponentInputs, g *GenerationInputs, ...) (app.SourceRepositories, error)
- func DescribeGeneratedTemplate(out io.Writer, input string, result *templatev1.Template, baseNamespace string)
- func DetectSource(repositories []*app.SourceRepository, d app.Detector, g *GenerationInputs) error
- func EnsureHasSource(components app.ComponentReferences, repositories app.SourceRepositories, ...) error
- func InferBuildTypes(components app.ComponentReferences, g *GenerationInputs) (app.ComponentReferences, error)
- func TransformTemplate(tpl *templatev1.Template, ...) (*templatev1.Template, error)
- type AppConfig
- func (c *AppConfig) AddArguments(args []string) []string
- func (c *AppConfig) DockerRegistrySearcher() app.Searcher
- func (c *AppConfig) HasArguments() bool
- func (c *AppConfig) Querying() bool
- func (c *AppConfig) Run() (*AppResult, error)
- func (c *AppConfig) RunQuery() (*QueryResult, error)
- func (c *AppConfig) SetOpenShiftClient(imageClient imagev1typedclient.ImageV1Interface, ...)
- type AppResult
- type ArgumentClassificationError
- type ArgumentClassificationWinner
- type ComponentInputs
- type ErrRequiresExplicitAccess
- type GenerationInputs
- type QueryResult
- type ResolvedComponents
- type Resolvers
Constants ¶
const ( GeneratedByNamespace = "openshift.io/generated-by" GeneratedForJob = "openshift.io/generated-job" GeneratedForJobFor = "openshift.io/generated-job.for" GeneratedByNewApp = "OpenShiftNewApp" GeneratedByNewBuild = "OpenShiftNewBuild" )
Variables ¶
var ErrNoInputs = errors.New("no inputs provided")
ErrNoInputs is returned when no inputs are specified
Functions ¶
func AddComponentInputsToRefBuilder ¶
func AddComponentInputsToRefBuilder(b *app.ReferenceBuilder, r *Resolvers, c *ComponentInputs, g *GenerationInputs, s, i *[]string) error
AddComponentInputsToRefBuilder set up the components to be used by the reference builder.
func AddDockerfileToSourceRepositories ¶
func AddDockerfileToSourceRepositories(b *app.ReferenceBuilder, dockerfile string) error
AddDockerfile adds a Dockerfile passed in the command line to the reference builder.
func AddImageSourceRepository ¶
func AddImageSourceRepository(sourceRepos app.SourceRepositories, r app.Resolver, g *GenerationInputs) (app.ComponentReference, app.SourceRepositories, error)
func AddMissingComponentsToRefBuilder ¶
func AddMissingComponentsToRefBuilder( b *app.ReferenceBuilder, repositories app.SourceRepositories, dockerfileResolver, sourceResolver, pipelineResolver app.Resolver, g *GenerationInputs, ) (app.ComponentReferences, error)
ComponentsForSourceRepositories creates components for repositories that have not been previously associated by a builder. These components have already gone through source code detection and have a SourceRepositoryInfo attached to them.
func AddObjectAnnotations ¶
AddObjectAnnotations adds new annotation(s) to a single runtime.Object
func AddSourceRepositoriesToRefBuilder ¶
func AddSourceRepositoriesToRefBuilder(b *app.ReferenceBuilder, c *ComponentInputs, g *GenerationInputs, s, i *[]string) (app.SourceRepositories, error)
AddSourceRepositoriesToRefBuilder adds the provided repositories to the reference builder, identifies which should be built using Docker, and then returns the full list of source repositories.
func DescribeGeneratedTemplate ¶
func DescribeGeneratedTemplate(out io.Writer, input string, result *templatev1.Template, baseNamespace string)
DescribeGeneratedTemplate writes a description of the provided template to out.
func DetectSource ¶
func DetectSource(repositories []*app.SourceRepository, d app.Detector, g *GenerationInputs) error
DetectSource runs a code detector on the passed in repositories to obtain a SourceRepositoryInfo
func EnsureHasSource ¶
func EnsureHasSource(components app.ComponentReferences, repositories app.SourceRepositories, g *GenerationInputs) error
EnsureHasSource ensure every builder component has source code associated with it. It takes a list of component references that are builders and have not been associated with source, and a set of source repositories that have not been associated with a builder
func InferBuildTypes ¶
func InferBuildTypes(components app.ComponentReferences, g *GenerationInputs) (app.ComponentReferences, error)
InferBuildTypes infers build status and mismatches between source and docker builders
func TransformTemplate ¶
func TransformTemplate(tpl *templatev1.Template, templateProcessor templateprocessorclient.TemplateProcessorInterface, namespace string, parameters map[string]string, ignoreUnknownParameters bool) (*templatev1.Template, error)
TransformTemplateV1 processes a template with the provided parameters, returning an error if transformation fails.
Types ¶
type AppConfig ¶
type AppConfig struct { ComponentInputs GenerationInputs ResolvedComponents *ResolvedComponents SkipGeneration bool AllowSecretUse bool SourceSecret string PushSecret string SecretAccessor app.SecretAccessor AsSearch bool AsList bool DryRun bool In io.Reader Out io.Writer ErrOut io.Writer KubeClient kubernetes.Interface ImageClient imagev1typedclient.ImageV1Interface RouteClient routev1typedclient.RouteV1Interface TemplateClient templatev1typedclient.TemplateV1Interface Resolvers Builder *resource.Builder Typer runtime.ObjectTyper Mapper meta.RESTMapper OriginNamespace string EnvironmentClassificationErrors map[string]ArgumentClassificationError SourceClassificationErrors map[string]ArgumentClassificationError TemplateClassificationErrors map[string]ArgumentClassificationError ComponentClassificationErrors map[string]ArgumentClassificationError ClassificationWinners map[string]ArgumentClassificationWinner }
AppConfig contains all the necessary configuration for an application
func NewAppConfig ¶
func NewAppConfig() *AppConfig
NewAppConfig returns a new AppConfig, but you must set your typer, mapper, and clientMapper after the command has been run and flags have been parsed.
func (*AppConfig) AddArguments ¶
AddArguments converts command line arguments into the appropriate bucket based on what they look like
func (*AppConfig) DockerRegistrySearcher ¶
func (*AppConfig) HasArguments ¶
func (*AppConfig) RunQuery ¶
func (c *AppConfig) RunQuery() (*QueryResult, error)
RunQuery executes the provided config and returns the result of the resolution.
func (*AppConfig) SetOpenShiftClient ¶
func (c *AppConfig) SetOpenShiftClient(imageClient imagev1typedclient.ImageV1Interface, templateClient templatev1typedclient.TemplateV1Interface, routeClient routev1typedclient.RouteV1Interface, OriginNamespace string, dockerclient *docker.Client)
SetOpenShiftClient sets the passed OpenShift client in the application configuration
type AppResult ¶
type AppResult struct { List *kapi.List Name string HasSource bool Namespace string GeneratedJobs bool }
AppResult contains the results of an application
type ArgumentClassificationWinner ¶
func (*ArgumentClassificationWinner) String ¶
func (w *ArgumentClassificationWinner) String() string
type ComponentInputs ¶
type ComponentInputs struct { SourceRepositories []string Components []string ImageStreams []string DockerImages []string Templates []string TemplateFiles []string Groups []string }
ComponentInputs are transformed into ResolvedComponents
type ErrRequiresExplicitAccess ¶
type ErrRequiresExplicitAccess struct { Match app.ComponentMatch Input app.GeneratorInput }
func (ErrRequiresExplicitAccess) Error ¶
func (e ErrRequiresExplicitAccess) Error() string
type GenerationInputs ¶
type GenerationInputs struct { TemplateParameters []string Environment []string BuildEnvironment []string BuildArgs []string Labels map[string]string TemplateParameterFiles []string EnvironmentFiles []string BuildEnvironmentFiles []string IgnoreUnknownParameters bool InsecureRegistry bool Strategy newapp.Strategy Name string To string NoOutput bool OutputDocker bool Dockerfile string ExpectToBuild bool BinaryBuild bool ContextDir string SourceImage string SourceImagePath string Secrets []string ConfigMaps []string AllowMissingImageStreamTags bool Deploy bool AsTestDeployment bool AllowGenerationErrors bool }
GenerationInputs control how new-app creates output TODO: split these into finer grained structs
type QueryResult ¶
type QueryResult struct { Matches app.ComponentMatches List *kapi.List }
QueryResult contains the results of a query (search or list)
type ResolvedComponents ¶
type ResolvedComponents struct { Components app.ComponentReferences Repositories app.SourceRepositories }
ResolvedComponents is the input to generation
func Resolve ¶
func Resolve(appConfig *AppConfig) (*ResolvedComponents, error)
Resolve transforms unstructured inputs (component names, templates, images) into a set of resolved components, or returns an error.
type Resolvers ¶
type Resolvers struct { DockerSearcher app.Searcher ImageStreamSearcher app.Searcher ImageStreamByAnnotationSearcher app.Searcher TemplateSearcher app.Searcher TemplateFileSearcher app.Searcher AllowMissingImages bool Detector app.Detector }
Resolvers are used to identify source repositories, images, or templates in different contexts
func (*Resolvers) DockerfileResolver ¶
func (*Resolvers) ImageSourceResolver ¶
func (*Resolvers) PipelineResolver ¶
func (*Resolvers) SourceResolver ¶
TODO: why does this differ from ImageSourceResolver?