common

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultDevfileBuildCommand is a predefined devfile command for build
	DefaultDevfileBuildCommand PredefinedDevfileCommands = "devbuild"

	// DefaultDevfileRunCommand is a predefined devfile command for run
	DefaultDevfileRunCommand PredefinedDevfileCommands = "devrun"

	// SupervisordInitContainerName The init container name for supervisord
	SupervisordInitContainerName = "copy-supervisord"

	// SupervisordVolumeName Create a custom name and (hope) that users don't use the *exact* same name in their deployment (occlient.go)
	SupervisordVolumeName = "odo-supervisord-shared-data"

	// SupervisordMountPath The supervisord Mount Path for the container mounting the supervisord volume
	SupervisordMountPath = "/opt/odo/"

	// SupervisordBinaryPath The supervisord binary path inside the container volume mount
	SupervisordBinaryPath = "/opt/odo/bin/supervisord"

	// SupervisordConfFile The supervisord configuration file inside the container volume mount
	SupervisordConfFile = "/opt/odo/conf/devfile-supervisor.conf"

	// OdoInitImageContents The path to the odo init image contents
	OdoInitImageContents = "/opt/odo-init/."

	// EnvCheProjectsRoot is the env defined for /projects where component mountSources=true
	EnvCheProjectsRoot = "CHE_PROJECTS_ROOT"

	// EnvOdoCommandRunWorkingDir is the env defined in the runtime component container which holds the work dir for the run command
	EnvOdoCommandRunWorkingDir = "ODO_COMMAND_RUN_WORKING_DIR"

	// EnvOdoCommandRun is the env defined in the runtime component container which holds the run command to be executed
	EnvOdoCommandRun = "ODO_COMMAND_RUN"

	// ShellExecutable is the shell executable
	ShellExecutable = "/bin/sh"

	// SupervisordCtlSubCommand is the supervisord sub command ctl
	SupervisordCtlSubCommand = "ctl"
)

Variables

This section is empty.

Functions

func GetBootstrapperImage added in v1.1.2

func GetBootstrapperImage() string

GetBootstrapperImage returns the odo-init bootstrapper image

func GetBuildCommand added in v1.1.2

func GetBuildCommand(data data.DevfileData, devfileBuildCmd string) (buildCommand common.DevfileCommand, err error)

GetBuildCommand iterates through the components in the devfile and returns the build command

func GetRunCommand added in v1.1.2

func GetRunCommand(data data.DevfileData, devfileRunCmd string) (runCommand common.DevfileCommand, err error)

GetRunCommand iterates through the components in the devfile and returns the run command

func GetSupportedComponents

func GetSupportedComponents(data data.DevfileData) []common.DevfileComponent

GetSupportedComponents iterates through the components in the devfile and returns a list of odo supported components

func GetVolumes added in v1.2.0

func GetVolumes(devfileObj devfileParser.DevfileObj) map[string][]DevfileVolume

GetVolumes iterates through the components in the devfile and returns a map of component alias to the devfile volumes

func IsComponentBuildRequired added in v1.2.0

func IsComponentBuildRequired(pushDevfileCommands []common.DevfileCommand) (bool, error)

IsComponentBuildRequired checks if a component build is required based on the push commands, it throws an error if the push commands does not meet the expected criteria

func IsEnvPresent added in v1.2.0

func IsEnvPresent(envVars []common.DockerimageEnv, envVarName string) bool

IsEnvPresent checks if the env variable is present in an array of env variables

func IsPortPresent added in v1.2.0

func IsPortPresent(endpoints []common.DockerimageEndpoint, port int) bool

IsPortPresent checks if the port is present in the endpoints array

func ValidateAndGetPushDevfileCommands added in v1.1.2

func ValidateAndGetPushDevfileCommands(data data.DevfileData, devfileBuildCmd, devfileRunCmd string) (pushDevfileCommands []common.DevfileCommand, err error)

ValidateAndGetPushDevfileCommands validates the build and the run command, if provided through odo push or else checks the devfile for devBuild and devRun. It returns the build and run commands if its validated successfully, error otherwise.

Types

type AdapterContext

type AdapterContext struct {
	ComponentName string                   // ComponentName is the odo component name, it is NOT related to any devfile components
	Devfile       devfileParser.DevfileObj // Devfile is the object returned by the Devfile parser
}

AdapterContext is a construct that is common to all adapters

type ComponentAdapter

type ComponentAdapter interface {
	Push(parameters PushParameters) error
	DoesComponentExist(cmpName string) bool
	Delete(labels map[string]string) error
}

ComponentAdapter defines the functions that platform-specific adapters must implement

type ComponentInfo added in v1.2.0

type ComponentInfo struct {
	PodName       string
	ContainerName string
}

ComponentInfo is a struct that holds information about a component i.e.; pod name, container name

type DevfileVolume

type DevfileVolume struct {
	Name          *string
	ContainerPath *string
	Size          *string
}

DevfileVolume is a struct for Devfile volume that is common to all the adapters

type PredefinedDevfileCommands added in v1.1.2

type PredefinedDevfileCommands string

PredefinedDevfileCommands encapsulates constants for predefined devfile commands

type PushParameters added in v1.1.2

type PushParameters struct {
	Path              string                  // Path refers to the parent folder containing the source code to push up to a component
	WatchFiles        []string                // Optional: WatchFiles is the list of changed files detected by odo watch. If empty or nil, odo will check .odo/odo-file-index.json to determine changed files
	WatchDeletedFiles []string                // Optional: WatchDeletedFiles is the list of deleted files detected by odo watch. If empty or nil, odo will check .odo/odo-file-index.json to determine deleted files
	IgnoredFiles      []string                // IgnoredFiles is the list of files to not push up to a component
	ForceBuild        bool                    // ForceBuild determines whether or not to push all of the files up to a component or just files that have changed, added or removed.
	Show              bool                    // Show tells whether the devfile command output should be shown on stdout
	DevfileBuildCmd   string                  // DevfileBuildCmd takes the build command through the command line and overwrites devfile build command
	DevfileRunCmd     string                  // DevfileRunCmd takes the run command through the command line and overwrites devfile run command
	EnvSpecificInfo   envinfo.EnvSpecificInfo // EnvSpecificInfo contains infomation of env.yaml file
}

PushParameters is a struct containing the parameters to be used when pushing to a devfile component

type Storage

type Storage struct {
	Name   string
	Volume DevfileVolume
}

Storage is a struct that is common to all the adapters

type StorageAdapter

type StorageAdapter interface {
	Create([]Storage) error
}

StorageAdapter defines the storage functions that platform-specific adapters must implement

type SyncParameters added in v1.2.0

type SyncParameters struct {
	PushParams      PushParameters
	CompInfo        ComponentInfo
	PodChanged      bool
	ComponentExists bool
}

SyncParameters is a struct containing the parameters to be used when syncing a devfile component

Jump to

Keyboard shortcuts

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