manifest

package
v0.0.0-...-8223eb1 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2020 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package pods borrows heavily from the Kubernetes definition of pods to provide p2 with a convenient way to colocate several related launchable artifacts, as well as basic shared runtime configuration. Pod manifests are written as YAML files that describe what to launch.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidManifest

func ValidManifest(m Manifest) error

ValidManifest checks the internal consistency of a manifest. Returns an error if the data is inconsistent or "nil" otherwise.

Types

type Builder

type Builder interface {
	GetManifest() Manifest
	SetID(types.PodID)
	SetConfig(config map[interface{}]interface{}) error
	SetRunAsUser(user string)
	SetStatusHTTP(statusHTTP bool)
	SetStatusPath(statusPath string)
	SetStatusPort(port int)
	SetLaunchables(launchableStanzas map[launch.LaunchableID]launch.LaunchableStanza)
	SetResourceLimits(limits ResourceLimitsStanza)
	SetNodeRequirements(map[string]string)
	SetTerminationGracePeriod(seconds int)
}

func NewBuilder

func NewBuilder() Builder

type Manifest

type Manifest interface {
	ID() types.PodID
	RunAsUser() string
	UnpackAsUser() string
	Write(out io.Writer) error
	ConfigFileName() (string, error)
	WriteConfig(out io.Writer) error
	PlatformConfigFileName() (string, error)
	WritePlatformConfig(out io.Writer) error
	WriteResourceLimitsConfig(out io.Writer) error
	GetLaunchableStanzas() map[launch.LaunchableID]launch.LaunchableStanza
	GetResourceLimits() ResourceLimitsStanza
	ResourceLimitsConfigFileName() (string, error)
	GetConfig() map[interface{}]interface{}
	SHA() (string, error)
	GetArtifactRegistry(uri.Fetcher) artifact.Registry
	GetMinHealthPercentage() int
	GetStatusHTTP() bool
	GetStatusPath() string
	GetStatusPort() int
	GetStatusLocalhostOnly() bool
	GetStatusStanza() StatusStanza
	GetReadOnly() bool
	SetReadOnlyIfUnset(readonly bool)
	Marshal() ([]byte, error)
	SignatureData() (plaintext, signature []byte)
	GetNodeRequirements() map[string]string
	GetTerminationGracePeriod() time.Duration

	GetBuilder() Builder
}

Read-only immutable interface for manifests. To programmatically build a manifest, use Builder

func FromBytes

func FromBytes(bytes []byte) (Manifest, error)

FromBytes constructs a Manifest by parsing its serialized representation. The manifest can be a raw YAML document or a PGP clearsigned YAML document. If signed, the signature components will be stored inside the Manifest instance.

func FromPath

func FromPath(path string) (Manifest, error)

FromPath constructs a Manifest from a local file. This function is a helper for FromBytes().

func FromReader

func FromReader(reader io.Reader) (Manifest, error)

FromReader constructs a Manifest from an open Reader. All bytes will be read from the Reader. The caller is responsible for closing the Reader, if necessary. This function is a helper for FromBytes().

func FromURI

func FromURI(manifestUri *url.URL) (Manifest, error)

FromURI constructs a Manifest from data located at a URI. This function is a helper for FromBytes().

type ResourceLimitsConfigFileSchema

type ResourceLimitsConfigFileSchema struct {
	PodLimits        map[types.PodID]cgroups.Config      `yaml:"pod"`
	LaunchableLimits map[launch.LaunchableID]interface{} `yaml:"launchables"`
}

type ResourceLimitsStanza

type ResourceLimitsStanza struct {
	Cgroup *cgroups.Config `yaml:"cgroup,omitempty"`
}

type StatusStanza

type StatusStanza struct {
	HTTP          bool   `yaml:"http,omitempty"`
	Path          string `yaml:"path,omitempty"`
	Port          int    `yaml:"port,omitempty"`
	LocalhostOnly bool   `yaml:"localhost_only,omitempty"`
}

func (StatusStanza) GetPath

func (status StatusStanza) GetPath() string

Jump to

Keyboard shortcuts

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