kobject

package
v1.31.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2023 License: Apache-2.0 Imports: 9 Imported by: 64

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConvertOptions

type ConvertOptions struct {
	ToStdout                    bool
	CreateD                     bool
	CreateRC                    bool
	CreateDS                    bool
	CreateDeploymentConfig      bool
	BuildRepo                   string
	BuildBranch                 string
	Build                       string
	Profiles                    []string
	PushImage                   bool
	PushImageRegistry           string
	CreateChart                 bool
	GenerateYaml                bool
	GenerateJSON                bool
	StoreManifest               bool
	EmptyVols                   bool
	Volumes                     string
	PVCRequestSize              string
	InsecureRepository          bool
	Replicas                    int
	InputFiles                  []string
	OutFile                     string
	Provider                    string
	Namespace                   string
	Controller                  string
	IsDeploymentFlag            bool
	IsDaemonSetFlag             bool
	IsReplicationControllerFlag bool
	IsReplicaSetFlag            bool
	IsDeploymentConfigFlag      bool
	IsNamespaceFlag             bool

	BuildCommand string
	PushCommand  string

	Server string

	YAMLIndent int

	WithKomposeAnnotation bool

	MultipleContainerMode   bool
	ServiceGroupMode        string
	ServiceGroupName        string
	SecretsAsFiles          bool
	GenerateNetworkPolicies bool
}

ConvertOptions holds all options that controls transformation process

func (*ConvertOptions) IsPodController added in v1.23.0

func (opt *ConvertOptions) IsPodController() bool

IsPodController indicate if the user want to use a controller

type EnvVar

type EnvVar struct {
	Name  string
	Value string
}

EnvVar holds the environment variable struct of a container

type HealthCheck added in v1.1.0

type HealthCheck struct {
	Test        []string
	Timeout     int32
	Interval    int32
	Retries     int32
	StartPeriod int32
	Disable     bool
	HTTPPath    string
	HTTPPort    int32
	TCPPort     int32
}

HealthCheck the healthcheck configuration for a service "StartPeriod" was added to v3.4 of the compose, see: https://github.com/docker/cli/issues/116

type HealthChecks added in v1.23.0

type HealthChecks struct {
	Liveness  HealthCheck
	Readiness HealthCheck
}

HealthChecks used to distinguish between liveness and readiness

type KomposeObject

type KomposeObject struct {
	ServiceConfigs map[string]ServiceConfig
	// LoadedFrom is name of the loader that created KomposeObject
	// Transformer need to know origin format in order to tell user what tag is not supported in origin format
	// as they can have different names. For example environment variables  are called environment in compose but Env in bundle.
	LoadedFrom string

	Secrets types.Secrets

	// Namespace is the namespace where all the generated objects would be assigned to
	Namespace string
}

KomposeObject holds the generic struct of Kompose transformation

type Placement added in v1.24.0

type Placement struct {
	PositiveConstraints map[string]string
	NegativeConstraints map[string]string
	Preferences         []string
}

Placement holds the placement struct of container

type Ports

type Ports struct {
	HostPort      int32
	ContainerPort int32
	HostIP        string
	Protocol      string // Upper string
}

Ports holds the ports struct of a container

func (*Ports) ID added in v1.26.0

func (port *Ports) ID() string

ID returns an unique id for this port settings, to avoid conflict

type ServiceConfig

type ServiceConfig struct {
	Name                          string
	ContainerName                 string
	Image                         string             `compose:"image"`
	Environment                   []EnvVar           `compose:"environment"`
	EnvFile                       []string           `compose:"env_file"`
	Port                          []Ports            `compose:"ports"`
	Command                       []string           `compose:"command"`
	WorkingDir                    string             `compose:""`
	DomainName                    string             `compose:"domainname"`
	HostName                      string             `compose:"hostname"`
	ReadOnly                      bool               `compose:"read_only"`
	Args                          []string           `compose:"args"`
	VolList                       []string           `compose:"volumes"`
	Network                       []string           `compose:"network"`
	Labels                        map[string]string  `compose:"labels"`
	Annotations                   map[string]string  `compose:""`
	CPUSet                        string             `compose:"cpuset"`
	CPUShares                     int64              `compose:"cpu_shares"`
	CPUQuota                      int64              `compose:"cpu_quota"`
	CPULimit                      int64              `compose:""`
	CPUReservation                int64              `compose:""`
	CapAdd                        []string           `compose:"cap_add"`
	CapDrop                       []string           `compose:"cap_drop"`
	Expose                        []string           `compose:"expose"`
	ImagePullPolicy               string             `compose:"kompose.image-pull-policy"`
	Pid                           string             `compose:"pid"`
	Privileged                    bool               `compose:"privileged"`
	Restart                       string             `compose:"restart"`
	User                          string             `compose:"user"`
	VolumesFrom                   []string           `compose:"volumes_from"`
	ServiceType                   string             `compose:"kompose.service.type"`
	ServiceExternalTrafficPolicy  string             `compose:"kompose.service.external-traffic-policy"`
	NodePortPort                  int32              `compose:"kompose.service.nodeport.port"`
	StopGracePeriod               string             `compose:"stop_grace_period"`
	Build                         string             `compose:"build"`
	BuildArgs                     map[string]*string `compose:"build-args"`
	ExposeService                 string             `compose:"kompose.service.expose"`
	ExposeServicePath             string             `compose:"kompose.service.expose.path"`
	BuildLabels                   map[string]string  `compose:"build-labels"`
	ExposeServiceTLS              string             `compose:"kompose.service.expose.tls-secret"`
	ExposeServiceIngressClassName string             `compose:"kompose.service.expose.ingress-class-name"`
	ImagePullSecret               string             `compose:"kompose.image-pull-secret"`
	Stdin                         bool               `compose:"stdin_open"`
	Tty                           bool               `compose:"tty"`
	MemLimit                      types.UnitBytes    `compose:"mem_limit"`
	MemReservation                types.UnitBytes    `compose:""`
	DeployMode                    string             `compose:""`
	VolumeMountSubPath            string             `compose:"kompose.volume.subpath"`
	// DeployLabels mapping to kubernetes labels
	DeployLabels       map[string]string  `compose:""`
	DeployUpdateConfig types.UpdateConfig `compose:""`
	TmpFs              []string           `compose:"tmpfs"`
	Dockerfile         string             `compose:"dockerfile"`
	Replicas           int                `compose:"replicas"`
	GroupAdd           []int64            `compose:"group_add"`
	FsGroup            int64              `compose:"kompose.security-context.fsgroup"`
	Volumes            []Volumes          `compose:""`
	Secrets            []types.ServiceSecretConfig
	HealthChecks       HealthChecks `compose:""`
	Placement          Placement    `compose:""`
	//This is for long LONG SYNTAX link(https://docs.docker.com/compose/compose-file/#long-syntax)
	Configs []types.ServiceConfigObjConfig `compose:""`
	//This is for SHORT SYNTAX link(https://docs.docker.com/compose/compose-file/#configs)
	ConfigsMetaData types.Configs `compose:""`

	WithKomposeAnnotation bool `compose:""`
	InGroup               bool
}

ServiceConfig holds the basic struct of a container which should not introduce any kubernetes specific struct

func (*ServiceConfig) GetConfigMapKeyFromMeta added in v1.21.0

func (s *ServiceConfig) GetConfigMapKeyFromMeta(name string) (string, error)

GetConfigMapKeyFromMeta ... given a source name ,find the file and extract the filename which will be act as ConfigMap key return "" if not found

func (*ServiceConfig) GetKubernetesUpdateStrategy added in v1.21.0

func (s *ServiceConfig) GetKubernetesUpdateStrategy() *v1.RollingUpdateDeployment

GetKubernetesUpdateStrategy from compose update_config 1. only apply to Deployment, but the check is not happened here 2. only support `parallelism` and `order` return nil if not support

func (*ServiceConfig) GetOSUpdateStrategy added in v1.21.0

func (s *ServiceConfig) GetOSUpdateStrategy() *deployapi.RollingDeploymentStrategyParams

GetOSUpdateStrategy ...

type ServiceConfigGroup added in v1.23.0

type ServiceConfigGroup []ServiceConfig

ServiceConfigGroup holds an array of a ServiceConfig objects.

type Volumes added in v1.1.0

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
	SelectorValue string // Value of the label selector
}

Volumes holds the volume struct of container

Jump to

Keyboard shortcuts

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