kubernetes

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2022 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Name of the converter
	Name = "kubernetes"

	// MultiFileSubDir is default output directory name for kubernetes manifests
	MultiFileSubDir = "k8s"
)
View Source
const (
	Selector     = "service"
	NetworkLabel = "network"
)

Selector used as labels and selector

View Source
const DefaultIngressBackendKeyword = "default"

Variables

This section is empty.

Functions

func LivenessProbeToV1Probe added in v0.5.0

func LivenessProbeToV1Probe(lp config.LivenessProbe) (*v1.Probe, error)

func PrintList

func PrintList(objects []runtime.Object, opt ConvertOptions, additionalManifests []string, rendered map[string][]byte) error

PrintList prints k8s objects @orig: https://github.com/kubernetes/kompose/blob/master/pkg/transformer/kubernetes/k8sutils.go#L153

func ReadinessProbeToV1Probe added in v0.5.0

func ReadinessProbeToV1Probe(rp config.ReadinessProbe) (*v1.Probe, error)

func ToUnstructured added in v0.4.0

func ToUnstructured(o runtime.Object) (map[string]interface{}, error)

ToUnstructured converts runtime.Object to unstructured map[string]interface{}

Types

type ConvertOptions

type ConvertOptions struct {
	ToStdout     bool     // Display output to STDOUT
	CreateChart  bool     // Create K8s manifests as Chart
	GenerateJSON bool     // Generate outcome as JSON. By defaults YAML gets generated.
	EmptyVols    bool     // Treat all referenced volumes as Empty volumes
	Volumes      string   // Volumes to be generated ("persistentVolumeClaim"|"emptyDir"|"hostPath"|"configMap") (default "persistentVolumeClaim")
	InputFiles   []string // Compose files to be processed
	OutFile      string   // If Directory output will be split into individual files
	YAMLIndent   int      // YAML Indentation in resultant K8s manifests
}

ConvertOptions holds all options that controls transformation process

type EnvSort

type EnvSort []v1.EnvVar

EnvSort struct

func (EnvSort) Len

func (env EnvSort) Len() int

Len returns the number of elements in the collection. @orig: https://github.com/kubernetes/kompose/blob/master/pkg/transformer/utils.go#L214-L228

func (EnvSort) Less

func (env EnvSort) Less(i, j int) bool

Less returns whether the element with index i should sort before the element with index j.

func (EnvSort) Swap

func (env EnvSort) Swap(i, j int)

swaps the elements with indexes i and j.

type K8s

type K8s struct {
	UI kmd.UI
}

K8s is a native kubernetes manifests converter

func New

func New() *K8s

New return a native Kubernetes converter

func NewWithUI added in v0.4.2

func NewWithUI(ui kmd.UI) *K8s

func (*K8s) Render

func (c *K8s) Render(singleFile bool,
	dir, workDir string,
	projects map[string]*composego.Project,
	files map[string][]string,
	additionalFiles []string,
	rendered map[string][]byte,
	excluded map[string][]string) (map[string]string, error)

Render generates outcome

type Kubernetes

type Kubernetes struct {
	Opt      ConvertOptions     // user provided options from the command line
	Project  *composego.Project // docker compose project
	Excluded []string           // docker compose service names that should be excluded
	UI       kmd.UI
}

Kubernetes transformer

func (*Kubernetes) Transform

func (k *Kubernetes) Transform() ([]runtime.Object, error)

Transform converts compose project to set of k8s objects returns object that are already sorted in the way that Services are first @orig: https://github.com/kubernetes/kompose/blob/master/pkg/transformer/kubernetes/kubernetes.go#L1140

type ProjectService

type ProjectService struct {
	composego.ServiceConfig
	SvcK8sConfig config.SvcK8sConfig
}

ProjectService is a wrapper type around composego.ServiceConfig

func NewProjectService added in v0.5.0

func NewProjectService(svc composego.ServiceConfig) (ProjectService, error)

func (*ProjectService) LivenessProbe added in v0.5.0

func (p *ProjectService) LivenessProbe() (*v1.Probe, error)

func (*ProjectService) ReadinessProbe added in v0.5.0

func (p *ProjectService) ReadinessProbe() (*v1.Probe, error)

type Volumes

type Volumes struct {
	SvcName       string // Service name to which volume is linked
	MountPath     string // Mountpath extracted from docker-compose file
	VFrom         string // denotes service name from which volume is coming
	VolumeName    string // name of volume if provided explicitly
	Host          string // host machine address
	Container     string // Mountpath
	Mode          string // access mode for volume
	PVCName       string // name of PVC
	PVCSize       string // PVC size
	StorageClass  string // PVC storage class
	SelectorValue string // Value of the label selector
}

Volumes holds the container volume struct

Jump to

Keyboard shortcuts

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