Documentation ¶
Overview ¶
Package generator contains the code to generate Build from BuildConfig as well as REST support to help expose the generator from an API.
Index ¶
- func FetchServiceAccountSecrets(secrets kcoreclient.SecretsGetter, ...) ([]kapi.Secret, error)
- func IsFatal(err error) bool
- func UpdateCustomImageEnv(strategy *buildapi.CustomBuildStrategy, newImage string)
- type BuildGenerator
- type Client
- func (c Client) CreateBuild(ctx context.Context, build *buildapi.Build) error
- func (c Client) GetBuild(ctx context.Context, name string, options *metav1.GetOptions) (*buildapi.Build, error)
- func (c Client) GetBuildConfig(ctx context.Context, name string, options *metav1.GetOptions) (*buildapi.BuildConfig, error)
- func (c Client) GetImageStream(ctx context.Context, name string, options *metav1.GetOptions) (*imageapi.ImageStream, error)
- func (c Client) GetImageStreamImage(ctx context.Context, name string, options *metav1.GetOptions) (*imageapi.ImageStreamImage, error)
- func (c Client) GetImageStreamTag(ctx context.Context, name string, options *metav1.GetOptions) (*imageapi.ImageStreamTag, error)
- func (c Client) UpdateBuild(ctx context.Context, build *buildapi.Build) error
- func (c Client) UpdateBuildConfig(ctx context.Context, buildConfig *buildapi.BuildConfig) error
- type GeneratorClient
- type GeneratorFatalError
- type TestingClient
- func (c TestingClient) CreateBuild(ctx context.Context, build *buildapi.Build) error
- func (c TestingClient) GetBuild(ctx context.Context, name string, options *metav1.GetOptions) (*buildapi.Build, error)
- func (c TestingClient) GetBuildConfig(ctx context.Context, name string, options *metav1.GetOptions) (*buildapi.BuildConfig, error)
- func (c TestingClient) GetImageStream(ctx context.Context, name string, options *metav1.GetOptions) (*imageapi.ImageStream, error)
- func (c TestingClient) GetImageStreamImage(ctx context.Context, name string, options *metav1.GetOptions) (*imageapi.ImageStreamImage, error)
- func (c TestingClient) GetImageStreamTag(ctx context.Context, name string, options *metav1.GetOptions) (*imageapi.ImageStreamTag, error)
- func (c TestingClient) UpdateBuild(ctx context.Context, build *buildapi.Build) error
- func (c TestingClient) UpdateBuildConfig(ctx context.Context, buildConfig *buildapi.BuildConfig) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FetchServiceAccountSecrets ¶
func FetchServiceAccountSecrets(secrets kcoreclient.SecretsGetter, serviceAccounts kcoreclient.ServiceAccountsGetter, namespace, serviceAccount string) ([]kapi.Secret, error)
FetchServiceAccountSecrets retrieves the Secrets used for pushing and pulling images from private Docker registries.
func UpdateCustomImageEnv ¶
func UpdateCustomImageEnv(strategy *buildapi.CustomBuildStrategy, newImage string)
UpdateCustomImageEnv updates base image env variable reference with the new image for a custom build strategy. If no env variable reference exists, create a new env variable.
Types ¶
type BuildGenerator ¶
type BuildGenerator struct { Client GeneratorClient ServiceAccounts kcoreclient.ServiceAccountsGetter Secrets kcoreclient.SecretsGetter }
BuildGenerator is a central place responsible for generating new Build objects from BuildConfigs and other Builds.
func (*BuildGenerator) Clone ¶
func (g *BuildGenerator) Clone(ctx context.Context, request *buildapi.BuildRequest) (*buildapi.Build, error)
Clone returns clone of a Build
func (*BuildGenerator) Instantiate ¶
func (g *BuildGenerator) Instantiate(ctx context.Context, request *buildapi.BuildRequest) (*buildapi.Build, error)
Instantiate returns a new Build object based on a BuildRequest object
type Client ¶
type Client struct { BuildConfigs buildclient.BuildConfigsGetter Builds buildclient.BuildsGetter ImageStreams imageclient.ImageStreamsGetter ImageStreamImages imageclient.ImageStreamImagesGetter ImageStreamTags imageclient.ImageStreamTagsGetter }
Client is an implementation of the GeneratorClient interface
func (Client) CreateBuild ¶
CreateBuild creates a new build
func (Client) GetBuild ¶
func (c Client) GetBuild(ctx context.Context, name string, options *metav1.GetOptions) (*buildapi.Build, error)
GetBuild retrieves a build
func (Client) GetBuildConfig ¶
func (c Client) GetBuildConfig(ctx context.Context, name string, options *metav1.GetOptions) (*buildapi.BuildConfig, error)
GetBuildConfig retrieves a named build config
func (Client) GetImageStream ¶
func (c Client) GetImageStream(ctx context.Context, name string, options *metav1.GetOptions) (*imageapi.ImageStream, error)
GetImageStream retrieves a named image stream
func (Client) GetImageStreamImage ¶
func (c Client) GetImageStreamImage(ctx context.Context, name string, options *metav1.GetOptions) (*imageapi.ImageStreamImage, error)
GetImageStreamImage retrieves an image stream image
func (Client) GetImageStreamTag ¶
func (c Client) GetImageStreamTag(ctx context.Context, name string, options *metav1.GetOptions) (*imageapi.ImageStreamTag, error)
GetImageStreamTag retrieves and image stream tag
func (Client) UpdateBuild ¶
UpdateBuild updates a build
func (Client) UpdateBuildConfig ¶
UpdateBuildConfig updates a named build config
type GeneratorClient ¶
type GeneratorClient interface { GetBuildConfig(ctx context.Context, name string, options *metav1.GetOptions) (*buildapi.BuildConfig, error) UpdateBuildConfig(ctx context.Context, buildConfig *buildapi.BuildConfig) error GetBuild(ctx context.Context, name string, options *metav1.GetOptions) (*buildapi.Build, error) CreateBuild(ctx context.Context, build *buildapi.Build) error UpdateBuild(ctx context.Context, build *buildapi.Build) error GetImageStream(ctx context.Context, name string, options *metav1.GetOptions) (*imageapi.ImageStream, error) GetImageStreamImage(ctx context.Context, name string, options *metav1.GetOptions) (*imageapi.ImageStreamImage, error) GetImageStreamTag(ctx context.Context, name string, options *metav1.GetOptions) (*imageapi.ImageStreamTag, error) }
GeneratorClient is the API client used by the generator
type GeneratorFatalError ¶
type GeneratorFatalError struct { // Reason the fatal error occurred Reason string }
GeneratorFatalError represents a fatal error while generating a build. An operation that fails because of a fatal error should not be retried.
func (*GeneratorFatalError) Error ¶
func (e *GeneratorFatalError) Error() string
Error returns the error string for this fatal error
type TestingClient ¶
type TestingClient struct { GetBuildConfigFunc func(ctx context.Context, name string, options *metav1.GetOptions) (*buildapi.BuildConfig, error) UpdateBuildConfigFunc func(ctx context.Context, buildConfig *buildapi.BuildConfig) error GetBuildFunc func(ctx context.Context, name string, options *metav1.GetOptions) (*buildapi.Build, error) CreateBuildFunc func(ctx context.Context, build *buildapi.Build) error UpdateBuildFunc func(ctx context.Context, build *buildapi.Build) error GetImageStreamFunc func(ctx context.Context, name string, options *metav1.GetOptions) (*imageapi.ImageStream, error) GetImageStreamImageFunc func(ctx context.Context, name string, options *metav1.GetOptions) (*imageapi.ImageStreamImage, error) GetImageStreamTagFunc func(ctx context.Context, name string, options *metav1.GetOptions) (*imageapi.ImageStreamTag, error) }
TestingClient is an implementation of the GeneratorClient interface
func (TestingClient) CreateBuild ¶
CreateBuild creates a new build
func (TestingClient) GetBuild ¶
func (c TestingClient) GetBuild(ctx context.Context, name string, options *metav1.GetOptions) (*buildapi.Build, error)
GetBuild retrieves a build
func (TestingClient) GetBuildConfig ¶
func (c TestingClient) GetBuildConfig(ctx context.Context, name string, options *metav1.GetOptions) (*buildapi.BuildConfig, error)
GetBuildConfig retrieves a named build config
func (TestingClient) GetImageStream ¶
func (c TestingClient) GetImageStream(ctx context.Context, name string, options *metav1.GetOptions) (*imageapi.ImageStream, error)
GetImageStream retrieves a named image stream
func (TestingClient) GetImageStreamImage ¶
func (c TestingClient) GetImageStreamImage(ctx context.Context, name string, options *metav1.GetOptions) (*imageapi.ImageStreamImage, error)
GetImageStreamImage retrieves an image stream image
func (TestingClient) GetImageStreamTag ¶
func (c TestingClient) GetImageStreamTag(ctx context.Context, name string, options *metav1.GetOptions) (*imageapi.ImageStreamTag, error)
GetImageStreamTag retrieves and image stream tag
func (TestingClient) UpdateBuild ¶
UpdateBuild updates a build
func (TestingClient) UpdateBuildConfig ¶
func (c TestingClient) UpdateBuildConfig(ctx context.Context, buildConfig *buildapi.BuildConfig) error
UpdateBuildConfig updates a named build config