Documentation ¶
Index ¶
- Constants
- type Container
- func (co *Container) AddAttachChannel(stop chan struct{})
- func (co *Container) AddHostPort(src string, dst string) error
- func (co *Container) AddStopChannel(stop chan struct{})
- func (co *Container) ConnectNetwork(id string)
- func (co *Container) DisconnectNetwork(id string) error
- func (co *Container) GetActiveDeadlineSeconds() (*int64, error)
- func (co *Container) GetContainerTCPPorts() []int
- func (co *Container) GetEnvVar() []corev1.EnvVar
- func (co *Container) GetImagePullPolicy() (corev1.PullPolicy, error)
- func (co *Container) GetImageTCPPorts() []int
- func (co *Container) GetPodName() string
- func (co *Container) GetPodSecurityContext(context *corev1.PodSecurityContext) (*corev1.PodSecurityContext, error)
- func (co *Container) GetPreArchiveFiles() map[string][]byte
- func (co *Container) GetResourceRequirements(req corev1.ResourceRequirements) (corev1.ResourceRequirements, error)
- func (co *Container) GetServiceAccountName(current string) string
- func (co *Container) GetServicePorts() map[int]int
- func (co *Container) GetVolumeFiles() map[string]string
- func (co *Container) GetVolumeFolders() map[string]string
- func (co *Container) GetVolumes() map[string]string
- func (co *Container) HasDockerSockBinding() bool
- func (co *Container) HasVolumes() bool
- func (co *Container) MapPort(pod, local int)
- func (co *Container) Match(typ string, key string, val string) bool
- func (co *Container) SignalDetach()
- func (co *Container) SignalStop()
- func (co *Container) StateString() string
- func (co *Container) StatusString() string
- type Exec
- type Image
- type Mount
- type Network
- type PreArchive
Constants ¶
const ( // LabelRequestCPU is the label to be used to specify cpu request/limits LabelRequestCPU = "com.joyrex2001.kubedock.request-cpu" // LabelRequestMemory is the label to use to specify memory request/limits LabelRequestMemory = "com.joyrex2001.kubedock.request-memory" // LabelPullPolicy is the label to be used to configure the pull policy LabelPullPolicy = "com.joyrex2001.kubedock.pull-policy" // LabelServiceAccount is the label to be used to enforce a service account // other than 'default' for the created pods. LabelServiceAccount = "com.joyrex2001.kubedock.service-account" // LabelNamePrefix is the label to be used to enforce a prefix for the names used // for the container deployments. LabelNamePrefix = "com.joyrex2001.kubedock.name-prefix" // LabelRunasUser is the label to be used to enforce a specific user (uid) that // runs inside the container can also be enforced w LabelRunasUser = "com.joyrex2001.kubedock.runas-user" // LabelActiveDeadlineSeconds is the label to be used to specify active deadline in seconds LabelActiveDeadlineSeconds = "com.joyrex2001.kubedock.active-deadline-seconds" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Container ¶
type Container struct { ID string ShortID string Name string Image string Labels map[string]string Entrypoint []string Cmd []string Env []string Binds []string Mounts []Mount PreArchives []PreArchive HostIP string ExposedPorts map[string]interface{} ImagePorts map[string]interface{} HostPorts map[int]int MappedPorts map[int]int Networks map[string]interface{} NetworkAliases []string StopChannels []chan struct{} AttachChannels []chan struct{} Running bool Completed bool Failed bool Stopped bool Killed bool Created time.Time Finished time.Time }
Container describes the details of a container.
func (*Container) AddAttachChannel ¶
func (co *Container) AddAttachChannel(stop chan struct{})
AddAttachChannel will add channels that should be notified when SignalDetach is called.
func (*Container) AddHostPort ¶
AddHostPort will add a predefined port mapping.
func (*Container) AddStopChannel ¶
func (co *Container) AddStopChannel(stop chan struct{})
AddStopChannel will add channels that should be notified when SignalStop is called.
func (*Container) ConnectNetwork ¶
ConnectNetwork will attach a network to the container.
func (*Container) DisconnectNetwork ¶
DisconnectNetwork will detach a network from the container.
func (*Container) GetActiveDeadlineSeconds ¶
GetActiveDeadlineSeconds will return the active deadline seconds to be used for containers that are deployed.
func (*Container) GetContainerTCPPorts ¶
GetContainerTCPPorts will return a list of all ports that are exposed by this container.
func (*Container) GetEnvVar ¶
GetEnvVar will return the environment variables of the container as k8s EnvVars.
func (*Container) GetImagePullPolicy ¶
func (co *Container) GetImagePullPolicy() (corev1.PullPolicy, error)
GetImagePullPolicy will return the image pull policy that should be applied for this container.
func (*Container) GetImageTCPPorts ¶
GetImageTCPPorts will return a list of all ports that are exposed by the image.
func (*Container) GetPodName ¶
GetPodName will return a human friendly name that can be used for the container deployments.
func (*Container) GetPodSecurityContext ¶
func (co *Container) GetPodSecurityContext(context *corev1.PodSecurityContext) (*corev1.PodSecurityContext, error)
GetPodSecurityContext will create a security context for the Pod that implements the relevant features of the Docker API. Right now this only covers the ability to specify the numeric user a container should run as.
func (*Container) GetPreArchiveFiles ¶
GetPreArchiveFiles will return all single files from the pre-archives as a map with the filename as key, and the actual file contents as value.
func (*Container) GetResourceRequirements ¶
func (co *Container) GetResourceRequirements(req corev1.ResourceRequirements) (corev1.ResourceRequirements, error)
GetResourceRequirements will return a k8s request/limits configuration based on the LabelRequestCPU and LabelRequestMemory labels set on the container.
func (*Container) GetServiceAccountName ¶
GetServiceAccountName will return the service account to be used for containers that are deployed.
func (*Container) GetServicePorts ¶
GetServicePorts will return a list of ports and their mapping as they should be applied on a k8s service.
func (*Container) GetVolumeFiles ¶
GetVolumeFiles will return a map of volumes that are pointing to a single file and should be mounted on the target container. The key is the target location, and the value is the local location.
func (*Container) GetVolumeFolders ¶
GetVolumeFolders will return a map of volumes that are pointing to a folder and should be mounted on the target container. The key is the target location, and the value is the local location.
func (*Container) GetVolumes ¶
GetVolumes will return a map of volumes that should be mounted on the target container. The key is the target location, and the value is the local location.
func (*Container) HasDockerSockBinding ¶
HasDockerSockBinding will check the bindings specified in the container and will return true if one pf these bindings is the docker socket.
func (*Container) HasVolumes ¶
HasVolumes will return true if the container has volumes configured.
func (*Container) SignalDetach ¶
func (co *Container) SignalDetach()
SignalDetach will signal all stop channels.
func (*Container) SignalStop ¶
func (co *Container) SignalStop()
SignalStop will signal all stop channels.
func (*Container) StateString ¶
StateString returns a string that describes the state.
func (*Container) StatusString ¶
StatusString returns a string that describes the status.
type Exec ¶
type Exec struct { ID string ContainerID string Cmd []string TTY bool Stdin bool Stdout bool Stderr bool ExitCode int Created time.Time }
Exec describes the details of an execute command.
type Image ¶
type Image struct { ID string ShortID string Name string ExposedPorts map[string]struct{} Created time.Time }
Image describes the details of an image.
type Network ¶
type Network struct { ID string ShortID string Name string Labels map[string]string Created time.Time }
Network describes the details of a network.
func (*Network) IsPredefined ¶
IsPredefined will return if the network is a pre-defined system network.
type PreArchive ¶
PreArchive contains the path and contents of archives (tar) that need to be copied over to the container before it has been started.