Documentation
¶
Index ¶
- Constants
- func ApplyConfig(client *occlient.Client, kClient *kclient.Client, ...) (err error)
- func Build(client *occlient.Client, componentName string, applicationName string, ...) error
- func CheckComponentMandatoryParams(componentSettings config.ComponentSettings) error
- func CreateComponent(client *occlient.Client, componentConfig config.LocalConfigInfo, ...) (err error)
- func CreateFromGit(client *occlient.Client, params occlient.CreateArgs) error
- func CreateFromPath(client *occlient.Client, params occlient.CreateArgs) error
- func Delete(client *occlient.Client, wait bool, componentName, applicationName string) error
- func Deploy(client *occlient.Client, params occlient.CreateArgs, desiredRevision int64) error
- func Exists(client *occlient.Client, componentName, applicationName string) (bool, error)
- func GetComponentDir(path string, paramType config.SrcType) (string, error)
- func GetComponentLinkedSecretNames(client *occlient.Client, componentName string, applicationName string) (secretNames []string, err error)
- func GetComponentPorts(client *occlient.Client, componentName string, applicationName string) (ports []string, err error)
- func GetComponentSource(client *occlient.Client, componentName string, applicationName string) (string, string, error)
- func GetComponentType(client *occlient.Client, componentName string, applicationName string) (string, error)
- func GetDefaultComponentName(componentPath string, componentPathType config.SrcType, componentType string, ...) (string, error)
- func GetLogs(client *occlient.Client, componentName string, applicationName string, ...) error
- func PushLocal(client *occlient.Client, componentName string, applicationName string, ...) error
- func UnlinkComponents(parentComponent Component, compoList ComponentList) map[string][]string
- func Update(client *occlient.Client, componentConfig config.LocalConfigInfo, ...) error
- func ValidateComponentCreateRequest(client *occlient.Client, componentSettings config.ComponentSettings, ...) (err error)
- type Component
- type ComponentFullDescription
- type ComponentFullDescriptionSpec
- type ComponentList
- type ComponentSpec
- type ComponentStatus
- type State
Constants ¶
const ComponentSourceTypeAnnotation = "app.kubernetes.io/component-source-type"
Variables ¶
This section is empty.
Functions ¶
func ApplyConfig ¶
func ApplyConfig(client *occlient.Client, kClient *kclient.Client, componentConfig config.LocalConfigInfo, envSpecificInfo envinfo.EnvSpecificInfo, stdout io.Writer, cmpExist bool, endpointMap map[int32]parsercommon.Endpoint) (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 endpointMap: value is devfile endpoint entry, key is the TargetPort for each enpoint entry
Returns:
err: Errors if any else nil
func Build ¶
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 ¶
func CheckComponentMandatoryParams(componentSettings config.ComponentSettings) error
CheckComponentMandatoryParams checks mandatory parammeters for component
func CreateComponent ¶
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 ¶
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 Deploy ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
func GetComponentType(client *occlient.Client, componentName string, applicationName string) (string, error)
GetComponentType returns type of component in given application and project
func GetDefaultComponentName ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
func GetComponent(client *occlient.Client, componentName string, applicationName string, projectName string) (component Component, err error)
GetComponent provides component definition
func GetComponentFromConfig ¶
func GetComponentFromConfig(localConfig *config.LocalConfigInfo) (Component, error)
GetComponentFromConfig returns the component on the config if it exists
type ComponentFullDescription ¶
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 ¶
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
type ComponentFullDescriptionSpec ¶
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 ¶
type ComponentList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty"` Items []Component `json:"items"` }
ComponentList is list of components
func GetMachineReadableFormatForList ¶
func GetMachineReadableFormatForList(components []Component) ComponentList
GetMachineReadableFormatForList returns list of components in machine readable format
func List ¶
func List(client *occlient.Client, applicationName string, localConfigInfo *config.LocalConfigInfo) (ComponentList, error)
List lists components in active application
func ListIfPathGiven ¶
func ListIfPathGiven(client *occlient.Client, paths []string) (ComponentList, error)
ListIfPathGiven lists all available component in given path directory
type ComponentSpec ¶
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 ¶
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 ¶
type State string
State reperesents component state
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 State = "Not Pushed" // StateTypeUnknown means that odo cannot tell its state StateTypeUnknown State = "Unknown" )