{"modulePath":"github.com/redhat-developer/Odo","version":"v1.2.6","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package utils\n\n## Constants\n\n```go\nconst (\n\t// SupervisordVolume is supervisord volume type\n\tSupervisordVolume = \"supervisord\"\n\n\t// ProjectsVolume is project source volume type\n\tProjectsVolume = \"projects\"\n)\n```\n\n## Functions\n\n```go\nfunc AddVolumeToContainer(volumeName, volumeMount string, hostConfig *container.HostConfig) *container.HostConfig\n```\nAddVolumeToContainer adds the volume name and mount to the container host config\n\n```go\nfunc ComponentExists(client lclient.Client, data data.DevfileData, name string) (bool, error)\n```\nComponentExists checks if a component exist returns true, if the number of containers equals the number of unique devfile container components returns false, if number of containers is zero returns an error, if number of containers is more than zero but does not equal the number of unique devfile container components\n\n```go\nfunc ConvertEnvs(vars []common.Env) []string\n```\nConvertEnvs converts environment variables from the devfile structure to an array of strings, as expected by Docker\n\n```go\nfunc ConvertPorts(endpoints []common.Endpoint) nat.PortSet\n```\nConvertPorts converts endpoints from the devfile structure to PortSet, which is expected by Docker\n\n```go\nfunc DoesContainerNeedUpdating(component common.DevfileComponent, containerConfig *container.Config, hostConfig *container.HostConfig, devfileMounts []mount.Mount, containerMounts []types.MountPoint, portMap nat.PortMap) bool\n```\nDoesContainerNeedUpdating 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\n\n```go\nfunc GetComponentContainers(client lclient.Client, componentName string) (containers []types.Container, err error)\n```\nGetComponentContainers returns a list of the running component containers\n\n```go\nfunc GetContainerIDForAlias(containers []types.Container, alias string) string\n```\nGetContainerIDForAlias returns the container ID for the devfile alias from a list of containers\n\n```go\nfunc GetContainerLabels(componentName, alias string) map[string]string\n```\nGetContainerLabels returns the label selectors used to retrieve/create the component container\n\n```go\nfunc GetProjectVolumeLabels(componentName string) map[string]string\n```\nGetProjectVolumeLabels returns the label selectors used to retrieve the project/source volume for a given component\n\n```go\nfunc GetSupervisordVolumeLabels(componentName string) map[string]string\n```\nGetSupervisordVolumeLabels returns the label selectors used to retrieve the supervisord volume\n\n","path":"github.com/redhat-developer/Odo/pkg/devfile/adapters/docker/utils","name":"utils","synopsis":"","isRedistributable":true}
