Documentation ¶
Index ¶
- Constants
- Variables
- func ContainerID(ociBinary string, nameOrID string) (string, error)
- func ContainerIPs(ociBinary string, name string) (string, string, error)
- func Copy(ociBinary string, ociID string, targetDir string, fName string) error
- func CreateContainerNode(p CreateParams) error
- func HostPortBinding(ociBinary string, ociID string, contPort int) (int, error)
- func ListOwnedContainers(ociBinary string) ([]string, error)
- type CreateParams
- type Mount
- type MountPropagation
- type PortMapping
Constants ¶
const ( Docker = "docker" Podman = "podman" // ClusterLabelKey is applied to each node docker container for identification ClusterLabelKey = "io.x-k8s.kic.cluster" )
Variables ¶
var MountPropagationNameToValue = map[string]MountPropagation{ "None": MountPropagationNone, "HostToContainer": MountPropagationHostToContainer, "Bidirectional": MountPropagationBidirectional, }
MountPropagationNameToValue is a map of valid MountPropogation names to their values
var MountPropagationValueToName = map[MountPropagation]string{ MountPropagationNone: "None", MountPropagationHostToContainer: "HostToContainer", MountPropagationBidirectional: "Bidirectional", }
MountPropagationValueToName is a map of valid MountPropogation values to their string names
Functions ¶
func ContainerID ¶
ContainerID returns id of a container name
func ContainerIPs ¶
ContainerIPs returns ipv4,ipv6, error of a container by their name
func CreateContainerNode ¶
func CreateContainerNode(p CreateParams) error
CreateContainerNode creates a new container node
func HostPortBinding ¶
HostPortBinding will return port mapping for a container using cli. example : HostPortBinding("docker", "minikube", "22") will return the docker assigned port: 32769, nil only supports TCP ports
func ListOwnedContainers ¶
ListOwnedContainers lists all the containres that kic driver created on user's machine using a label
Types ¶
type CreateParams ¶
type CreateParams struct { Name string // used for container name and hostname Image string // container image to use to create the node. ClusterLabel string // label the containers we create using minikube so we can clean up Role string // currently only role supported is control-plane Mounts []Mount // volume mounts APIServerPort int // kubernetes api server port PortMappings []PortMapping // ports to map to container from host CPUs string // number of cpu cores assign to container Memory string // memory (mbs) to assign to the container Envs map[string]string // environment variables to pass to the container ExtraArgs []string // a list of any extra option to pass to oci binary during creation time, for example --expose 8080... OCIBinary string // docker or podman }
type Mount ¶
type Mount struct { // Path of the mount within the container. ContainerPath string `protobuf:"bytes,1,opt,name=container_path,json=containerPath,proto3" json:"containerPath,omitempty"` // Path of the mount on the host. If the hostPath doesn't exist, then runtimes // should report error. If the hostpath is a symbolic link, runtimes should // follow the symlink and mount the real destination to container. HostPath string `protobuf:"bytes,2,opt,name=host_path,json=hostPath,proto3" json:"hostPath,omitempty"` // If set, the mount is read-only. Readonly bool `protobuf:"varint,3,opt,name=readonly,proto3,json=readOnly,proto3" json:"readOnly,omitempty"` // If set, the mount needs SELinux relabeling. SelinuxRelabel bool `protobuf:"varint,4,opt,name=selinux_relabel,json=selinuxRelabel,proto3" json:"selinuxRelabel,omitempty"` // Requested propagation mode. Propagation MountPropagation `protobuf:"varint,5,opt,name=propagation,proto3,enum=runtime.v1alpha2.MountPropagation" json:"propagation,omitempty"` }
Mount specifies a host volume to mount into a container. This is a close copy of the upstream cri Mount type see: k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2 It additionally serializes the "propagation" field with the string enum names on disk as opposed to the int32 values, and the serlialzed field names have been made closer to core/v1 VolumeMount field names In yaml this looks like:
containerPath: /foo hostPath: /bar readOnly: true selinuxRelabel: false propagation: None
Propagation may be one of: None, HostToContainer, Bidirectional
type MountPropagation ¶
type MountPropagation int32
MountPropagation represents an "enum" for mount propagation options, see also Mount.
const ( // MountPropagationNone specifies that no mount propagation // ("private" in Linux terminology). MountPropagationNone MountPropagation = 0 // MountPropagationHostToContainer specifies that mounts get propagated // from the host to the container ("rslave" in Linux). MountPropagationHostToContainer MountPropagation = 1 // MountPropagationBidirectional specifies that mounts get propagated from // the host to the container and from the container to the host // ("rshared" in Linux). MountPropagationBidirectional MountPropagation = 2 )
type PortMapping ¶
type PortMapping struct { // Port within the container. ContainerPort int32 `protobuf:"varint,1,opt,name=container_port,json=containerPort,proto3" json:"containerPort,omitempty"` // Port on the host. HostPort int32 `protobuf:"varint,2,opt,name=host_path,json=hostPort,proto3" json:"hostPort,omitempty"` ListenAddress string `protobuf:"bytes,3,opt,name=listenAddress,json=hostPort,proto3" json:"listenAddress,omitempty"` }
PortMapping specifies a host port mapped into a container port. In yaml this looks like:
containerPort: 80 hostPort: 8000 listenAddress: 127.0.0.1