bpm

package
v1.0.1-0...-b3ee44d Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package bpm contains the structs to represent BOSH BPM information

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Processes           []Process `yaml:"processes,omitempty" json:"processes,omitempty"`
	UnsupportedTemplate bool      `json:"unsupported_template"`

	// Bind these to reflect quarks properties update
	Ports               []Port                  `yaml:"ports,omitempty" json:"ports,omitempty"`
	Run                 RunConfig               `json:"run"`
	PostStart           PostStart               `json:"post_start"`
	Debug               bool                    `json:"debug"`
	ActivePassiveProbes map[string]corev1.Probe `json:"activePassiveProbes"`
}

Config represent a BPM configuration

func NewConfig

func NewConfig(data []byte) (Config, error)

NewConfig creates a new Config object from the yaml

func (Config) MergeProcesses

func (c Config) MergeProcesses(presetProcesses []Process) ([]Process, error)

MergeProcesses adds and updates the preset processes and returns a new list

func (Config) ValidateProcesses

func (c Config) ValidateProcesses() error

ValidateProcesses checks if all processes have an executable

type Configs

type Configs map[string]Config

Configs holds a collection of BPM configurations by their according job

func (Configs) ActivePassiveProbes

func (cs Configs) ActivePassiveProbes() map[string]corev1.Probe

ActivePassiveProbes returns all activePassive probes defined in the bpm configs

func (Configs) IsActivePassiveModel

func (cs Configs) IsActivePassiveModel() (isActivePassiveModel bool)

IsActivePassiveModel indicates whether these bpm configs contain ActivePassiveProbes

func (Configs) ServicePorts

func (cs Configs) ServicePorts() []corev1.ServicePort

ServicePorts returns the service ports defined in the bpm configs

type HealthCheck

type HealthCheck struct {
	ReadinessProbe *corev1.Probe `json:"readiness" yaml:"readiness"`
	LivenessProbe  *corev1.Probe `json:"liveness"  yaml:"liveness"`
}

HealthCheck defines liveness and readiness probes for a container.

type Hooks

type Hooks struct {
	PreStart string `yaml:"pre_start,omitempty" json:"pre_start,omitempty"`
}

Hooks from a BPM config

type Limits

type Limits struct {
	Memory    string `yaml:"memory,omitempty" json:"memory,omitempty"`
	CPU       string `yaml:"cpu,omitempty" json:"cpu,omitempty"`
	OpenFiles int    `yaml:"open_files,omitempty" json:"open_files,omitempty"`
	Processes int    `yaml:"processes,omitempty" json:"processes,omitempty"`
}

Limits from a BPM config

type Port

type Port struct {
	Name     string `json:"name"`
	Protocol string `json:"protocol"`
	Internal int    `json:"internal"`
}

Port represents the port to be opened up for this job only for tracing changes.

type PostStart

type PostStart struct {
	Condition *PostStartCondition `json:"condition,omitempty"`
}

PostStart allows post-start specifics to be passed through the manifest.

type PostStartCondition

type PostStartCondition struct {
	Exec *corev1.ExecAction `json:"exec,omitempty"`
}

PostStartCondition represents the condition that should succeed in order to execute the post-start script. It's often set to be the same as the readiness probe of a job.

type Process

type Process struct {
	Name              string              `yaml:"name,omitempty" json:"name,omitempty"`
	Executable        string              `yaml:"executable,omitempty" json:"executable,omitempty"`
	Args              []string            `yaml:"args,omitempty" json:"args,omitempty"`
	Env               map[string]string   `yaml:"env,omitempty" json:"env,omitempty"`
	Workdir           string              `yaml:"workdir,omitempty" json:"workdir,omitempty"`
	Hooks             Hooks               `yaml:"hooks,omitempty" json:"hooks,omitempty"`
	Capabilities      []string            `yaml:"capabilities,omitempty" json:"capabilities,omitempty"`
	Limits            Limits              `yaml:"limits,omitempty" json:"limits,omitempty"`
	Requests          corev1.ResourceList `json:"requests,omitempty" protobuf:"bytes,2,rep,name=requests,casttype=ResourceList,castkey=ResourceName"`
	EphemeralDisk     *bool               `yaml:"ephemeral_disk,omitempty" json:"ephemeral_disk,omitempty"`
	PersistentDisk    *bool               `yaml:"persistent_disk,omitempty" json:"persistent_disk,omitempty"`
	AdditionalVolumes []Volume            `yaml:"additional_volumes,omitempty" json:"additional_volumes,omitempty"`
	Unsafe            Unsafe              `yaml:"unsafe,omitempty" json:"unsafe,omitempty"`
}

Process from a BPM config

func (*Process) NewEnvs

func (p *Process) NewEnvs(overrides []corev1.EnvVar) []corev1.EnvVar

NewEnvs returns a list of k8s env vars, based on the bpm envs, overwritten by the overrides list passed to the function.

func (*Process) UpdateEnv

func (p *Process) UpdateEnv(overrides []corev1.EnvVar)

UpdateEnv adds the overrides env vars to the env list of the bpm process

type RunConfig

type RunConfig struct {
	HealthCheck     map[string]HealthCheck  `json:"healthcheck" yaml:"healthcheck"`
	SecurityContext *corev1.SecurityContext `json:"security_context" yaml:"security_context"`
}

RunConfig describes the runtime configuration for this job.

type Unsafe

type Unsafe struct {
	Privileged          bool     `yaml:"privileged,omitempty" json:"privileged,omitempty"`
	UnrestrictedVolumes []Volume `yaml:"unrestricted_volumes,omitempty" json:"unrestricted_volumes,omitempty"`
}

Unsafe from a BPM config

type Volume

type Volume struct {
	Path            string `yaml:"path,omitempty" json:"path,omitempty"`
	Writable        bool   `yaml:"writable,omitempty" json:"writable,omitempty"`
	AllowExecutions bool   `yaml:"allow_executions,omitempty" json:"allow_executions,omitempty"`
	MountOnly       bool   `yaml:"mount_only,omitempty" json:"mount_only,omitempty"`
}

Volume from a BPM config

Jump to

Keyboard shortcuts

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