component

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: May 14, 2020 License: Apache-2.0 Imports: 31 Imported by: 64

Documentation

Index

Constants

View Source
const (
	// StateTypePushed means that Storage is present both locally and on cluster
	StateTypePushed State = "Pushed"
	// StateTypeNotPushed means that Storage is only in local config, but not on the cluster
	StateTypeNotPushed = "Not Pushed"
	// StateTypeUnknown means that odo cannot tell its state
	StateTypeUnknown = "Unknown"
)
View Source
const ComponentSourceTypeAnnotation = "app.kubernetes.io/component-source-type"

Variables

This section is empty.

Functions

func ApplyConfig added in v1.0.0

func ApplyConfig(client *occlient.Client, kClient *kclient.Client, componentConfig config.LocalConfigInfo, envSpecificInfo envinfo.EnvSpecificInfo, stdout io.Writer, cmpExist bool) (err error)

ApplyConfig applies the component config onto component dc Parameters:

	client: occlient instance
	kClient: kclient instance
	appName: Name of application of which the component is a part
	componentName: Name of the component which is being patched with config
	componentConfig: Component configuration
	envSpecificInfo: Component environment specific information, available if uses devfile
 cmpExist: true if components exists in the cluster

Returns:

err: Errors if any else nil

func Build added in v0.0.5

func Build(client *occlient.Client, componentName string, applicationName string, wait bool, stdout io.Writer, show bool) 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. 'show' will determine whether or not the log will be shown to the user (while building)

func CheckComponentMandatoryParams added in v1.0.0

func CheckComponentMandatoryParams(componentSettings config.ComponentSettings) error

CheckComponentMandatoryParams checks mandatory parammeters for component

func CreateComponent added in v1.0.0

func CreateComponent(client *occlient.Client, componentConfig config.LocalConfigInfo, context string, stdout io.Writer) (err error)

CreateComponent creates component as per the passed component settings

Parameters:
	client: occlient instance
	componentConfig: the component configuration that holds all details of component
	context: the component context indicating the location of component config and hence its source as well
	stdout: io.Writer instance to write output to
Returns:
	err: errors if any

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, wait bool, componentName, applicationName string) error

Delete whole component

func Deploy added in v1.0.0

func Deploy(client *occlient.Client, params occlient.CreateArgs, desiredRevision int64) error

Deploy deploys the component it starts a new deployment and wait for the new dc to be available desiredRevision is the desired version of the deployment config to wait for

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 config.SrcType) (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 GetDefaultComponentName added in v0.0.15

func GetDefaultComponentName(componentPath string, componentPathType config.SrcType, componentType string, existingComponentList ComponentList) (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, globExps []string, show 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
globExps are the glob expressions which are to be ignored during the push
show determines whether or not to show the log (passed in by po.show argument within /cmd)

Returns

Error if any

func UnlinkComponents added in v1.0.3

func UnlinkComponents(parentComponent Component, compoList ComponentList) map[string][]string

UnlinkComponents takes the component to be deleted and list of active components in the cluster as arguments. It returns a map with keys indicating the components that are linked to the parent component and values indicating the corresponding secret names

func Update added in v0.0.4

func Update(client *occlient.Client, componentConfig config.LocalConfigInfo, newSource string, stdout io.Writer) error

Update updates the requested component Parameters:

client: occlient instance
componentConfig: Component configuration
newSource: Location of component source resolved to absolute path
stdout: io pipe to write logs to

Returns:

errors if any

func ValidateComponentCreateRequest added in v1.0.0

func ValidateComponentCreateRequest(client *occlient.Client, componentSettings config.ComponentSettings, contextDir string) (err error)

ValidateComponentCreateRequest validates request for component creation and returns errors if any Returns:

errors if any

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

func GetComponent added in v0.0.20

func GetComponent(client *occlient.Client, componentName string, applicationName string, projectName string) (component Component, err error)

GetComponent provides component definition

func GetComponentFromConfig added in v1.0.0

func GetComponentFromConfig(localConfig *config.LocalConfigInfo) (Component, error)

GetComponentFromConfig returns the component on the config if it exists

type ComponentFullDescription added in v1.2.1

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

ComponentFullDescription describes a component fully

func NewComponentFullDescriptionFromClientAndLocalConfig added in v1.2.1

func NewComponentFullDescriptionFromClientAndLocalConfig(client *occlient.Client, localConfigInfo *config.LocalConfigInfo, componentName string, applicationName string, projectName string) (*ComponentFullDescription, error)

NewComponentFullDescriptionFromClientAndLocalConfig gets the complete description of the component from both localconfig and cluster

func (*ComponentFullDescription) Print added in v1.2.1

func (cfd *ComponentFullDescription) Print(client *occlient.Client) error

Print prints the complete information of component onto stdout (Note: longterm this function should not need to access any parameters, but just print the information in struct)

type ComponentFullDescriptionSpec added in v1.2.1

type ComponentFullDescriptionSpec struct {
	App        string              `json:"app,omitempty"`
	Type       string              `json:"type,omitempty"`
	Source     string              `json:"source,omitempty"`
	SourceType string              `json:"sourceType,omitempty"`
	URL        urlpkg.URLList      `json:"urls,omitempty"`
	Storage    storage.StorageList `json:"storages,omitempty"`
	Env        []corev1.EnvVar     `json:"env,omitempty"`
	Ports      []string            `json:"ports,omitempty"`
}

ComponentFullDescriptionSpec repersents complete desciption of the 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

func GetMachineReadableFormatForList added in v1.0.0

func GetMachineReadableFormatForList(components []Component) ComponentList

GetMachineReadableFormatForList returns list of components in machine readable format

func List added in v0.0.3

func List(client *occlient.Client, applicationName string, localConfigInfo *config.LocalConfigInfo) (ComponentList, error)

List lists components in active application

func ListIfPathGiven added in v1.0.0

func ListIfPathGiven(client *occlient.Client, paths []string) (ComponentList, error)

ListIfPathGiven lists all available component in given path directory

type ComponentSpec added in v0.0.19

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

ComponentSpec is spec of components

type ComponentStatus added in v0.0.19

type ComponentStatus struct {
	Context          string              `json:"context,omitempty"`
	State            State               `json:"state"`
	LinkedComponents map[string][]string `json:"linkedComponents,omitempty"`
	LinkedServices   []string            `json:"linkedServices,omitempty"`
}

ComponentStatus is Status of components

type State added in v1.1.2

type State string

State reperesents component state

func GetComponentState added in v1.1.2

func GetComponentState(client *occlient.Client, componentName, applicationName string) State

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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