component

package
v0.0.19 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2019 License: Apache-2.0 Imports: 26 Imported by: 64

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUserRequestedWatchExit = fmt.Errorf("safely exiting from filesystem watch based on user request")

ErrUserRequestedWatchExit is returned when the user stops the watch loop

Functions

func Build added in v0.0.5

func Build(client *occlient.Client, componentName string, applicationName string, wait bool, stdout io.Writer) error

Build component from BuildConfig. If 'wait' is true than it waits for build to successfully complete. If 'wait' is false than this function won't return error even if build failed.

func CreateFromGit

func CreateFromGit(client *occlient.Client, params occlient.CreateArgs) error

CreateFromGit inputPorts is the array containing the string port values inputPorts is the array containing the string port values envVars is the array containing the environment variables

func CreateFromPath added in v0.0.5

func CreateFromPath(client *occlient.Client, params occlient.CreateArgs) error

CreateFromPath create new component with source or binary from the given local path sourceType indicates the source type of the component and can be either local or binary envVars is the array containing the environment variables

func Delete

func Delete(client *occlient.Client, componentName string, applicationName string) error

Delete whole component

func Exists added in v0.0.4

func Exists(client *occlient.Client, componentName, applicationName string) (bool, error)

Exists checks whether a component with the given name exists in the current application or not componentName is the component name to perform check for The first returned parameter is a bool indicating if a component with the given name already exists or not The second returned parameter is the error that might occurs while execution

func GetComponentDir added in v0.0.15

func GetComponentDir(path string, paramType occlient.CreateType) (string, error)

GetComponentDir returns source repo name Parameters:

path: git url or source path or binary path
paramType: One of CreateType as in GIT/LOCAL/BINARY

Returns: directory name

func GetComponentLinkedSecretNames added in v0.0.18

func GetComponentLinkedSecretNames(client *occlient.Client, componentName string, applicationName string) (secretNames []string, err error)

GetComponentLinkedSecretNames provides a slice containing the names of the secrets that are present in envFrom

func GetComponentPorts added in v0.0.10

func GetComponentPorts(client *occlient.Client, componentName string, applicationName string) (ports []string, err error)

GetComponentPorts provides slice of ports used by the component in the form port_no/protocol

func GetComponentSource added in v0.0.3

func GetComponentSource(client *occlient.Client, componentName string, applicationName string) (string, string, error)

GetComponentSource what source type given component uses The first returned string is component source type ("git" or "local" or "binary") The second returned string is a source (url to git repository or local path or path to binary) we retrieve the source type by looking up the DeploymentConfig that's deployed

func GetComponentType added in v0.0.3

func GetComponentType(client *occlient.Client, componentName string, applicationName string) (string, error)

GetComponentType returns type of component in given application and project

func GetCurrent

func GetCurrent(applicationName string, projectName string) (string, error)

GetCurrent component in active application returns "" if there is no active component

func GetDefaultComponentName added in v0.0.15

func GetDefaultComponentName(componentPath string, componentPathType occlient.CreateType, componentType string, existingComponentList []Description) (string, error)

GetDefaultComponentName generates a unique component name Parameters: desired default component name(w/o prefix) and slice of existing component names Returns: Unique component name and error if any

func GetLogs added in v0.0.6

func GetLogs(client *occlient.Client, componentName string, applicationName string, follow bool, stdout io.Writer) error

GetLogs follow the DeploymentConfig logs if follow is set to true

func PushLocal added in v0.0.3

func PushLocal(client *occlient.Client, componentName string, applicationName string, path string, out io.Writer, files []string, delFiles []string, isForcePush bool) error

PushLocal push local code to the cluster and trigger build there. During copying binary components, path represent base directory path to binary and files contains path of binary During copying local source components, path represent base directory path whereas files is empty During `odo watch`, path represent base directory path whereas files contains list of changed Files Parameters:

componentName is name of the component to update sources to
applicationName is the name of the application of which the component is a part
path is base path of the component source/binary
files is list of changed files captured during `odo watch` as well as binary file path
delFiles is the list of files identified as deleted
isForcePush indicates if the sources to be updated are due to a push in which case its a full source directory push or only push of identified sources

Returns

Error if any

func SetCurrent

func SetCurrent(componentName string, applicationName string, projectName string) error

SetCurrent sets the given componentName as active component

func Update added in v0.0.4

func Update(client *occlient.Client, componentName string, applicationName string, newSourceType string, newSource string, newSourceRef string, stdout io.Writer) error

Update updates the requested component componentName is the name of the component to be updated applicationName is the name of the application of the component newSourceType indicates the type of the new source i.e git/local/binary newSource indicates path of the source directory or binary or the git URL stdout is the io writer for streaming build logs on stdout

func WatchAndPush added in v0.0.4

func WatchAndPush(client *occlient.Client, out io.Writer, parameters WatchParameters) error

WatchAndPush watches path, if something changes in that path it calls PushLocal ignores .git/* by default inspired by https://github.com/openshift/origin/blob/e785f76194c57bd0e1674c2f2776333e1e0e4e78/pkg/oc/cli/cmd/rsync/rsync.go#L257 Parameters:

client: occlient instance
out: io Writer instance
parameters: WatchParameters

Types

type Component added in v0.0.19

type Component struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              ComponentSpec   `json:"spec,omitempty"`
	Status            ComponentStatus `json:"status,omitempty"`
}

Component

type ComponentList added in v0.0.19

type ComponentList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []Component `json:"items"`
}

ComponentList is list of components

type ComponentSpec added in v0.0.19

type ComponentSpec struct {
	Type    string          `json:"type,omitempty"`
	Source  string          `json:"source,omitempty"`
	URL     []string        `json:"url,omitempty"`
	Storage []string        `json:"storage,omitempty"`
	Env     []corev1.EnvVar `json:"env,omitempty"`
}

ComponentSpec is spec of components

type ComponentStatus added in v0.0.19

type ComponentStatus struct {
	Active bool `json:"active"`
}

ComponentStatus is Status of components

type Description added in v0.0.17

type Description struct {
	ComponentName      string                `json:"componentName,omitempty"`
	ComponentImageType string                `json:"type,omitempty"`
	Path               string                `json:"source,omitempty"`
	URLs               []urlpkg.URL          `json:"url,omitempty"`
	Env                []corev1.EnvVar       `json:"environment,omitempty"`
	Storage            []storage.StorageInfo `json:"storage,omitempty"`
	LinkedComponents   map[string][]string   `json:"linkedComponents,omitempty"`
	LinkedServices     []string              `json:"linkedServices,omitempty"`
}

Description holds all information about component

func GetComponentDesc added in v0.0.4

func GetComponentDesc(client *occlient.Client, componentName string, applicationName string, projectName string) (componentDesc Description, err error)

GetComponentDesc provides description such as source, url & storage about given component

func List added in v0.0.3

func List(client *occlient.Client, applicationName string) ([]Description, error)

List lists components in active application

type WatchParameters added in v0.0.17

type WatchParameters struct {
	// Name of component that is to be watched
	ComponentName string
	// Name of application, the component is part of
	ApplicationName string
	// The path to the source of component(local or binary)
	Path string
	// List/Slice of files/folders in component source, the updates to which need not be pushed to component deployed pod
	FileIgnores []string
	// Custom function that can be used to push detected changes to remote pod. For more info about what each of the parameters to this function, please refer, pkg/component/component.go#PushLocal
	WatchHandler func(*occlient.Client, string, string, string, io.Writer, []string, []string, bool) error
	// This is a channel added to signal readiness of the watch command to the external channel listeners
	StartChan chan bool
	// This is a channel added to terminate the watch command gracefully without passing SIGINT. "Stop" message on this channel terminates WatchAndPush function
	ExtChan chan bool
	// Interval of time before pushing changes to remote(component) pod
	PushDiffDelay int
}

WatchParameters is designed to hold the controllables and attributes that the watch function works on

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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