v1beta1

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package v1 contains API Schema definitions for the resources v1 API group +kubebuilder:object:generate=true +groupName=theketch.io

Index

Constants

View Source
const (
	ShipaCloudDomain     = "shipa.cloud"
	DefaultNumberOfUnits = 1
	KetchFinalizer       = "ketch-controller"
)
View Source
const (
	CanaryNotActiveEvent     = "CanaryNotActive"
	CanaryNotActiveEventDesc = "error - canary triggered, but not active"

	CanaryNoDeployments     = "CanaryNoDeployments"
	CanaryNoDeploymentsDesc = "error - canary needs more than 1 deployment to run"

	CanaryNoScheduledSteps     = "CanaryNoScheduledSteps"
	CanaryNoScheduledStepsDesc = "error - canary triggered, but no scheduled steps"

	CanaryStarted      = "CanaryStarted"
	CanaryStartedDesc  = "started"
	CanaryFinished     = "CanaryFinished"
	CanaryFinishedDesc = "finished"

	CanaryNextStep       = "CanaryNextStep"
	CanaryNextStepDesc   = "weight change"
	CanaryStepTarget     = "CanaryStepTarget"
	CanaryStepTargetDesc = "units change"

	CanaryAnnotationAppName            = "canary.shipa.io/app-name"
	CanaryAnnotationDevelopmentVersion = "canary.shipa.io/deployment-version"
	CanaryAnnotationEventName          = "canary.shipa.io/event-name"
	CanaryAnnotationDescription        = "canary.shipa.io/description"
	CanaryAnnotationStep               = "canary.shipa.io/step"
	CanaryAnnotationVersionSource      = "canary.shipa.io/version-source"
	CanaryAnnotationVersionDest        = "canary.shipa.io/version-dest"
	CanaryAnnotationWeightSource       = "canary.shipa.io/weight-source"
	CanaryAnnotationWeightDest         = "canary.shipa.io/weight-dest"
	CanaryAnnotationProcessName        = "canary.shipa.io/process-name"
	CanaryAnnotationProcessUnitsSource = "canary.shipa.io/source-process-units"
	CanaryAnnotationProcessUnitsDest   = "canary.shipa.io/dest-process-units"
)
View Source
const (
	DeploymentAnnotationAppName                 = "deployment.shipa.io/app-name"
	DeploymentAnnotationDevelopmentVersion      = "deployment.shipa.io/deployment-version"
	DeploymentAnnotationEventName               = "deployment.shipa.io/event-name"
	DeploymentAnnotationDescription             = "deployment.shipa.io/description"
	DeploymentAnnotationProcessName             = "deployment.shipa.io/process-name"
	DeploymentAnnotationInvolvedObjectName      = "deployment.shipa.io/involved-object-name"
	DeploymentAnnotationInvolvedObjectFieldPath = "deployment.shipa.io/involved-object-field-path"
	DeploymentAnnotationSourceHost              = "deployment.shipa.io/source-host"
	DeploymentAnnotationSourceComponent         = "deployment.shipa.io/source-component"
	DeploymentAnnotationPodErrorName            = "deployment.shipa.io/pod-error-name"

	AppReconcileStarted  = "AppReconcileStarted"
	AppReconcileComplete = "AppReconcileComplete"
	AppReconcileUpdate   = "AppReconcileUpdate"
	AppReconcileError    = "AppReconcileError"
)
View Source
const (
	AppReconcileOutcomeReason = "AppReconcileOutcome"
)
View Source
const (
	TheKetchGroup = "theketch.io"
)

Variables

Group is the exported variable indicating group, defaults to theketch.io

Functions

func AddToScheme

func AddToScheme(opts ...schemeOption) func(s *runtime.Scheme) error

AddToScheme can be easily consumed by ketch-cli and by default it uses `theketch.io` // and it can be consumed by shipa: AddToScheme(WithGroup("shipa.io"))

func DontUninstallHelmChartAnnotation added in v0.7.0

func DontUninstallHelmChartAnnotation(group string) string

DontUninstallHelmChartAnnotation returns an annotation that prevents ketch-controller from uninstalling helm chart of Application or Job.

func WithGroup

func WithGroup(group string) schemeOption

Types

type App

type App struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   AppSpec   `json:"spec,omitempty"`
	Status AppStatus `json:"status,omitempty"`
}

App is the Schema for the apps API.

func (*App) CNames

func (app *App) CNames(framework *Framework) []string

CNames returns all CNAMEs to access the application including a default cname.

func (*App) DefaultCname

func (app *App) DefaultCname(framework *Framework) *string

DefaultCname returns a default cname to access the application. A default cname uses the following format: <app name>.<Framework's ServiceEndpoint>.shipa.cloud.

func (*App) DoCanary

func (app *App) DoCanary(now metav1.Time, logger logr.Logger, recorder record.EventRecorder, disableScaleForProcess map[string]bool) error

DoCanary checks if canary deployment is needed for an app and gradually increases the traffic weight based on the canary parameters provided by the users. Use it in app controller.

func (*App) DoRollback

func (app *App) DoRollback()

DoRollback performs rollback

func (*App) Envs

func (app *App) Envs(names []string) map[string]string

Envs returns values of the asked env variables.

func (*App) ExposedPorts

func (app *App) ExposedPorts() map[DeploymentVersion][]ExposedPort

ExposedPorts returns ports exposed by an image of each deployment.

func (*App) Phase

func (app *App) Phase() AppPhase

Phase return a simple, high-level summary of where the application is in its lifecycle.

func (*App) SetCondition

func (app *App) SetCondition(t ConditionType, status v1.ConditionStatus, message string, time metav1.Time)

SetCondition sets Status and message fields of the given type of condition to the provided values.

func (*App) SetEnvs

func (app *App) SetEnvs(envs []Env)

SetEnvs extends the current list of environment variables with the provided list. If the current list has an env variable from the provided list, the env variable will be updated with a new value.

func (*App) SetUnits

func (app *App) SetUnits(selector Selector, units int) error

SetUnits set quantity of units of the specified processes.

func (*App) Start

func (app *App) Start(selector Selector) error

Start starts processes specified by the selector. We start a process by setting its unit quantity to 1. If a process has running units, nothing will be changed.

func (*App) Stop

func (app *App) Stop(selector Selector) error

Stop stops processes specified by the selector.

func (*App) Units

func (app *App) Units() int

Units returns a total number units.

func (*App) UnsetEnvs

func (app *App) UnsetEnvs(envs []string)

UnsetEnvs unsets environment values.

type AppDeploymentEvent added in v0.6.2

type AppDeploymentEvent struct {
	Name string
	// DeploymentVersion represents for which deployment event is associated with
	DeploymentVersion int
	// Reason is the reason for the event
	Reason string
	// Description states what is the outcome of this event
	Description string
	// ProcessName is the name of this process for this appsv1.Deployment
	ProcessName string
	// Annotations contain details on the deployment
	Annotations map[string]string
	// InvolvedObject is the object about which an incoming Event refers
	InvolvedObjectName      string
	InvolvedObjectFieldPath string
	// Source is the source of an incoming event
	SourceHost      string
	SourceComponent string
	PodErrorName    string
}

AppDeploymentEvent represents fields and annotations for an Event that describes an app deployment.

func AppDeploymentEventFromAnnotations added in v0.6.2

func AppDeploymentEventFromAnnotations(annotations map[string]string) *AppDeploymentEvent

type AppDeploymentSpec

type AppDeploymentSpec struct {
	// ImagePullSecrets contains a list of secrets to pull the image of this deployment.
	// If this list is defined, app.Spec.DockerRegistrySpec is not used.
	ImagePullSecrets []v1.LocalObjectReference `json:"imagePullSecrets,omitempty"`
	Image            string                    `json:"image"`
	Version          DeploymentVersion         `json:"version"`
	Processes        []ProcessSpec             `json:"processes,omitempty"`
	KetchYaml        *KetchYamlData            `json:"ketchYaml,omitempty"`
	Labels           []Label                   `json:"labels,omitempty"`
	RoutingSettings  RoutingSettings           `json:"routingSettings,omitempty"`
	ExposedPorts     []ExposedPort             `json:"exposedPorts,omitempty"`
}

type AppList

type AppList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []App `json:"items"`
}

AppList contains a list of App.

type AppPhase

type AppPhase string

AppPhase is a label for the condition of an application at the current time.

const (
	// AppCreated means the app has been accepted by the system, but has not been started.
	AppCreated AppPhase = "Created"

	// AppError means the app CRD is broken in some way and ketch controller can't render and install a new helm chart.
	AppError AppPhase = "Error"

	// AppRunning means that ketch controller has rendered a helm chart of the application and installed it to a cluster.
	AppRunning AppPhase = "Running"
)

type AppReconcileOutcome

type AppReconcileOutcome struct {
	AppName         string
	DeploymentCount int
}

AppReconcileOutcome handle information about app reconcile

func ParseAppReconcileOutcome

func ParseAppReconcileOutcome(in string) (*AppReconcileOutcome, error)

ParseAppReconcileOutcome makes AppReconcileOutcome from the incoming event reason string

func (*AppReconcileOutcome) String

func (r *AppReconcileOutcome) String(err ...error) string

String is a Stringer interface implementation

type AppSpec

type AppSpec struct {
	Version *string `json:"version,omitempty"`

	// ID is an additional unique identifier of this application besides the app's name if needed.
	// Ketch internally doesn't rely on this field, so it can be anything useful for a user.
	// Ketch uses either this ID or the app name and adds "app=<ID or name>" label to all pods.
	// ID is preferred and used if set, otherwise the label will be "app=<app-name>".
	// Thus, istio time series will have "destination_app=<ID or name>" label.
	ID string `json:"id,omitempty"`

	// +kubebuilder:validation:MaxLength=140
	Description string `json:"description,omitempty"`

	// Canary contains a configuration which will be required for canary deployments.
	Canary CanarySpec `json:"canary,omitempty"`

	// Deployments is a list of running deployments.
	Deployments []AppDeploymentSpec `json:"deployments"`

	// DeploymentsCount is incremented every time a new deployment is added to Deployments and used as a version for new deployments.
	DeploymentsCount int `json:"deploymentsCount,omitempty"`

	// List of environment variables of the application.
	Env []Env `json:"env,omitempty"`

	// Framework is a name of a Framework used to run the application.
	// +kubebuilder:validation:MinLength=1
	Framework string `json:"framework"`

	// Ingress contains configuration of entrypoints to access the application.
	Ingress IngressSpec `json:"ingress"`

	// DockerRegistry contains docker registry configuration of the application.
	DockerRegistry DockerRegistrySpec `json:"dockerRegistry,omitempty"`

	// Builder is the name of the builder used to build source code.
	Builder string `json:"builder,omitempty"`

	// BuildPacks is a list of build packs to use when building from source.
	BuildPacks []string `json:"buildPacks,omitempty"`

	// Labels is a list of labels that will be applied to Services/Deployments/Pods.
	Labels []MetadataItem `json:"labels,omitempty"`

	// Annotations is a list of annotations that will be applied to Services/Deployments/Pods/Gateways/Ingresses/IngressRoutes.
	Annotations []MetadataItem `json:"annotations,omitempty"`

	// ServiceAccountName specifies a service account name to be used for this application.
	ServiceAccountName string `json:"serviceAccountName,omitempty"`

	// SecurityContext specifies security settings for a pod/app, which get applied to all containers.
	SecurityContext *v1.PodSecurityContext `json:"securityContext,omitempty"`

	// Extensions can be used by third-parties to keep additional information.
	// +optional
	// +kubebuilder:pruning:PreserveUnknownFields
	Extensions []runtime.RawExtension `json:"extensions,omitempty"`
	// VolumeClaimTemplates is a list of an app's volumeClaimTemplates
	VolumeClaimTemplates []PersistentVolumeClaim `json:"volumeClaimTemplates,omitempty"`

	// Type specifies whether an app should be a deployment or a statefulset
	// +kubebuilder:validation:default:=Deployment
	Type *AppType `json:"type,omitempty"`
}

AppSpec defines the desired state of App.

func (AppSpec) GetType added in v0.7.0

func (spec AppSpec) GetType() AppType

type AppStatus

type AppStatus struct {
	// Conditions of App resource.
	Conditions []Condition         `json:"conditions,omitempty"`
	Framework  *v1.ObjectReference `json:"framework,omitempty"`
	// ExtensionsStatuses can be used by third-parties to keep additional information.
	// +optional
	// +kubebuilder:pruning:PreserveUnknownFields
	ExtensionsStatuses []runtime.RawExtension `json:"extensionsStatuses,omitempty"`
}

AppStatus represents information about the status of an application.

func (AppStatus) Condition

func (s AppStatus) Condition(t ConditionType) *Condition

Condition looks for a condition with the provided type in the condition list and returns it.

type AppType added in v0.7.0

type AppType string

+kubebuilder:validation:Enum=Deployment;StatefulSet

const (
	DeploymentAppType  AppType = "Deployment"
	StatefulSetAppType AppType = "StatefulSet"
)

type CanaryEvent

type CanaryEvent struct {
	// AppName represents event for certain app
	AppName string
	// DeploymentVersion represents for which deployment event is associated with
	DeploymentVersion int

	// Name represents canary event name. It is translated into Reason column of kubernetes event
	// values: CanaryStarted, CanaryFinished
	// errored values: CanaryNotActiveEvent, CanaryNoDeployments, CanaryNoScheduledSteps
	Name string
	// Description states what is the outcome of this event
	Description string
	// Annotations contain details on the Canary deployment
	Annotations map[string]string
}

func CanaryEventFromAnnotations

func CanaryEventFromAnnotations(annotations map[string]string) (*CanaryEvent, error)

CanaryEventFromAnnotations creates CanaryEvent from given message

func (CanaryEvent) Message

func (c CanaryEvent) Message() string

Message is message for k8s event

type CanaryNextStepEvent

type CanaryNextStepEvent struct {
	Event CanaryEvent

	Step          int
	VersionSource int
	VersionDest   int
	WeightSource  uint8
	WeightDest    uint8
}

func CanaryNextStepEventFromAnnotations

func CanaryNextStepEventFromAnnotations(annotations map[string]string) (*CanaryNextStepEvent, error)

CanaryNextStepEventFromAnnotations creates CanaryNextStepEvent from given annotations

func (CanaryNextStepEvent) Message

func (c CanaryNextStepEvent) Message() string

type CanarySpec

type CanarySpec struct {
	// +kubebuilder:validation:Minimum=0
	// +kubebuilder:validation:Maximum=100
	Steps int `json:"steps,omitempty"`
	// +kubebuilder:validation:Minimum=0
	// +kubebuilder:validation:Maximum=100
	StepWeight      uint8         `json:"stepWeight,omitempty"`
	StepTimeInteval time.Duration `json:"stepTimeInterval,omitempty"`
	// NextScheduledTime holds time of the next step.
	NextScheduledTime *metav1.Time `json:"nextScheduledTime,omitempty"`
	// CurrentStep is the count for current step for a canary deployment.
	// +kubebuilder:validation:Minimum=0
	// +kubebuilder:validation:Maximum=100
	CurrentStep int `json:"currentStep,omitempty"`
	// Active shows if canary deployment is active for this application.
	Active bool `json:"active,omitempty"`
	// Started holds time when canary started
	Started *metav1.Time `json:"started,omitempty"`
	// Target map of processes and target units value
	Target map[string]uint16 `json:"target,omitempty"`
}

CanarySpec represents configuration for a canary deployment.

type CanaryTargetChangeEvent

type CanaryTargetChangeEvent struct {
	Event CanaryEvent

	VersionSource           int
	VersionDest             int
	ProcessName             string
	SourceProcessUnits      int
	DestinationProcessUnits int
}

func CanaryTargetChangeEventFromAnnotations

func CanaryTargetChangeEventFromAnnotations(annotations map[string]string) (*CanaryTargetChangeEvent, error)

CanaryTargetChangeEventFromAnnotations creates CanaryTargetChangeEvent from given annotations

func (CanaryTargetChangeEvent) Message

func (c CanaryTargetChangeEvent) Message() string

type Cname

type Cname struct {
	Name   string `json:"name"`
	Secure bool   `json:"secure"`
	// SecretName if provided must contain an SSL certificate that will be used to serve this cname.
	// Currently, the secret must be in the framework's namespace.
	SecretName string `json:"secretName,omitempty"`
}

Cname represents a DNS record and whether the record use TLS.

type CnameList

type CnameList []Cname

CnameList is a list of an app's CNAMEs.

type Condition

type Condition struct {

	// Type of the condition.
	Type ConditionType `json:"type"`

	// Status of the condition.
	Status v1.ConditionStatus `json:"status"`

	// LastTransitionTime is the timestamp corresponding to the last status.
	LastTransitionTime *metav1.Time `json:"lastTransitionTime,omitempty"`

	// A human readable message indicating details about why the application is in this condition.
	Message string `json:"message,omitempty"`
}

Condition contains details for the current condition of this app.

type ConditionType

type ConditionType string
const (

	// Scheduled indicates whether the has been processed by ketch-controller.
	Scheduled ConditionType = "Scheduled"
)

These are valid conditions of app.

type Container

type Container struct {
	Name    string   `json:"name"`
	Image   string   `json:"image"`
	Command []string `json:"command"`
}

Container represents a single container run in a Job

type DeploymentVersion

type DeploymentVersion int

func (DeploymentVersion) String

func (v DeploymentVersion) String() string

type DockerRegistrySpec

type DockerRegistrySpec struct {

	// SecretName is added to the "imagePullSecrets" list of each application pod.
	SecretName string `json:"secretName,omitempty"`
}

DockerRegistrySpec contains docker registry configuration of an application.

type Env

type Env struct {
	// +kubebuilder:validation:MinLength=1
	// Name of the environment variable. Must be a C_IDENTIFIER.
	Name string `json:"name"`

	// Value of the environment variable.
	Value string `json:"value"`
}

Env represents an environment variable present in an application.

type Error

type Error string

Error is a main error type of this package.

const (
	// ErrProcessNotFound is returned when an operation can not be completed because there is no such process.
	ErrProcessNotFound Error = "process not found"

	// ErrDeploymentNotFound is returned when an operation can not be completed because there is no such deployment.
	ErrDeploymentNotFound Error = "deployment not found"

	// ErrDeleteFrameworkWithRunningApps is returned when a framework can not be deleted because the framework contains running apps.
	ErrDeleteFrameworkWithRunningApps Error = "failed to delete framework because the framework contains running apps"

	// ErrChangeNamespaceWhenAppsRunning is returned when a framework's namespace can not be changed because the framework contains running apps.
	ErrChangeNamespaceWhenAppsRunning Error = "failed to change target namespace because the framework contains running apps"

	// ErrNamespaceIsUsedByAnotherFramework is returned when a framework's namespace can not be changed because there is another framework that uses a new namespace.
	ErrNamespaceIsUsedByAnotherFramework Error = "failed to change target namespace because the namespace is already used by another framework"

	// ErrDecreaseQuota is returned when a new quota is too small.
	ErrDecreaseQuota Error = "failed to decrease quota because the framework has more running apps than the new quota permits"

	// ErrJobExists
	ErrJobExists Error = "failed to create job because the job already exists"
)

func (Error) Error

func (e Error) Error() string

type ExposedPort

type ExposedPort struct {
	Port     int    `json:"port"`
	Protocol string `json:"protocol"`
}

ExposedPort represents a port exposed by a docker image. Native format is "port/PROTOCOL" string, we parse it and keep it as ExposedPort.

func NewExposedPort

func NewExposedPort(port string) (*ExposedPort, error)

NewExposedPort parses the port exposed from a container. The port should have "port/PROTOCOL" format.

func (ExposedPort) ToDockerFormat

func (p ExposedPort) ToDockerFormat() string

type Framework

type Framework struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   FrameworkSpec   `json:"spec,omitempty"`
	Status FrameworkStatus `json:"status,omitempty"`
}

Framework is the Schema for the frameworks API

func (*Framework) Default

func (r *Framework) Default()

Default implements webhook.Defaulter so a webhook will be registered for the type

func (*Framework) HasApp

func (p *Framework) HasApp(name string) bool

func (*Framework) HasJob

func (f *Framework) HasJob(name string) bool

func (*Framework) SetupWebhookWithManager

func (r *Framework) SetupWebhookWithManager(mgr ctrl.Manager) error

func (*Framework) ValidateCreate

func (r *Framework) ValidateCreate() error

ValidateCreate implements webhook.Validator so a webhook will be registered for the type

func (*Framework) ValidateDelete

func (r *Framework) ValidateDelete() error

ValidateDelete implements webhook.Validator so a webhook will be registered for the type

func (*Framework) ValidateUpdate

func (r *Framework) ValidateUpdate(old runtime.Object) error

ValidateUpdate implements webhook.Validator so a webhook will be registered for the type

type FrameworkList

type FrameworkList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []Framework `json:"items"`
}

FrameworkList contains a list of Framework

type FrameworkPhase

type FrameworkPhase string
const (
	FrameworkCreated FrameworkPhase = "Created"
	FrameworkFailed  FrameworkPhase = "Failed"
)

type FrameworkSpec

type FrameworkSpec struct {
	Version string `json:"version,omitempty"`
	Name    string `json:"name"`

	// +kubebuilder:validation:MinLength=1
	NamespaceName string `json:"namespace"`

	AppQuotaLimit *int `json:"appQuotaLimit"`

	IngressController IngressControllerSpec `json:"ingressController,omitempty"`

	// Extensions can be used by third-parties to keep additional information.
	// +optional
	// +kubebuilder:pruning:PreserveUnknownFields
	Extensions []runtime.RawExtension `json:"extensions,omitempty"`
}

FrameworkSpec defines the desired state of Framework

type FrameworkStatus

type FrameworkStatus struct {
	Phase   FrameworkPhase `json:"phase,omitempty"`
	Message string         `json:"message,omitempty"`

	Namespace *v1.ObjectReference `json:"namespace,omitempty"`
	Apps      []string            `json:"apps,omitempty"`
	Jobs      []string            `json:"jobs,omitempty"`
	// ExtensionsStatuses can be used by third-parties to keep additional information.
	// +optional
	// +kubebuilder:pruning:PreserveUnknownFields
	ExtensionsStatuses []runtime.RawExtension `json:"extensionsStatuses,omitempty"`
}

FrameworkStatus defines the observed state of Framework

type IngressControllerSpec

type IngressControllerSpec struct {
	ClassName       string                `json:"className,omitempty"`
	ServiceEndpoint string                `json:"serviceEndpoint,omitempty"`
	IngressType     IngressControllerType `json:"type"`
	ClusterIssuer   string                `json:"clusterIssuer,omitempty"`
}

IngressControllerSpec contains configuration for an ingress controller.

type IngressControllerType

type IngressControllerType string

IngressControllerType is a type of an ingress controller for this framework.

const (
	TraefikIngressControllerType IngressControllerType = "traefik"
	IstioIngressControllerType   IngressControllerType = "istio"
	NginxIngressControllerType   IngressControllerType = "nginx"
)

func (IngressControllerType) String

func (t IngressControllerType) String() string

type IngressSpec

type IngressSpec struct {

	// GenerateDefaultCname if set the application will have a default cname <app-name>.<ServiceEndpoint>.shipa.cloud.
	GenerateDefaultCname bool `json:"generateDefaultCname"`

	// Cnames is a list of additional cnames.
	Cnames CnameList `json:"cnames,omitempty"`
}

IngressSpec configures entrypoints to access an application.

type Job

type Job struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   JobSpec   `json:"spec,omitempty"`
	Status JobStatus `json:"status,omitempty"`
}

Job is the Schema for the jobs API

func (*Job) SetCondition

func (j *Job) SetCondition(t ConditionType, status v1.ConditionStatus, message string, time metav1.Time)

SetCondition sets Status and message fields of the given type of condition to the provided values.

func (*Job) SetupWebhookWithManager

func (r *Job) SetupWebhookWithManager(mgr ctrl.Manager) error

func (*Job) ValidateCreate

func (r *Job) ValidateCreate() error

ValidateCreate implements webhook.Validator so a webhook will be registered for the type

func (*Job) ValidateDelete

func (r *Job) ValidateDelete() error

ValidateDelete implements webhook.Validator so a webhook will be registered for the type

func (*Job) ValidateUpdate

func (r *Job) ValidateUpdate(old runtime.Object) error

ValidateUpdate implements webhook.Validator so a webhook will be registered for the type

type JobList

type JobList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []Job `json:"items"`
}

JobList contains a list of Job

type JobSpec

type JobSpec struct {
	Version     string `json:"version,omitempty"`
	Type        string `json:"type"`
	Name        string `json:"name"`
	Framework   string `json:"framework"`
	Description string `json:"description,omitempty"`
	Parallelism int    `json:"parallelism,omitempty"`
	Completions int    `json:"completions,omitempty"`
	Suspend     bool   `json:"suspend,omitempty"`
	//+kubebuilder:validation:Minimum=0
	BackoffLimit *int        `json:"backoffLimit,omitempty"`
	Containers   []Container `json:"containers,omitempty"`
	Policy       Policy      `json:"policy,omitempty"`
}

JobSpec defines the desired state of Job

type JobStatus

type JobStatus struct {
	Conditions []Condition         `json:"conditions,omitempty"`
	Framework  *v1.ObjectReference `json:"framework,omitempty"`
}

JobStatus defines the observed state of Job

func (JobStatus) Condition

func (s JobStatus) Condition(t ConditionType) *Condition

Condition looks for a condition with the provided type in the condition list and returns it.

type KetchYamlData

type KetchYamlData struct {

	// Hooks allow to run commands during different stages of the application deployment.
	Hooks *KetchYamlHooks `json:"hooks,omitempty"`

	// Healthcheck describes readiness and liveness probes of the application deployment.
	Healthcheck *KetchYamlHealthcheck `json:"healthcheck,omitempty"`

	// Kubernetes contains specific configurations for Kubernetes.
	Kubernetes *KetchYamlKubernetesConfig `json:"kubernetes,omitempty"`
}

KetchYamlData describes certain aspects of the application deployment being deployed.

type KetchYamlHealthcheck

type KetchYamlHealthcheck struct {

	// Path defines which path to call in the application. This path is called for each unit. It is the only mandatory field. If not set, the health check is ignored.
	// +kubebuilder:validation:MinLength=1
	Path string `json:"path"`

	// Method defines the method used to make the http request. The default is GET.
	Method string `json:"method,omitempty"`

	// Scheme defines which scheme to use. The defaults is http.
	Scheme string `json:"scheme,omitempty"`

	// Headers defines optional additional header names that can be used for the request. Header names must be capitalized.
	Headers map[string]string `json:"headers,omitempty" bson:",omitempty"`

	// Match is a regular expression to be matched against the request body.
	// If not set, the body won’t be read and only the status code is checked. This regular expression uses Go syntax and runs with a matching \n (s flag).
	Match string `json:"match,omitempty"`

	// If not set, only readiness probe will be created.
	UseInRouter bool `json:"use_in_router,omitempty"`

	// ForceRestart determines whether a unit should be restarted after allowedFailures encounters consecutive healthcheck failures.
	// Sets the liveness probe in the Pod.
	ForceRestart bool `json:"force_restart,omitempty"`

	// AllowedFailures specifies a number of allowed failures before healthcheck considers the application is unhealthy. The defaults is 0.
	AllowedFailures int `json:"allowed_failures,omitempty"`

	// IntervalSeconds is an interval in seconds between each active healthcheck call if use_in_router is set to true. The default is 10 seconds.
	IntervalSeconds int `json:"interval_seconds,omitempty"`

	// TimeoutSeconds is a timeout for each healthcheck call in seconds. The default is 60 seconds.
	TimeoutSeconds int `json:"timeout_seconds,omitempty"`
}

KetchYamlHealthcheck describes readiness and liveness probes of the application deployment.

type KetchYamlHooks

type KetchYamlHooks struct {

	// Restart describes commands to run during different stages of the application deployment.
	Restart KetchYamlRestartHooks `json:"restart,omitempty"`
}

KetchYamlHooks describes commands to run during different stages of the application deployment.

type KetchYamlKubernetesConfig

type KetchYamlKubernetesConfig struct {

	// Processes configure which ports are exposed on each process of the application deployment.
	Processes map[string]KetchYamlProcessConfig `json:"processes,omitempty"`
}

KetchYamlKubernetesConfig contains specific configurations for Kubernetes.

type KetchYamlProcessConfig

type KetchYamlProcessConfig struct {
	Ports []KetchYamlProcessPortConfig `json:"ports,omitempty"`
}

KetchYamlKubernetesConfig contains specific configurations of a process.

type KetchYamlProcessPortConfig

type KetchYamlProcessPortConfig struct {
	// Name is a descriptive name for the port. This field is optional.
	Name string `json:"name,omitempty"`

	// Protocol defines the port protocol. The accepted values are TCP and UDP.
	Protocol string `json:"protocol,omitempty"`

	// Port is the port that will be exposed on a Kubernetes service. If omitted, the target_port value is used.
	Port int `json:"port,omitempty"`

	// TargetPort is the port that the process is listening on. If omitted, the port value is used.
	TargetPort int `json:"target_port,omitempty"`
}

KetchYamlKubernetesConfig contains configuration of an exposed port.

type KetchYamlRestartHooks

type KetchYamlRestartHooks struct {

	// Before contains commands that are executed before a unit is restarted. Commands listed in this hook run once per unit.
	Before []string `json:"before,omitempty" bson:",omitempty"`

	// Before contains commands that are executed after a unit is restarted. Commands listed in this hook run once per unit.
	After []string `json:"after,omitempty" bson:",omitempty"`
}

KetchYamlRestartHooks describes commands to run during different stages of the application deployment.

type Label

type Label struct {
	// +kubebuilder:validation:MinLength=1
	// Name of the label.
	Name string `json:"name"`

	// Value of the label.
	Value string `json:"value"`
}

Label represents an environment variable present in an application.

type MetadataItem

type MetadataItem struct {
	Target            Target            `json:"target,omitempty"`
	Apply             map[string]string `json:"apply,omitempty"`
	DeploymentVersion int               `json:"deploymentVersion,omitempty"`
	ProcessName       string            `json:"processName,omitempty"`
}

MetadataItem represent a request to add label/annotations to processes

type PersistentVolumeClaim added in v0.7.0

type PersistentVolumeClaim struct {
	Name             string                          `json:"name"`
	AccessModes      []v1.PersistentVolumeAccessMode `json:"accessModes"`
	StorageClassName *string                         `json:"storageClassName,omitempty"`
	Storage          string                          `json:"storage"`
}

type PodState

type PodState string

PodState describes the simplified state of a pod in the cluster

const (
	// PodRunning means that pod running on the cluster
	PodRunning PodState = "running"
	// PodDeploying means that pod is creating on the cluster, it is not in running or error state
	PodDeploying PodState = "deploying"
	// PodError means that the pod is not in a healthy state, and action from the user may be needed
	PodError PodState = "error"
	// PodSucceeded means that all containers in the pod have voluntarily terminated
	// with a container exit code of 0, and the system is not going to restart any of these containers.
	PodSucceeded PodState = "succeeded"
)

type Policy

type Policy struct {
	RestartPolicy RestartPolicy `json:"restartPolicy,omitempty"`
}

Policy represents the policy types a job can have

type ProcessSpec

type ProcessSpec struct {
	// +kubebuilder:validation:MinLength=1
	// Name of the process.
	Name string `json:"name"`

	// Units is a number of replicas of the process.
	Units *int `json:"units,omitempty"`

	// Env is a list of environment variables to set in pods created for the process.
	Env []Env `json:"env,omitempty"`

	// Commands executed on startup.
	Cmd []string `json:"cmd"`

	Resources *v1.ResourceRequirements `json:"resources,omitempty"`

	Volumes []v1.Volume `json:"volumes,omitempty"`

	VolumeMounts []v1.VolumeMount `json:"volumeMounts,omitempty"`
	// Security options the process should run with.
	SecurityContext *v1.SecurityContext `json:"securityContext,omitempty"`
}

ProcessSpec is a specification of the desired behavior of a process.

type RestartPolicy

type RestartPolicy string

type RoutingSettings

type RoutingSettings struct {
	Weight uint8 `json:"weight"`
}

RoutingSettings contains a weight of the current deployment used to route incoming traffic. If an application has two deployments with corresponding weights of 30 and 70, then 3 of 10 incoming requests will be sent to the first deployment (approximately).

type SchemeOptions

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

type Selector

type Selector struct {
	// Process if specified an action will be applied to a particular process otherwise to all processes.
	Process *string

	// DeploymentVersion if specified an action will be applied to a particular deployment otherwise to all deployments.
	DeploymentVersion *DeploymentVersion
}

Selector specifies targets to apply an action. If both a process and version are not specified, an action will be applied to all processes of all deployments.

For example, Selector{Process: "web"} specifies all "web" processes of all running deployments. Selector{Process: "web", DeploymentVersion: 1} specifies "web" process of a deployment with version 1.

func NewSelector

func NewSelector(deploymentVersion int, processName string) Selector

NewSelector returns a Selector instance.

type Target

type Target struct {
	APIVersion string `json:"apiVersion,omitempty"`
	Kind       string `json:"kind,omitempty"`
}

func (Target) IsDeployment

func (t Target) IsDeployment() bool

IsDeployment returns true if the target is a Deployment.

func (Target) IsPod added in v0.6.2

func (t Target) IsPod() bool

IsPod returns true if the target is a Pod.

func (Target) IsService

func (t Target) IsService() bool

IsService returns true if the target is a Service.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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