Documentation ¶
Overview ¶
Package deploy is purposed to deploy an app. This concern encompasses creating the app CRD if it doesn't exist, possibly creating the app image from source code, and then creating a deployment that will the image in a k8s cluster.
Index ¶
- Constants
- Variables
- func GetImageConfig(ctx context.Context, args ImageConfigRequest) (*registryv1.ConfigFile, error)
- func WaitForDeployment(ctx context.Context, svc *Services, app *ketchv1.App, timeout time.Duration) error
- type Application
- type CName
- type ChangeSet
- type Client
- type GetImageConfigFn
- type Hooks
- type ImageConfigRequest
- type Options
- type Port
- type Process
- type Restart
- type Runner
- type Services
- type SourceBuilderFn
- type WaitFn
Constants ¶
const ( FlagApp = "app" FlagImage = "image" FlagKetchYaml = "ketch-yaml" FlagStrict = "strict" FlagSteps = "steps" FlagStepInterval = "step-interval" FlagWait = "wait" FlagTimeout = "timeout" FlagDescription = "description" FlagEnvironment = "env" FlagFramework = "framework" FlagRegistrySecret = "registry-secret" FlagBuilder = "builder" FlagBuildPacks = "build-packs" FlagVolume = "volume" FlagVolumeMountPath = "volume-mount-path" FlagVolumeMountOptions = "volume-mount-options" FlagFSGroup = "fs-group" FlagRunAsUser = "run-as-user" FlagUnits = "units" FlagVersion = "unit-version" FlagProcess = "unit-process" FlagAppShort = "a" FlagImageShort = "i" FlagDescriptionShort = "d" FlagEnvironmentShort = "e" FlagFrameworkShort = "k" )
Command line flags
Variables ¶
var (
DefaultBuilder = "heroku/buildpacks:20"
)
Functions ¶
func GetImageConfig ¶
func GetImageConfig(ctx context.Context, args ImageConfigRequest) (*registryv1.ConfigFile, error)
Types ¶
type Application ¶
type Application struct { Version *string `json:"version,omitempty"` Type *string `json:"type"` Name *string `json:"name"` Image *string `json:"image,omitempty"` Framework *string `json:"framework"` Description *string `json:"description,omitempty"` Environment []string `json:"environment,omitempty"` RegistrySecret *string `json:"registrySecret,omitempty"` Builder *string `json:"builder,omitempty"` BuildPacks []string `json:"buildPacks,omitempty"` Processes []Process `json:"processes,omitempty"` CName *CName `json:"cname,omitempty"` }
Application represents the fields in an application.yaml file that will be transitioned to a ChangeSet.
func GetApplicationFromKetchApp ¶
func GetApplicationFromKetchApp(app ketchv1.App) *Application
GetApplicationFromKetchApp takes an App parameter and returns a yaml-file friendly Application
type Client ¶
type Client interface { Get(ctx context.Context, key client.ObjectKey, obj client.Object) error Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) error Update(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error }
Client represents go sdk k8s client operations that we need.
type GetImageConfigFn ¶
type GetImageConfigFn func(ctx context.Context, args ImageConfigRequest) (*registryv1.ConfigFile, error)
type ImageConfigRequest ¶
type ImageConfigRequest struct {
// contains filtered or unexported fields
}
type Options ¶
type Options struct { AppName string Image string KetchYamlFileName string StrictKetchYamlDecoding bool Steps int StepTimeInterval string Wait bool Timeout string AppSourcePath string SubPaths []string Framework string Description string Envs []string DockerRegistrySecret string Builder string BuildPacks []string Volume string VolumeMountPath string VolumeMountOptions map[string]string FSGroup int64 RunAsUser int64 Units int Version int Process string }
Options receive values set in flags. They are processed into a ChangeSet which describes the values that have been explicitly set by the end user. In this way we know if we will need to update an existing app CRD.
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
Runner is concerned with managing and running the deployment.
type Services ¶
type Services struct { // Client gets updates and creates ketch CRDs Client Client // Kubernetes client KubeClient kubernetes.Interface // Builder references source builder from internal/builder package Builder SourceBuilderFn // Function that retrieve image config GetImageConfig GetImageConfigFn // Wait is a function that will wait until it detects the a deployment is finished Wait WaitFn // Writer probably points to stdout or stderr, receives textual output Writer io.Writer }
Services contains interfaces and function pointers to external services needed for deploy. The purpose of this structure is so that we can swap out implementations of these services for unit tests.