utils

package
v0.1.2-0...-3e0559f Latest Latest
Warning

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

Go to latest
Published: May 12, 2023 License: Apache-2.0 Imports: 39 Imported by: 0

Documentation

Overview

traefik functions related to deployment

Index

Constants

View Source
const (
	TraefikHTTPPort  = 80
	TraefikHTTPSPort = 443
)
View Source
const CGroupFile = "/proc/self/cgroup"
View Source
const DockerLogHeaderLength = 8
View Source
const TraefikTrue = "true"

Variables

This section is empty.

Functions

func ContainerCommand

func ContainerCommand(ctx context.Context, command *common.ContainerCommandRequest) error

func CopyToContainer

func CopyToContainer(ctx context.Context, name string, meta v1.UploadFileData, fileHeader *multipart.FileHeader) error

func DeleteContainerByPrefixAndName

func DeleteContainerByPrefixAndName(ctx context.Context, prefix, name string) error

func DeleteContainers

func DeleteContainers(ctx context.Context, request *common.DeleteContainersRequest) error

func DeployImage

func DeployImage(ctx context.Context,
	dog *dogger.DeploymentLogger,
	deployImageRequest *v1.DeployImageRequest,
	versionData *v1.VersionData,
) error

func DraftRelease

func DraftRelease(instance string, versionData v1.VersionData, deployResponse v1.DeployVersionResponse, cfg *config.Configuration)

DraftRelease writes release information to disk Into the instance folder @release directory, file with a release name yml extension the file containing release data

func EnvMapToSlice

func EnvMapToSlice(envs map[string]string) []string

EnvMapToSlice converts key:value map into ["key=value"] array

func ExecTraefik

func ExecTraefik(ctx context.Context, traefikDeployReq TraefikDeployRequest, cfg *config.Configuration) error

func FindVolumeInMountMap

func FindVolumeInMountMap(name string, mountMap map[string]mount.Mount) *mount.Mount

func GetContainerByPrefixAndName

func GetContainerByPrefixAndName(ctx context.Context, prefix, name string) (*types.Container, error)

func GetContainerLogs

func GetContainerLogs(name string, skip, take uint) []string

func GetContainersByPrefix

func GetContainersByPrefix(ctx context.Context, prefix string) []*common.ContainerStateItem

func GetImageLabels

func GetImageLabels(expandedImageName string) (map[string]string, error)

func GetOrganizationLabel

func GetOrganizationLabel(labels map[string]string, key string) (string, bool)

func GetOwnContainer

func GetOwnContainer(ctx context.Context) (*types.Container, error)

func GetOwnContainerImage

func GetOwnContainerImage() (*types.ImageInspect, error)

func GetServiceName

func GetServiceName(instanceConfig *v1.InstanceConfig, containerConfig *v1.ContainerConfig, cfg *config.Configuration) string

serviceName container-name.container-pre-name.ingress.host is default

func GetTraefikLabels

func GetTraefikLabels(
	instanceConfig *v1.InstanceConfig,
	containerConfig *v1.ContainerConfig,
	cfg *config.Configuration,
) map[string]string

generating container labels for traefik if Expose is provided we bind 80 and the given ingressName + ingressHost

func InspectContainer

func InspectContainer(name string) types.ContainerJSON

func MergeStringMapToUniqueSlice

func MergeStringMapToUniqueSlice(src, dest map[string]string) []string

Merging map `a` to map `b`. Keys in map `b` has precedence, if key occurs in both.

func MergeStringMapUnique

func MergeStringMapUnique(src, dest map[string]string) map[string]string

func MountListToMap

func MountListToMap(in []mount.Mount) map[string]mount.Mount

func ParseCGroupFile

func ParseCGroupFile() (string, error)

func PreflightChecks

func PreflightChecks(cfg *config.Configuration)

func ReadDockerLogsFromReadCloser

func ReadDockerLogsFromReadCloser(logs io.ReadCloser, skip, take int) []string

func SecretList

func SecretList(ctx context.Context, prefix, name string) ([]string, error)

func SetOrganizationLabel

func SetOrganizationLabel(key, value string) (map[string]string, error)

generating dyrector.io specific labels for containers org.dyrectorio is our official label prefix

func WithInitContainers

func WithInitContainers(dc containerbuilder.Builder, containerConfig *v1.ContainerConfig,
	dog *dogger.DeploymentLogger, cfg *config.Configuration,
)

func WriteContainerFile

func WriteContainerFile(ctx context.Context, cli *client.Client,
	container, filename string, meta v1.UploadFileData, fileSize int64, data io.Reader,
) error

Types

type DockerContainerLogReader

type DockerContainerLogReader struct {
	EventChannel chan grpc.ContainerLogEvent
	Reader       io.ReadCloser

	grpc.ContainerLogReader
}

func (*DockerContainerLogReader) Close

func (dockerReader *DockerContainerLogReader) Close() error

func (*DockerContainerLogReader) Next

func (dockerReader *DockerContainerLogReader) Next() <-chan grpc.ContainerLogEvent

type DockerVersion

type DockerVersion struct {
	ServerVersion string
	ClientVersion string
}

type ReleaseContainer

type ReleaseContainer struct {
	Image      string
	Tag        string
	Successful bool
}

type ReleaseDoc

type ReleaseDoc struct {
	Version      string
	ReleaseNotes string
	Date         time.Time
	Containers   []ReleaseContainer
}

func GetVersions

func GetVersions(instance string, cfg *config.Configuration) ([]ReleaseDoc, error)

type TraefikDeployRequest

type TraefikDeployRequest struct {
	// LogLevel defaults to INFO
	LogLevel string `json:"logLevel"`
	// if services exposed with certs, default: false
	TLS bool `json:"TLS"`
	// the email address for expiry notifications, sent by acme
	AcmeMail string `json:"acmeMail" binding:"required_if=TLS true"`
	// HTTP port
	Port uint16 `json:"port"`
	// HTTPS port
	TLSPort uint16 `json:"tlsPort"`
}

type UnknownContainerError

type UnknownContainerError struct{}

func (*UnknownContainerError) Error

func (err *UnknownContainerError) Error() string

Jump to

Keyboard shortcuts

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