utils

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddVolumeToContainer added in v1.2.0

func AddVolumeToContainer(volumeName, volumeMount string, hostConfig *container.HostConfig) *container.HostConfig

AddVolumeToContainer adds the volume name and mount to the container host config

func ComponentExists

func ComponentExists(client lclient.Client, name string) bool

ComponentExists checks if Docker containers labeled with the specified component name exists

func ConvertEnvs

func ConvertEnvs(vars []common.Env) []string

ConvertEnvs converts environment variables from the devfile structure to an array of strings, as expected by Docker

func ConvertPorts added in v1.2.0

func ConvertPorts(endpoints []common.Endpoint) nat.PortSet

ConvertPorts converts endpoints from the devfile structure to PortSet, which is expected by Docker

func CreateAndInitSupervisordVolume added in v1.2.0

func CreateAndInitSupervisordVolume(client lclient.Client) (string, error)

CreateAndInitSupervisordVolume creates the supervisord volume and initializes it with supervisord bootstrap image - assembly files and supervisord binary

func DoesContainerNeedUpdating

func DoesContainerNeedUpdating(component common.DevfileComponent, containerConfig *container.Config, hostConfig *container.HostConfig, devfileMounts []mount.Mount, containerMounts []types.MountPoint, portMap nat.PortMap) bool

DoesContainerNeedUpdating returns true if a given container needs to be removed and recreated This function compares values in the container vs corresponding values in the devfile component. If any of the values between the two differ, a restart is required (and this function returns true) Unlike Kube, Docker doesn't provide a mechanism to update a container in place only when necesary so this function is necessary to prevent having to restart the container on every odo pushs

func GetComponentContainers added in v1.2.0

func GetComponentContainers(client lclient.Client, componentName string) (containers []types.Container, err error)

GetComponentContainers returns a list of the running component containers

func GetContainerIDForAlias added in v1.2.0

func GetContainerIDForAlias(containers []types.Container, alias string) string

GetContainerIDForAlias returns the container ID for the devfile alias from a list of containers

func GetContainerLabels added in v1.2.0

func GetContainerLabels(componentName, alias string) map[string]string

GetContainerLabels returns the label selectors used to retrieve/create the component container

func GetProjectVolumeLabels

func GetProjectVolumeLabels(componentName string) map[string]string

GetProjectVolumeLabels returns the label selectors used to retrieve the project/source volume for a given component

func GetSupervisordVolumeLabels added in v1.2.0

func GetSupervisordVolumeLabels() map[string]string

GetSupervisordVolumeLabels returns the label selectors used to retrieve the supervisord volume

func StartBootstrapSupervisordInitContainer added in v1.2.0

func StartBootstrapSupervisordInitContainer(client lclient.Client, supervisordVolumeName string) error

StartBootstrapSupervisordInitContainer pulls the supervisord bootstrap image, mounts the supervisord volume, starts the bootstrap container and initializes the supervisord volume via its entrypoint

func UpdateComponentWithSupervisord added in v1.2.0

func UpdateComponentWithSupervisord(comp *common.DevfileComponent, runCommand common.DevfileCommand, supervisordVolumeName string, hostConfig *container.HostConfig)

UpdateComponentWithSupervisord updates the devfile component's 1. command and args with supervisord, if absent 2. env with ODO_COMMAND_RUN and ODO_COMMAND_RUN_WORKING_DIR, if absent

Types

This section is empty.

Jump to

Keyboard shortcuts

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