Documentation ¶
Index ¶
- Constants
- func DurationStrToSecondsInt(s string) (*int64, error)
- func FormatContainerName(name string) string
- func FormatEnvName(name string) string
- func FormatFileName(name string) string
- func GetContentFromFile(file string, opt kobject.ConvertOptions) (string, error)
- func GetEnvsFromFile(file string, opt kobject.ConvertOptions) (map[string]string, error)
- func PrintList(objects []runtime.Object, opt kobject.ConvertOptions) error
- func SortedKeys(komposeObject kobject.KomposeObject) []string
- type Kubernetes
- func (k *Kubernetes) CheckUnsupportedKey(komposeObject *kobject.KomposeObject, unsupportedKey map[string]bool) []string
- func (k *Kubernetes) ConfigCapabilities(service kobject.ServiceConfig) *api.Capabilities
- func (k *Kubernetes) ConfigEmptyVolumeSource(key string) *api.VolumeSource
- func (k *Kubernetes) ConfigEnvs(name string, service kobject.ServiceConfig, opt kobject.ConvertOptions) ([]api.EnvVar, error)
- func (k *Kubernetes) ConfigHostPathVolumeSource(path string) (*api.VolumeSource, error)
- func (k *Kubernetes) ConfigPVCVolumeSource(name string, readonly bool) *api.VolumeSource
- func (k *Kubernetes) ConfigPorts(name string, service kobject.ServiceConfig) []api.ContainerPort
- func (k *Kubernetes) ConfigServicePorts(name string, service kobject.ServiceConfig) []api.ServicePort
- func (k *Kubernetes) ConfigTmpfs(name string, service kobject.ServiceConfig) ([]api.VolumeMount, []api.Volume)
- func (k *Kubernetes) ConfigVolumes(name string, service kobject.ServiceConfig) ([]api.VolumeMount, []api.Volume, []*api.PersistentVolumeClaim, error)
- func (k *Kubernetes) CreateHeadlessService(name string, service kobject.ServiceConfig, objects []runtime.Object) *api.Service
- func (k *Kubernetes) CreateKubernetesObjects(name string, service kobject.ServiceConfig, opt kobject.ConvertOptions) []runtime.Object
- func (k *Kubernetes) CreatePVC(name string, mode string, size string, selectorValue string, namespace string) (*api.PersistentVolumeClaim, error)
- func (k *Kubernetes) CreateService(name string, service kobject.ServiceConfig, objects []runtime.Object) *api.Service
- func (k *Kubernetes) Deploy(komposeObject kobject.KomposeObject, opt kobject.ConvertOptions) error
- func (k *Kubernetes) GetKubernetesClient() (*client.Client, string, error)
- func (k *Kubernetes) InitConfigMapForEnv(name string, service kobject.ServiceConfig, opt kobject.ConvertOptions, ...) *api.ConfigMap
- func (k *Kubernetes) InitConfigMapFromFile(name string, service kobject.ServiceConfig, opt kobject.ConvertOptions, ...) *api.ConfigMap
- func (k *Kubernetes) InitD(name string, service kobject.ServiceConfig, replicas int) *extensions.Deployment
- func (k *Kubernetes) InitDS(name string, service kobject.ServiceConfig) *extensions.DaemonSet
- func (k *Kubernetes) InitNamespace(name string) *api.Namespace
- func (k *Kubernetes) InitPod(name string, service kobject.ServiceConfig) *api.Pod
- func (k *Kubernetes) InitPodSpec(name string, image string, pullSecret string) api.PodSpec
- func (k *Kubernetes) InitPodSpecWithConfigMap(name string, image string, service kobject.ServiceConfig) api.PodSpec
- func (k *Kubernetes) InitRC(name string, service kobject.ServiceConfig, replicas int) *api.ReplicationController
- func (k *Kubernetes) InitSvc(name string, service kobject.ServiceConfig) *api.Service
- func (k *Kubernetes) PortsExist(service kobject.ServiceConfig) bool
- func (k *Kubernetes) SortServicesFirst(objs *[]runtime.Object)
- func (k *Kubernetes) Transform(komposeObject kobject.KomposeObject, opt kobject.ConvertOptions) ([]runtime.Object, error)
- func (k *Kubernetes) Undeploy(komposeObject kobject.KomposeObject, opt kobject.ConvertOptions) []error
- func (k *Kubernetes) UpdateController(obj runtime.Object, updateTemplate func(*api.PodTemplateSpec) error, ...) (err error)
- func (k *Kubernetes) UpdateKubernetesObjects(name string, service kobject.ServiceConfig, opt kobject.ConvertOptions, ...) error
Constants ¶
const ( // DeploymentController is controller type for Deployment DeploymentController = "deployment" // DaemonSetController is controller type for DaemonSet DaemonSetController = "daemonset" // ReplicationController is controller type for ReplicationController ReplicationController = "replicationcontroller" )
const PVCRequestSize = "100Mi"
PVCRequestSize (Persistent Volume Claim) has default size
const TIMEOUT = 300
TIMEOUT is how long we'll wait for the termination of kubernetes resource to be successful used when undeploying resources from kubernetes
Variables ¶
This section is empty.
Functions ¶
func DurationStrToSecondsInt ¶
DurationStrToSecondsInt converts duration string to *int64 in seconds
func FormatContainerName ¶
FormatContainerName format Container name
func GetContentFromFile ¶
func GetContentFromFile(file string, opt kobject.ConvertOptions) (string, error)
GetContentFromFile get content from file
func GetEnvsFromFile ¶
GetEnvsFromFile get env vars from env_file
func PrintList ¶
func PrintList(objects []runtime.Object, opt kobject.ConvertOptions) error
PrintList will take the data converted and decide on the commandline attributes given
func SortedKeys ¶
func SortedKeys(komposeObject kobject.KomposeObject) []string
SortedKeys Ensure the kubernetes objects are in a consistent order
Types ¶
type Kubernetes ¶
type Kubernetes struct { // the user provided options from the command line Opt kobject.ConvertOptions }
Kubernetes implements Transformer interface and represents Kubernetes transformer
func (*Kubernetes) CheckUnsupportedKey ¶
func (k *Kubernetes) CheckUnsupportedKey(komposeObject *kobject.KomposeObject, unsupportedKey map[string]bool) []string
CheckUnsupportedKey checks if given komposeObject contains keys that are not supported by this transformer. list of all unsupported keys are stored in unsupportedKey variable returns list of TODO: ....
func (*Kubernetes) ConfigCapabilities ¶
func (k *Kubernetes) ConfigCapabilities(service kobject.ServiceConfig) *api.Capabilities
ConfigCapabilities configure POSIX capabilities that can be added or removed to a container
func (*Kubernetes) ConfigEmptyVolumeSource ¶
func (k *Kubernetes) ConfigEmptyVolumeSource(key string) *api.VolumeSource
ConfigEmptyVolumeSource is helper function to create an EmptyDir api.VolumeSource either for Tmpfs or for emptyvolumes
func (*Kubernetes) ConfigEnvs ¶
func (k *Kubernetes) ConfigEnvs(name string, service kobject.ServiceConfig, opt kobject.ConvertOptions) ([]api.EnvVar, error)
ConfigEnvs configures the environment variables.
func (*Kubernetes) ConfigHostPathVolumeSource ¶
func (k *Kubernetes) ConfigHostPathVolumeSource(path string) (*api.VolumeSource, error)
ConfigHostPathVolumeSource is a helper function to create a HostPath api.VolumeSource
func (*Kubernetes) ConfigPVCVolumeSource ¶
func (k *Kubernetes) ConfigPVCVolumeSource(name string, readonly bool) *api.VolumeSource
ConfigPVCVolumeSource is helper function to create an api.VolumeSource with a PVC
func (*Kubernetes) ConfigPorts ¶
func (k *Kubernetes) ConfigPorts(name string, service kobject.ServiceConfig) []api.ContainerPort
ConfigPorts configures the container ports.
func (*Kubernetes) ConfigServicePorts ¶
func (k *Kubernetes) ConfigServicePorts(name string, service kobject.ServiceConfig) []api.ServicePort
ConfigServicePorts configure the container service ports.
func (*Kubernetes) ConfigTmpfs ¶
func (k *Kubernetes) ConfigTmpfs(name string, service kobject.ServiceConfig) ([]api.VolumeMount, []api.Volume)
ConfigTmpfs configure the tmpfs.
func (*Kubernetes) ConfigVolumes ¶
func (k *Kubernetes) ConfigVolumes(name string, service kobject.ServiceConfig) ([]api.VolumeMount, []api.Volume, []*api.PersistentVolumeClaim, error)
ConfigVolumes configure the container volumes.
func (*Kubernetes) CreateHeadlessService ¶
func (k *Kubernetes) CreateHeadlessService(name string, service kobject.ServiceConfig, objects []runtime.Object) *api.Service
CreateHeadlessService creates a k8s headless service. This is used for docker-compose services without ports. For such services we can't create regular Kubernetes Service. and without Service Pods can't find each other using DNS names. Instead of regular Kubernetes Service we create Headless Service. DNS of such service points directly to Pod IP address. You can find more about Headless Services in Kubernetes documentation https://kubernetes.io/docs/user-guide/services/#headless-services
func (*Kubernetes) CreateKubernetesObjects ¶
func (k *Kubernetes) CreateKubernetesObjects(name string, service kobject.ServiceConfig, opt kobject.ConvertOptions) []runtime.Object
CreateKubernetesObjects generates a Kubernetes artifact for each input type service
func (*Kubernetes) CreatePVC ¶
func (k *Kubernetes) CreatePVC(name string, mode string, size string, selectorValue string, namespace string) (*api.PersistentVolumeClaim, error)
CreatePVC initializes PersistentVolumeClaim
func (*Kubernetes) CreateService ¶
func (k *Kubernetes) CreateService(name string, service kobject.ServiceConfig, objects []runtime.Object) *api.Service
CreateService creates a k8s service
func (*Kubernetes) Deploy ¶
func (k *Kubernetes) Deploy(komposeObject kobject.KomposeObject, opt kobject.ConvertOptions) error
Deploy submits deployment and svc to k8s endpoint
func (*Kubernetes) GetKubernetesClient ¶
func (k *Kubernetes) GetKubernetesClient() (*client.Client, string, error)
GetKubernetesClient creates the k8s Client, returns k8s client and namespace
func (*Kubernetes) InitConfigMapForEnv ¶
func (k *Kubernetes) InitConfigMapForEnv(name string, service kobject.ServiceConfig, opt kobject.ConvertOptions, envFile string) *api.ConfigMap
InitConfigMapForEnv initializes a ConfigMap object
func (*Kubernetes) InitConfigMapFromFile ¶
func (k *Kubernetes) InitConfigMapFromFile(name string, service kobject.ServiceConfig, opt kobject.ConvertOptions, fileName string) *api.ConfigMap
InitConfigMapFromFile initializes a ConfigMap object
func (*Kubernetes) InitD ¶
func (k *Kubernetes) InitD(name string, service kobject.ServiceConfig, replicas int) *extensions.Deployment
InitD initializes Kubernetes Deployment object
func (*Kubernetes) InitDS ¶
func (k *Kubernetes) InitDS(name string, service kobject.ServiceConfig) *extensions.DaemonSet
InitDS initializes Kubernetes DaemonSet object
func (*Kubernetes) InitNamespace ¶
func (k *Kubernetes) InitNamespace(name string) *api.Namespace
InitNamespace initializes Kubernetes Namespace object
func (*Kubernetes) InitPod ¶
func (k *Kubernetes) InitPod(name string, service kobject.ServiceConfig) *api.Pod
InitPod initializes Kubernetes Pod object
func (*Kubernetes) InitPodSpec ¶
InitPodSpec creates the pod specification
func (*Kubernetes) InitPodSpecWithConfigMap ¶
func (k *Kubernetes) InitPodSpecWithConfigMap(name string, image string, service kobject.ServiceConfig) api.PodSpec
InitPodSpecWithConfigMap creates the pod specification
func (*Kubernetes) InitRC ¶
func (k *Kubernetes) InitRC(name string, service kobject.ServiceConfig, replicas int) *api.ReplicationController
InitRC initializes Kubernetes ReplicationController object
func (*Kubernetes) InitSvc ¶
func (k *Kubernetes) InitSvc(name string, service kobject.ServiceConfig) *api.Service
InitSvc initializes Kubernetes Service object
func (*Kubernetes) PortsExist ¶
func (k *Kubernetes) PortsExist(service kobject.ServiceConfig) bool
PortsExist checks if service has ports defined
func (*Kubernetes) SortServicesFirst ¶
func (k *Kubernetes) SortServicesFirst(objs *[]runtime.Object)
SortServicesFirst - the objects that we get can be in any order this keeps services first according to best practice kubernetes services should be created first http://kubernetes.io/docs/user-guide/config-best-practices/
func (*Kubernetes) Transform ¶
func (k *Kubernetes) Transform(komposeObject kobject.KomposeObject, opt kobject.ConvertOptions) ([]runtime.Object, error)
Transform maps komposeObject to k8s objects returns object that are already sorted in the way that Services are first
func (*Kubernetes) Undeploy ¶
func (k *Kubernetes) Undeploy(komposeObject kobject.KomposeObject, opt kobject.ConvertOptions) []error
Undeploy deletes deployed objects from Kubernetes cluster
func (*Kubernetes) UpdateController ¶
func (k *Kubernetes) UpdateController(obj runtime.Object, updateTemplate func(*api.PodTemplateSpec) error, updateMeta func(meta *api.ObjectMeta)) (err error)
UpdateController updates the given object with the given pod template update function and ObjectMeta update function
func (*Kubernetes) UpdateKubernetesObjects ¶
func (k *Kubernetes) UpdateKubernetesObjects(name string, service kobject.ServiceConfig, opt kobject.ConvertOptions, objects *[]runtime.Object) error
UpdateKubernetesObjects loads configurations to k8s objects