...

Package component

Overview ▾

Index ▾

Constants
func ApplyKubernetes(mode string, appName string, componentName string, devfile parser.DevfileObj, kubernetes devfilev1.Component, kubeClient kclient.ClientInterface, path string) error
func Contains(component api.ComponentAbstract, components []api.ComponentAbstract) bool
func ExecuteInNewContainer(ctx context.Context, kubeClient kclient.ClientInterface, configAutomountClient configAutomount.Client, devfileObj parser.DevfileObj, componentName string, appName string, command v1alpha2.Command) error
func ExecuteRunCommand(ctx context.Context, execClient exec.Client, platformClient platform.Client, devfileCmd devfilev1.Command, componentExists bool, podName string, appName string, componentName string) error
func ExecuteTerminatingCommand(ctx context.Context, execClient exec.Client, platformClient platform.Client, command devfilev1.Command, componentExists bool, podName string, appName string, componentName string, msg string, directRun bool) error
func GatherName(contextDir string, devfileObj *parser.DevfileObj) (string, error)
func GetComponentRuntimeFromDevfileMetadata(metadata devfile.DevfileMetadata) string
func GetComponentTypeFromDevfileMetadata(metadata devfile.DevfileMetadata) string
func GetContainersNames(pod *corev1.Pod) []string
func GetDevfileInfo(ctx context.Context, kubeClient kclient.ClientInterface, podmanClient podman.Client, name string) (parser.DevfileObj, error)
func GetRunningModes(ctx context.Context, kubeClient kclient.ClientInterface, podmanClient podman.Client, name string) (map[platform.Client]api.RunningModes, error)
func ListAllClusterComponents(client kclient.ClientInterface, namespace string) ([]api.ComponentAbstract, error)
func ListAllComponents(client kclient.ClientInterface, podmanClient podman.Client, namespace string, devObj *parser.DevfileObj, componentName string) ([]api.ComponentAbstract, string, error)
func ListRoutesAndIngresses(client kclient.ClientInterface, componentName, appName string) (ings []api.ConnectionData, routes []api.ConnectionData, err error)
func Log(platformClient platform.Client, componentName string, appName string, follow bool, command v1alpha2.Command) (io.ReadCloser, error)
func NewRunHandler(ctx context.Context, platformClient platform.Client, execClient exec.Client, configAutomountClient configAutomount.Client, fs filesystem.Filesystem, imageBackend image.Backend, options HandlerOptions) *runHandler
func ValidateResourcesExist(client kclient.ClientInterface, devfileObj parser.DevfileObj, k8sComponents []devfile.Component, context string) error
func ValidateResourcesExistInK8sComponent(client kclient.ClientInterface, devfileObj parser.DevfileObj, k8sComponent devfile.Component, context string) (kindErr string, err error)
type HandlerOptions
type NoComponentFoundError
    func NewNoComponentFoundError(name string, namespace string) NoComponentFoundError
    func (e NoComponentFoundError) Error() string
type PushedComponent
type SecretMount

Package files

apply_kubernetes.go component.go errors.go execute_new_container.go execute_run.go execute_terminating.go handler.go pushed_component.go validate.go

Constants

const (
    NotAvailable = "Not available"
    UnknownValue = "Unknown"
)
const ShellExecutable string = "/bin/sh"

func ApplyKubernetes

func ApplyKubernetes(
    mode string,
    appName string,
    componentName string,
    devfile parser.DevfileObj,
    kubernetes devfilev1.Component,
    kubeClient kclient.ClientInterface,
    path string,
) error

ApplyKubernetes contains the logic to create the k8s resources defined by the `apply` command mode(Dev, Deploy): the mode in which the resources are deployed appName: application name devfile: the devfile object kubernetes: the kubernetes devfile component to be deployed kubeClient: Kubernetes client to be used to deploy the resource path: path to the context directory

func Contains

func Contains(component api.ComponentAbstract, components []api.ComponentAbstract) bool

Contains checks to see if the component exists in an array or not by checking the name

func ExecuteInNewContainer

func ExecuteInNewContainer(
    ctx context.Context,
    kubeClient kclient.ClientInterface,
    configAutomountClient configAutomount.Client,
    devfileObj parser.DevfileObj,
    componentName string,
    appName string,
    command v1alpha2.Command,
) error

func ExecuteRunCommand

func ExecuteRunCommand(ctx context.Context, execClient exec.Client, platformClient platform.Client, devfileCmd devfilev1.Command, componentExists bool, podName string, appName string, componentName string) error

ExecuteRunCommand executes a Devfile command in the specified pod If componentExists, the previous instance of the command will be stopped before (if hotReloadCapable is not set)

func ExecuteTerminatingCommand

func ExecuteTerminatingCommand(
    ctx context.Context,
    execClient exec.Client,
    platformClient platform.Client,
    command devfilev1.Command,
    componentExists bool,
    podName string,
    appName string,
    componentName string,
    msg string,
    directRun bool,
) error

func GatherName

func GatherName(contextDir string, devfileObj *parser.DevfileObj) (string, error)

GatherName computes and returns what should be used as name for the Devfile object specified.

If a non-blank name is available in the Devfile metadata (which is optional), it is sanitized and returned.

Otherwise, it uses Alizer to detect the name, from the project build tools (pom.xml, package.json, ...), or from the component directory name.

func GetComponentRuntimeFromDevfileMetadata

func GetComponentRuntimeFromDevfileMetadata(metadata devfile.DevfileMetadata) string

GetComponentRuntimeFromDevfileMetadata returns the Project Type defined in the Devfile metadata or if not set, the Language

func GetComponentTypeFromDevfileMetadata

func GetComponentTypeFromDevfileMetadata(metadata devfile.DevfileMetadata) string

GetComponentTypeFromDevfileMetadata returns component type from the devfile metadata; it could either be projectType or language, if neither of them are set, return 'Not available'

func GetContainersNames

func GetContainersNames(pod *corev1.Pod) []string

func GetDevfileInfo

func GetDevfileInfo(ctx context.Context, kubeClient kclient.ClientInterface, podmanClient podman.Client, name string) (parser.DevfileObj, error)

GetDevfileInfo extracts information from the labels and annotations of resources to rebuild a Devfile

func GetRunningModes

func GetRunningModes(ctx context.Context, kubeClient kclient.ClientInterface, podmanClient podman.Client, name string) (map[platform.Client]api.RunningModes, error)

GetRunningModes returns the list of modes on which a "name" component is deployed, by looking into namespace the resources deployed with matching labels, based on the "odo.dev/mode" label

func ListAllClusterComponents

func ListAllClusterComponents(client kclient.ClientInterface, namespace string) ([]api.ComponentAbstract, error)

ListAllClusterComponents returns a list of all "components" on a cluster that are both odo and non-odo components.

We then return a list of "components" intended for listing / output purposes specifically for commands such as: `odo list` that are both odo and non-odo components.

func ListAllComponents

func ListAllComponents(client kclient.ClientInterface, podmanClient podman.Client, namespace string, devObj *parser.DevfileObj, componentName string) ([]api.ComponentAbstract, string, error)

func ListRoutesAndIngresses

func ListRoutesAndIngresses(client kclient.ClientInterface, componentName, appName string) (ings []api.ConnectionData, routes []api.ConnectionData, err error)

ListRoutesAndIngresses lists routes and ingresses created by a component; it only returns the resources created with Deploy mode; it fetches resources from the cluster that match label and return.

func Log

func Log(platformClient platform.Client, componentName string, appName string, follow bool, command v1alpha2.Command) (io.ReadCloser, error)

Log returns log from component

func NewRunHandler

func NewRunHandler(
    ctx context.Context,
    platformClient platform.Client,
    execClient exec.Client,
    configAutomountClient configAutomount.Client,

    fs filesystem.Filesystem,
    imageBackend image.Backend,

    options HandlerOptions,

) *runHandler

func ValidateResourcesExist

func ValidateResourcesExist(client kclient.ClientInterface, devfileObj parser.DevfileObj, k8sComponents []devfile.Component, context string) error

ValidateResourcesExist validates if the Kubernetes inlined components are installed on the cluster

func ValidateResourcesExistInK8sComponent

func ValidateResourcesExistInK8sComponent(client kclient.ClientInterface, devfileObj parser.DevfileObj, k8sComponent devfile.Component, context string) (kindErr string, err error)

ValidateResourcesExistInK8sComponent validates if resources defined inside a Kubernetes inlined component are installed on the cluster

type HandlerOptions

type HandlerOptions struct {
    PodName           string
    ComponentExists   bool
    ContainersRunning []string
    Msg               string
    DirectRun         bool

    // For apply Kubernetes / Openshift
    Devfile parser.DevfileObj
    Path    string
}

type NoComponentFoundError

NoComponentFoundError is returned when no component of the specified name was found.

type NoComponentFoundError struct {
    // contains filtered or unexported fields
}

func NewNoComponentFoundError

func NewNoComponentFoundError(name string, namespace string) NoComponentFoundError

func (NoComponentFoundError) Error

func (e NoComponentFoundError) Error() string

type PushedComponent

PushedComponent is an abstraction over the cluster representation of the component

type PushedComponent interface {
    GetApplication() string
    GetType() (string, error)
    GetStorage() ([]storage.Storage, error)
    // contains filtered or unexported methods
}

type SecretMount

SecretMount describes a Secret mount (either as environment variables with envFrom or as a volume)

type SecretMount struct {
    ServiceName string
    SecretName  string
    MountVolume bool
    MountPath   string
}

Subdirectories

Name Synopsis
..
delete Package delete is a generated GoMock package.
describe