apps

package
v0.0.0-...-fa857ea Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// OktetoBinName name of the okteto bin init container
	OktetoBinName = "okteto-bin"
	// OktetoInitVolumeContainerName name of the okteto init container that initializes the persistent colume from image content
	OktetoInitVolumeContainerName = "okteto-init-volume"
)

Variables

This section is empty.

Functions

func GetDevContainer

func GetDevContainer(spec *apiv1.PodSpec, containerName string) *apiv1.Container

func GetRunningPodInLoop

func GetRunningPodInLoop(ctx context.Context, dev *model.Dev, app App, c kubernetes.Interface) (*apiv1.Pod, error)

GetRunningPodInLoop returns the dev pod for an app and loops until it success

func GetTranslations

func GetTranslations(ctx context.Context, dev *model.Dev, app App, reset bool, c kubernetes.Interface) (map[string]*Translation, error)

GetTranslations fills all the deployments pointed by a development container

func IsDevModeOn

func IsDevModeOn(app App) bool

IsDevModeOn returns if a statefulset is in devmode

func ListDevModeOn

func ListDevModeOn(ctx context.Context, manifest *model.Manifest, c kubernetes.Interface) []string

ListDevModeOn returns a list of strings with the names of deployments or statefulsets in DevMode. If no app is found in dev mode, an empty slice is returned

func SetLastBuiltAnnotation

func SetLastBuiltAnnotation(app App)

SetLastBuiltAnnotation sets the app timestamp

func TranslateContainerSecurityContext

func TranslateContainerSecurityContext(c *apiv1.Container, s *model.SecurityContext)

TranslateContainerSecurityContext translates the security context attached to a container

func TranslateDevContainer

func TranslateDevContainer(c *apiv1.Container, rule *model.TranslationRule)

TranslateDevContainer translates a dev container

func TranslateDevMode

func TranslateDevMode(trMap map[string]*Translation) error

TranslateDevMode translates the deployment manifests to put them in dev mode

func TranslateDevTolerations

func TranslateDevTolerations(spec *apiv1.PodSpec, tolerations []apiv1.Toleration)

TranslateDevTolerations sets the user provided toleretions

func TranslateEnvVars

func TranslateEnvVars(c *apiv1.Container, rule *model.TranslationRule)

TranslateEnvVars translates the variables attached to a container

func TranslateLifecycle

func TranslateLifecycle(c *apiv1.Container, l *model.Lifecycle)

TranslateLifecycle translates the lifecycle events attached to a container

func TranslateOktetoAffinity

func TranslateOktetoAffinity(spec *apiv1.PodSpec, affinity *apiv1.Affinity)

func TranslateOktetoBinVolume

func TranslateOktetoBinVolume(spec *apiv1.PodSpec)

TranslateOktetoBinVolume translates the binaries volume attached to a container

func TranslateOktetoBinVolumeMounts

func TranslateOktetoBinVolumeMounts(c *apiv1.Container)

TranslateOktetoBinVolumeMounts translates the binaries mount attached to a container

func TranslateOktetoDevSecret

func TranslateOktetoDevSecret(spec *apiv1.PodSpec, secret string, secrets []model.Secret)

TranslateOktetoDevSecret translates the devs secret of a pod

func TranslateOktetoInitBinContainer

func TranslateOktetoInitBinContainer(rule *model.TranslationRule, spec *apiv1.PodSpec)

TranslateOktetoInitBinContainer translates the bin init container of a pod

func TranslateOktetoInitFromImageContainer

func TranslateOktetoInitFromImageContainer(spec *apiv1.PodSpec, rule *model.TranslationRule)

TranslateOktetoInitFromImageContainer translates the init from image container of a pod

func TranslateOktetoNodeSelector

func TranslateOktetoNodeSelector(spec *apiv1.PodSpec, nodeSelector map[string]string)

func TranslateOktetoSyncSecret

func TranslateOktetoSyncSecret(spec *apiv1.PodSpec, name string)

TranslateOktetoSyncSecret translates the syncthing secret container of a pod

func TranslateOktetoVolumes

func TranslateOktetoVolumes(spec *apiv1.PodSpec, rule *model.TranslationRule)

TranslateOktetoVolumes translates the dev volumes

func TranslatePodAffinity

func TranslatePodAffinity(spec *apiv1.PodSpec, name string)

TranslatePodAffinity translates the affinity of pod to be all on the same node

func TranslatePodSecurityContext

func TranslatePodSecurityContext(spec *apiv1.PodSpec, s *model.SecurityContext)

TranslatePodSecurityContext translates the security context attached to a pod

func TranslatePodServiceAccount

func TranslatePodServiceAccount(spec *apiv1.PodSpec, sa string)

TranslatePodServiceAccount translates the security account the pod uses

func TranslatePodSpec

func TranslatePodSpec(podSpec *apiv1.PodSpec, rule *model.TranslationRule)

func TranslateProbes

func TranslateProbes(c *apiv1.Container, p *model.Probes)

TranslateProbes translates the probes attached to a container

func TranslateResources

func TranslateResources(c *apiv1.Container, rr model.ResourceRequirements)

TranslateResources translates the resources attached to a container

func TranslateVolumeMounts

func TranslateVolumeMounts(c *apiv1.Container, rule *model.TranslationRule)

TranslateVolumeMounts translates the volumes attached to a container

func ValidateMountPaths

func ValidateMountPaths(spec *apiv1.PodSpec, dev *model.Dev) error

Types

type App

type App interface {
	Kind() string
	ObjectMeta() metav1.ObjectMeta
	Replicas() int32
	SetReplicas(n int32)
	TemplateObjectMeta() metav1.ObjectMeta
	PodSpec() *apiv1.PodSpec

	// DevClone() creates in memory a clone of the app for dev mode
	DevClone() App

	CheckConditionErrors(dev *model.Dev) error
	GetRunningPod(ctx context.Context, c kubernetes.Interface) (*apiv1.Pod, error)

	// TODO: remove after people move to CLI >= 1.14
	RestoreOriginal() error

	// GetDevClone returns the cloned app from Kubernetes
	GetDevClone(ctx context.Context, c kubernetes.Interface) (App, error)
	Refresh(ctx context.Context, c kubernetes.Interface) error
	Watch(ctx context.Context, result chan error, c kubernetes.Interface)
	Deploy(ctx context.Context, c kubernetes.Interface) error
	PatchAnnotations(ctx context.Context, c kubernetes.Interface) error
	Destroy(ctx context.Context, c kubernetes.Interface) error
}

func Get

func Get(ctx context.Context, dev *model.Dev, namespace string, c kubernetes.Interface) (App, error)

type DeploymentApp

type DeploymentApp struct {
	// contains filtered or unexported fields
}

func NewDeploymentApp

func NewDeploymentApp(d *appsv1.Deployment) *DeploymentApp

func (*DeploymentApp) CheckConditionErrors

func (i *DeploymentApp) CheckConditionErrors(dev *model.Dev) error

func (*DeploymentApp) Deploy

func (*DeploymentApp) Destroy

func (*DeploymentApp) DevClone

func (i *DeploymentApp) DevClone() App

func (*DeploymentApp) GetDevClone

func (i *DeploymentApp) GetDevClone(ctx context.Context, c kubernetes.Interface) (App, error)

GetDevClone Returns from Kubernetes the cloned deployment

func (*DeploymentApp) GetRunningPod

func (i *DeploymentApp) GetRunningPod(ctx context.Context, c kubernetes.Interface) (*apiv1.Pod, error)

func (*DeploymentApp) Kind

func (i *DeploymentApp) Kind() string

func (*DeploymentApp) ObjectMeta

func (i *DeploymentApp) ObjectMeta() metav1.ObjectMeta

func (*DeploymentApp) PatchAnnotations

func (i *DeploymentApp) PatchAnnotations(ctx context.Context, c kubernetes.Interface) error

func (*DeploymentApp) PodSpec

func (i *DeploymentApp) PodSpec() *apiv1.PodSpec

func (*DeploymentApp) Refresh

func (*DeploymentApp) Replicas

func (i *DeploymentApp) Replicas() int32

func (*DeploymentApp) RestoreOriginal

func (i *DeploymentApp) RestoreOriginal() error

func (*DeploymentApp) SetReplicas

func (i *DeploymentApp) SetReplicas(n int32)

func (*DeploymentApp) TemplateObjectMeta

func (i *DeploymentApp) TemplateObjectMeta() metav1.ObjectMeta

func (*DeploymentApp) Watch

func (i *DeploymentApp) Watch(ctx context.Context, result chan error, c kubernetes.Interface)

type ErrApplicationNotFound

type ErrApplicationNotFound struct {
	Name string
}

func (ErrApplicationNotFound) Error

func (e ErrApplicationNotFound) Error() string

type StatefulSetApp

type StatefulSetApp struct {
	// contains filtered or unexported fields
}

func NewStatefulSetApp

func NewStatefulSetApp(sfs *appsv1.StatefulSet) *StatefulSetApp

func (*StatefulSetApp) CheckConditionErrors

func (i *StatefulSetApp) CheckConditionErrors(dev *model.Dev) error

func (*StatefulSetApp) Deploy

func (*StatefulSetApp) Destroy

func (*StatefulSetApp) DevClone

func (i *StatefulSetApp) DevClone() App

func (*StatefulSetApp) GetDevClone

func (i *StatefulSetApp) GetDevClone(ctx context.Context, c kubernetes.Interface) (App, error)

GetDevClone Returns from Kubernetes the cloned statefulset

func (*StatefulSetApp) GetRunningPod

func (i *StatefulSetApp) GetRunningPod(ctx context.Context, c kubernetes.Interface) (*apiv1.Pod, error)

func (*StatefulSetApp) Kind

func (i *StatefulSetApp) Kind() string

func (*StatefulSetApp) ObjectMeta

func (i *StatefulSetApp) ObjectMeta() metav1.ObjectMeta

func (*StatefulSetApp) PatchAnnotations

func (i *StatefulSetApp) PatchAnnotations(ctx context.Context, c kubernetes.Interface) error

func (*StatefulSetApp) PodSpec

func (i *StatefulSetApp) PodSpec() *apiv1.PodSpec

func (*StatefulSetApp) Refresh

func (*StatefulSetApp) Replicas

func (i *StatefulSetApp) Replicas() int32

func (*StatefulSetApp) RestoreOriginal

func (i *StatefulSetApp) RestoreOriginal() error

func (*StatefulSetApp) SetReplicas

func (i *StatefulSetApp) SetReplicas(n int32)

func (*StatefulSetApp) TemplateObjectMeta

func (i *StatefulSetApp) TemplateObjectMeta() metav1.ObjectMeta

func (*StatefulSetApp) Watch

func (i *StatefulSetApp) Watch(ctx context.Context, result chan error, c kubernetes.Interface)

type Translation

type Translation struct {
	MainDev *model.Dev
	Dev     *model.Dev
	App     App
	DevApp  App
	Rules   []*model.TranslationRule
}

Translation represents the information for translating an application

func (*Translation) DevModeOff

func (tr *Translation) DevModeOff() error

Jump to

Keyboard shortcuts

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